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.
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -441,7 +441,8 @@ out_unlock: · 440 unmodified lines | ||
| 441 | 441 | return ret; |
| 442 | 442 | } |
| 443 | 443 | |
| 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) | |
| 445 | 446 | { |
| 446 | 447 | struct irq_desc *desc = irq_to_desc(irq); |
| 447 | 448 | unsigned long flags; |
| @@ -456,6 +457,36 @@ int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) · 8 unmodified lines | ||
| 456 | 457 | return ret; |
| 457 | 458 | } |
| 458 | 459 | |
| 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 | + | |
| 459 | 490 | int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) |
| 460 | 491 | { |
| 461 | 492 | unsigned long flags; |