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
319 319
320extern cpumask_var_t irq_default_affinity;320extern cpumask_var_t irq_default_affinity;
321 321
322/* Internal implementation. Use the helpers below */322extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
323extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask,323extern int irq_force_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 */
333static inline int
334irq_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 */
350static inline int
351irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
352{
353 return __irq_set_affinity(irq, cpumask, true);
354}
355 324
356extern int irq_can_set_affinity(unsigned int irq);325extern int irq_can_set_affinity(unsigned int irq);
357extern int irq_select_affinity(unsigned int irq);326extern int irq_select_affinity(unsigned int irq);
kernel/irq/manage.c+32−1
@@ -441,7 +441,8 @@ out_unlock: · 440 unmodified lines
441 return ret;441 return ret;
442}442}
443 443
444int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force)444static int __irq_set_affinity(unsigned int irq, const struct cpumask *mask,
445 bool force)
445{446{
446 struct irq_desc *desc = irq_to_desc(irq);447 struct irq_desc *desc = irq_to_desc(irq);
447 unsigned long flags;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 return ret;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 */
467int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
468{
469 return __irq_set_affinity(irq, cpumask, false);
470}
471EXPORT_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 */
484int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
485{
486 return __irq_set_affinity(irq, cpumask, true);
487}
488EXPORT_SYMBOL_GPL(irq_force_affinity);
489
459int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)490int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
460{491{
461 unsigned long flags;492 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