Skip to content

Commit 4d80d6c

Browse files
committed
genirq: Export affinity setter for modules
Perf modules abuse irq_set_affinity_hint() to set the affinity of system PMU interrupts just because irq_set_affinity() was not exported. The fact that irq_set_affinity_hint() actually sets the affinity is a non-documented side effect and the name is clearly saying it's a hint. To clean this up, export the real affinity setter. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d07f6ca commit 4d80d6c

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

include/linux/interrupt.h

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -319,39 +319,8 @@ struct irq_affinity_desc {
319319

320320
extern cpumask_var_t irq_default_affinity;
321321

322-
/* Internal implementation. Use the helpers below */
323-
extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask,
324-
bool force);
325-
326-
/**
327-
* irq_set_affinity - Set the irq affinity of a given irq
328-
* @irq: Interrupt to set affinity
329-
* @cpumask: cpumask
330-
*
331-
* Fails if cpumask does not contain an online CPU
332-
*/
333-
static inline int
334-
irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
335-
{
336-
return __irq_set_affinity(irq, cpumask, false);
337-
}
338-
339-
/**
340-
* irq_force_affinity - Force the irq affinity of a given irq
341-
* @irq: Interrupt to set affinity
342-
* @cpumask: cpumask
343-
*
344-
* Same as irq_set_affinity, but without checking the mask against
345-
* online cpus.
346-
*
347-
* Solely for low level cpu hotplug code, where we need to make per
348-
* cpu interrupts affine before the cpu becomes online.
349-
*/
350-
static inline int
351-
irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
352-
{
353-
return __irq_set_affinity(irq, cpumask, true);
354-
}
322+
extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
323+
extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask);
355324

356325
extern int irq_can_set_affinity(unsigned int irq);
357326
extern int irq_select_affinity(unsigned int irq);

kernel/irq/manage.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ int irq_update_affinity_desc(unsigned int irq,
441441
return ret;
442442
}
443443

444-
int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force)
444+
static int __irq_set_affinity(unsigned int irq, const struct cpumask *mask,
445+
bool force)
445446
{
446447
struct irq_desc *desc = irq_to_desc(irq);
447448
unsigned long flags;
@@ -456,6 +457,36 @@ int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force)
456457
return ret;
457458
}
458459

460+
/**
461+
* irq_set_affinity - Set the irq affinity of a given irq
462+
* @irq: Interrupt to set affinity
463+
* @cpumask: cpumask
464+
*
465+
* Fails if cpumask does not contain an online CPU
466+
*/
467+
int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
468+
{
469+
return __irq_set_affinity(irq, cpumask, false);
470+
}
471+
EXPORT_SYMBOL_GPL(irq_set_affinity);
472+
473+
/**
474+
* irq_force_affinity - Force the irq affinity of a given irq
475+
* @irq: Interrupt to set affinity
476+
* @cpumask: cpumask
477+
*
478+
* Same as irq_set_affinity, but without checking the mask against
479+
* online cpus.
480+
*
481+
* Solely for low level cpu hotplug code, where we need to make per
482+
* cpu interrupts affine before the cpu becomes online.
483+
*/
484+
int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
485+
{
486+
return __irq_set_affinity(irq, cpumask, true);
487+
}
488+
EXPORT_SYMBOL_GPL(irq_force_affinity);
489+
459490
int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
460491
{
461492
unsigned long flags;

0 commit comments

Comments
 (0)