Skip to content

Commit b9c6aa9

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
genirq: Update request_percpu_nmi() to take an affinity
Continue spreading the notion of affinity to the per CPU interrupt request code by updating the call sites that use request_percpu_nmi() (all two of them) to take an affinity pointer. This pointer is firmly NULL for now. 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-16-maz@kernel.org
1 parent 258e7d2 commit b9c6aa9

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

arch/arm64/kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ static void ipi_setup_sgi(int ipi)
10941094
irq = ipi_irq_base + ipi;
10951095

10961096
if (ipi_should_be_nmi(ipi)) {
1097-
err = request_percpu_nmi(irq, ipi_handler, "IPI", &irq_stat);
1097+
err = request_percpu_nmi(irq, ipi_handler, "IPI", NULL, &irq_stat);
10981098
WARN(err, "Could not request IRQ %d as NMI, err=%d\n", irq, err);
10991099
} else {
11001100
err = request_percpu_irq(irq, ipi_handler, "IPI", &irq_stat);

drivers/perf/arm_pmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ int armpmu_request_irq(int irq, int cpu)
659659
irq_ops = &pmunmi_ops;
660660
}
661661
} else if (armpmu_count_irq_users(irq) == 0) {
662-
err = request_percpu_nmi(irq, handler, "arm-pmu", &cpu_armpmu);
662+
err = request_percpu_nmi(irq, handler, "arm-pmu", NULL, &cpu_armpmu);
663663

664664
/* If cannot get an NMI, get a normal interrupt */
665665
if (err) {

include/linux/interrupt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ request_percpu_irq(unsigned int irq, irq_handler_t handler,
197197
}
198198

199199
extern int __must_check
200-
request_percpu_nmi(unsigned int irq, irq_handler_t handler,
201-
const char *devname, void __percpu *dev);
200+
request_percpu_nmi(unsigned int irq, irq_handler_t handler, const char *name,
201+
const struct cpumask *affinity, void __percpu *dev_id);
202202

203203
extern const void *free_irq(unsigned int, void *);
204204
extern void free_percpu_irq(unsigned int, void __percpu *);

kernel/irq/manage.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,6 +2527,7 @@ EXPORT_SYMBOL_GPL(__request_percpu_irq);
25272527
* @irq: Interrupt line to allocate
25282528
* @handler: Function to be called when the IRQ occurs.
25292529
* @name: An ascii name for the claiming device
2530+
* @affinity: A cpumask describing the target CPUs for this interrupt
25302531
* @dev_id: A percpu cookie passed back to the handler function
25312532
*
25322533
* This call allocates interrupt resources for a per CPU NMI. Per CPU NMIs
@@ -2543,8 +2544,8 @@ EXPORT_SYMBOL_GPL(__request_percpu_irq);
25432544
* If the interrupt line cannot be used to deliver NMIs, function
25442545
* will fail returning a negative value.
25452546
*/
2546-
int request_percpu_nmi(unsigned int irq, irq_handler_t handler,
2547-
const char *name, void __percpu *dev_id)
2547+
int request_percpu_nmi(unsigned int irq, irq_handler_t handler, const char *name,
2548+
const struct cpumask *affinity, void __percpu *dev_id)
25482549
{
25492550
struct irqaction *action;
25502551
struct irq_desc *desc;
@@ -2561,12 +2562,13 @@ int request_percpu_nmi(unsigned int irq, irq_handler_t handler,
25612562
!irq_supports_nmi(desc))
25622563
return -EINVAL;
25632564

2564-
/* The line cannot already be NMI */
2565-
if (irq_is_nmi(desc))
2565+
/* The line cannot be NMI already if the new request covers all CPUs */
2566+
if (irq_is_nmi(desc) &&
2567+
(!affinity || cpumask_equal(affinity, cpu_possible_mask)))
25662568
return -EINVAL;
25672569

25682570
action = create_percpu_irqaction(handler, IRQF_NO_THREAD | IRQF_NOBALANCING,
2569-
name, NULL, dev_id);
2571+
name, affinity, dev_id);
25702572
if (!action)
25712573
return -ENOMEM;
25722574

0 commit comments

Comments
 (0)