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

Showing the changes to kernel (1 of 2 files). Show all

Unified · Split

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