Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

genirq: Add affinity to percpu_devid interrupt requests

Add an affinity field to both the irqaction structure and the interrupt
request primitives. Nothing is making use of it yet, and the only value
used it NULL, which is used as a shorthand for cpu_possible_mask.

This will shortly get used with actual affinities.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Will Deacon <will@kernel.org>
Link: https://patch.msgid.link/20251020122944.3074811-15-maz@kernel.org

authored by

Marc Zyngier and committed by
Thomas Gleixner
258e7d28 9047a39d

+13 -6
+3 -2
include/linux/interrupt.h
··· 125 125 void *dev_id; 126 126 void __percpu *percpu_dev_id; 127 127 }; 128 + const struct cpumask *affinity; 128 129 struct irqaction *next; 129 130 irq_handler_t thread_fn; 130 131 struct task_struct *thread; ··· 182 181 extern int __must_check 183 182 __request_percpu_irq(unsigned int irq, irq_handler_t handler, 184 183 unsigned long flags, const char *devname, 185 - void __percpu *percpu_dev_id); 184 + const cpumask_t *affinity, void __percpu *percpu_dev_id); 186 185 187 186 extern int __must_check 188 187 request_nmi(unsigned int irq, irq_handler_t handler, unsigned long flags, ··· 193 192 const char *devname, void __percpu *percpu_dev_id) 194 193 { 195 194 return __request_percpu_irq(irq, handler, 0, 196 - devname, percpu_dev_id); 195 + devname, NULL, percpu_dev_id); 197 196 } 198 197 199 198 extern int __must_check
+10 -4
kernel/irq/manage.c
··· 2444 2444 2445 2445 static 2446 2446 struct irqaction *create_percpu_irqaction(irq_handler_t handler, unsigned long flags, 2447 - const char *devname, void __percpu *dev_id) 2447 + const char *devname, const cpumask_t *affinity, 2448 + void __percpu *dev_id) 2448 2449 { 2449 2450 struct irqaction *action; 2451 + 2452 + if (!affinity) 2453 + affinity = cpu_possible_mask; 2450 2454 2451 2455 action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 2452 2456 if (!action) ··· 2460 2456 action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND; 2461 2457 action->name = devname; 2462 2458 action->percpu_dev_id = dev_id; 2459 + action->affinity = affinity; 2463 2460 2464 2461 return action; 2465 2462 } ··· 2471 2466 * @handler: Function to be called when the IRQ occurs. 2472 2467 * @flags: Interrupt type flags (IRQF_TIMER only) 2473 2468 * @devname: An ascii name for the claiming device 2469 + * @affinity: A cpumask describing the target CPUs for this interrupt 2474 2470 * @dev_id: A percpu cookie passed back to the handler function 2475 2471 * 2476 2472 * This call allocates interrupt resources, but doesn't enable the interrupt ··· 2484 2478 */ 2485 2479 int __request_percpu_irq(unsigned int irq, irq_handler_t handler, 2486 2480 unsigned long flags, const char *devname, 2487 - void __percpu *dev_id) 2481 + const cpumask_t *affinity, void __percpu *dev_id) 2488 2482 { 2489 2483 struct irqaction *action; 2490 2484 struct irq_desc *desc; ··· 2501 2495 if (flags && flags != IRQF_TIMER) 2502 2496 return -EINVAL; 2503 2497 2504 - action = create_percpu_irqaction(handler, flags, devname, dev_id); 2498 + action = create_percpu_irqaction(handler, flags, devname, affinity, dev_id); 2505 2499 if (!action) 2506 2500 return -ENOMEM; 2507 2501 ··· 2566 2560 return -EINVAL; 2567 2561 2568 2562 action = create_percpu_irqaction(handler, IRQF_NO_THREAD | IRQF_NOBALANCING, 2569 - name, dev_id); 2563 + name, NULL, dev_id); 2570 2564 if (!action) 2571 2565 return -ENOMEM; 2572 2566