Hi everyone, I would like to get some feedback from the RT community before submitting to the mainline. Currently, by writing to /proc/irq/../smp_affinity file, core affinity of already running IRQ threads can be modified. However, after writing to the /proc file, an IRQ thread that gets created later does not inherit the affinity specified in the file. This happens because the irq action is registered in irq description only after setup_affinity function is called. This patch addresses this problem by calling setup_affinity function after the irq action is updated in the irq description structure. It looks like the existing behavior (without this patch) is inconsistent because in the case of multiple action handlers for an irq, the IRQ thread associated with the new action handler that is being registered does not inherit the core affinity from the /proc file, however, the IRQ threads of the existing action handlers do inherit the affinity. diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 87dc0539cebb26bd7122e1f2a608be7325ade437..05c64c5fc2be5c2db34e74e5a5f4d3c6f9c74bca 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -1083,9 +1083,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) if (new->flags & IRQF_NO_SOFTIRQ_CALL) irq_settings_set_no_softirq_call(desc); - /* Set default affinity mask once everything is setup */ - setup_affinity(irq, desc, mask); - } else if (new->flags & IRQF_TRIGGER_MASK) { unsigned int nmsk = new->flags & IRQF_TRIGGER_MASK; unsigned int omsk = irq_settings_get_trigger_mask(desc); @@ -1099,6 +1096,17 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) new->irq = irq; *old_ptr = new; + /* Set default affinity mask once everything is setup. + * We have to do this after the desc->action is assigned the new action + * just above. If setup_affinity is called before, then the IRQ thread + * associated with the new action does not inherit the core affinity + * specified in /proc/irq/<irq_num>/smp_affinity file whereas the IRQ + * threads of the existing action handlers do inherit. + */ + if (!shared) { + setup_affinity(irq, desc, mask); + } + /* Reset broken irq detection when installing new handler */ desc->irq_count = 0; desc->irqs_unhandled = 0; -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html