lkml.org 
[lkml]   [2009]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 4/9] irq: only update affinity if set_affinity() sucessfully -v4

    Impact: don't change smp_affinity if set_affinity fail

    irq_set_affinity() and move_masked_irq() try to assign affinity
    before calling chip set_affinity(). some archs are assigning again in set_affinity
    again.

    something like:
    cpumask_cpy(desc->affinity, mask);
    desc->chip->set_affinity(mask);

    in the failing path, affinity should not be touched.

    So try update the afffinity only if set_affinity return wth 0
    also call irq_set_thread_affinity accordingly

    v2: update after "irq, x86: Remove IRQ_DISABLED check in process context IRQ move"
    v3: according to Ingo, change set_affinity() in irq_chip to return int.
    v4: update comments by removing moving irq_desc code.

    Signed-off-by: Yinghai Lu <yinghai@kernel.org>

    ---
    kernel/irq/internals.h | 3 +++
    kernel/irq/manage.c | 17 +++++++++++------
    kernel/irq/migration.c | 14 +++++++++-----
    3 files changed, 23 insertions(+), 11 deletions(-)

    Index: linux-2.6/kernel/irq/internals.h
    ===================================================================
    --- linux-2.6.orig/kernel/irq/internals.h
    +++ linux-2.6/kernel/irq/internals.h
    @@ -42,6 +42,9 @@ static inline void unregister_handler_pr

    extern int irq_select_affinity_usr(unsigned int irq);

    +extern void
    +irq_set_thread_affinity(struct irq_desc *desc, const struct cpumask *cpumask);
    +
    /*
    * Debugging printout:
    */
    Index: linux-2.6/kernel/irq/manage.c
    ===================================================================
    --- linux-2.6.orig/kernel/irq/manage.c
    +++ linux-2.6/kernel/irq/manage.c
    @@ -80,7 +80,7 @@ int irq_can_set_affinity(unsigned int ir
    return 1;
    }

    -static void
    +void
    irq_set_thread_affinity(struct irq_desc *desc, const struct cpumask *cpumask)
    {
    struct irqaction *action = desc->action;
    @@ -109,17 +109,22 @@ int irq_set_affinity(unsigned int irq, c
    spin_lock_irqsave(&desc->lock, flags);

    #ifdef CONFIG_GENERIC_PENDING_IRQ
    - if (desc->status & IRQ_MOVE_PCNTXT)
    - desc->chip->set_affinity(irq, cpumask);
    + if (desc->status & IRQ_MOVE_PCNTXT) {
    + if (!desc->chip->set_affinity(irq, cpumask)) {
    + cpumask_copy(desc->affinity, cpumask);
    + irq_set_thread_affinity(desc, cpumask);
    + }
    + }
    else {
    desc->status |= IRQ_MOVE_PENDING;
    cpumask_copy(desc->pending_mask, cpumask);
    }
    #else
    - cpumask_copy(desc->affinity, cpumask);
    - desc->chip->set_affinity(irq, cpumask);
    + if (!desc->chip->set_affinity(irq, cpumask)) {
    + cpumask_copy(desc->affinity, cpumask);
    + irq_set_thread_affinity(desc, cpumask);
    + }
    #endif
    - irq_set_thread_affinity(desc, cpumask);
    desc->status |= IRQ_AFFINITY_SET;
    spin_unlock_irqrestore(&desc->lock, flags);
    return 0;
    Index: linux-2.6/kernel/irq/migration.c
    ===================================================================
    --- linux-2.6.orig/kernel/irq/migration.c
    +++ linux-2.6/kernel/irq/migration.c
    @@ -1,5 +1,8 @@

    #include <linux/irq.h>
    +#include <linux/interrupt.h>
    +
    +#include "internals.h"

    void move_masked_irq(int irq)
    {
    @@ -39,11 +42,12 @@ void move_masked_irq(int irq)
    * masking the irqs.
    */
    if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask)
    - < nr_cpu_ids)) {
    - cpumask_and(desc->affinity,
    - desc->pending_mask, cpu_online_mask);
    - desc->chip->set_affinity(irq, desc->affinity);
    - }
    + < nr_cpu_ids))
    + if (!desc->chip->set_affinity(irq, desc->pending_mask)) {
    + cpumask_copy(desc->affinity, desc->pending_mask);
    + irq_set_thread_affinity(desc, desc->pending_mask);
    + }
    +
    cpumask_clear(desc->pending_mask);
    }


    \
     
     \ /
      Last update: 2009-04-17 06:25    [W:0.024 / U:62.396 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site