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: Factor-in percpu irqaction creation

Move the code creating a per-cpu irqaction into its own helper, so that
future changes to this code can be kept localised.

At the same time, fix the documentation which appears to say the wrong
thing when it comes to interrupts being automatically enabled
(percpu_devid interrupts never are).

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Will Deacon <will@kernel.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20251020122944.3074811-14-maz@kernel.org

authored by

Marc Zyngier and committed by
Thomas Gleixner
9047a39d 5c2b2cc4

+24 -16
+24 -16
kernel/irq/manage.c
··· 2442 2442 return retval; 2443 2443 } 2444 2444 2445 + static 2446 + struct irqaction *create_percpu_irqaction(irq_handler_t handler, unsigned long flags, 2447 + const char *devname, void __percpu *dev_id) 2448 + { 2449 + struct irqaction *action; 2450 + 2451 + action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 2452 + if (!action) 2453 + return NULL; 2454 + 2455 + action->handler = handler; 2456 + action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND; 2457 + action->name = devname; 2458 + action->percpu_dev_id = dev_id; 2459 + 2460 + return action; 2461 + } 2462 + 2445 2463 /** 2446 2464 * __request_percpu_irq - allocate a percpu interrupt line 2447 2465 * @irq: Interrupt line to allocate ··· 2468 2450 * @devname: An ascii name for the claiming device 2469 2451 * @dev_id: A percpu cookie passed back to the handler function 2470 2452 * 2471 - * This call allocates interrupt resources and enables the interrupt on the 2472 - * local CPU. If the interrupt is supposed to be enabled on other CPUs, it 2473 - * has to be done on each CPU using enable_percpu_irq(). 2453 + * This call allocates interrupt resources, but doesn't enable the interrupt 2454 + * on any CPU, as all percpu-devid interrupts are flagged with IRQ_NOAUTOEN. 2455 + * It has to be done on each CPU using enable_percpu_irq(). 2474 2456 * 2475 2457 * @dev_id must be globally unique. It is a per-cpu variable, and 2476 2458 * the handler gets called with the interrupted CPU's instance of ··· 2495 2477 if (flags && flags != IRQF_TIMER) 2496 2478 return -EINVAL; 2497 2479 2498 - action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 2480 + action = create_percpu_irqaction(handler, flags, devname, dev_id); 2499 2481 if (!action) 2500 2482 return -ENOMEM; 2501 - 2502 - action->handler = handler; 2503 - action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND; 2504 - action->name = devname; 2505 - action->percpu_dev_id = dev_id; 2506 2483 2507 2484 retval = irq_chip_pm_get(&desc->irq_data); 2508 2485 if (retval < 0) { ··· 2559 2546 if (irq_is_nmi(desc)) 2560 2547 return -EINVAL; 2561 2548 2562 - action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 2549 + action = create_percpu_irqaction(handler, IRQF_NO_THREAD | IRQF_NOBALANCING, 2550 + name, dev_id); 2563 2551 if (!action) 2564 2552 return -ENOMEM; 2565 - 2566 - action->handler = handler; 2567 - action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND | IRQF_NO_THREAD 2568 - | IRQF_NOBALANCING; 2569 - action->name = name; 2570 - action->percpu_dev_id = dev_id; 2571 2553 2572 2554 retval = irq_chip_pm_get(&desc->irq_data); 2573 2555 if (retval < 0)