History

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.

Thomas Gleixner committed 5 years ago

Commit 4d80d6c1 parent d07f6ca2 files · +34 −34Browse files

Unified · Split

2 files
  1. include/linux/interrupt.h +2 −33
  2. kernel/irq/manage.c +32 −1
include/linux/interrupt.h+2−33
@@ -319,39 +319,8 @@ struct irq_affinity_desc { · 318 unmodified lines
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+32−1
@@ -441,7 +441,8 @@ out_unlock: · 440 unmodified lines
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) · 8 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t