aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/manage.c
diff options
context:
space:
mode:
authorMax Krasnyansky <maxk@qualcomm.com>2008-05-29 14:02:52 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-06-05 09:18:30 -0400
commit18404756765c713a0be4eb1082920c04822ce588 (patch)
treeed426f8fe90bff1ffd854074a2e4b370dd6821f8 /kernel/irq/manage.c
parentc3b25b32e8bef526cca748e1ba023c6bdd705a99 (diff)
genirq: Expose default irq affinity mask (take 3)
Current IRQ affinity interface does not provide a way to set affinity for the IRQs that will be allocated/activated in the future. This patch creates /proc/irq/default_smp_affinity that lets users set default affinity mask for the newly allocated IRQs. Changing the default does not affect affinity masks for the currently active IRQs, they have to be changed explicitly. Updated based on Paul J's comments and added some more documentation. Signed-off-by: Max Krasnyansky <maxk@qualcomm.com> Cc: pj@sgi.com Cc: a.p.zijlstra@chello.nl Cc: tglx@linutronix.de Cc: rdunlap@xenotime.net Cc: mingo@elte.hu Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r--kernel/irq/manage.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 46d6611a33bb..469814e9b9ee 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -17,6 +17,8 @@
17 17
18#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
19 19
20cpumask_t irq_default_affinity = CPU_MASK_ALL;
21
20/** 22/**
21 * synchronize_irq - wait for pending IRQ handlers (on other CPUs) 23 * synchronize_irq - wait for pending IRQ handlers (on other CPUs)
22 * @irq: interrupt number to wait for 24 * @irq: interrupt number to wait for
@@ -95,6 +97,27 @@ int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
95 return 0; 97 return 0;
96} 98}
97 99
100#ifndef CONFIG_AUTO_IRQ_AFFINITY
101/*
102 * Generic version of the affinity autoselector.
103 */
104int irq_select_affinity(unsigned int irq)
105{
106 cpumask_t mask;
107
108 if (!irq_can_set_affinity(irq))
109 return 0;
110
111 cpus_and(mask, cpu_online_map, irq_default_affinity);
112
113 irq_desc[irq].affinity = mask;
114 irq_desc[irq].chip->set_affinity(irq, mask);
115
116 set_balance_irq_affinity(irq, mask);
117 return 0;
118}
119#endif
120
98#endif 121#endif
99 122
100/** 123/**
@@ -382,6 +405,9 @@ int setup_irq(unsigned int irq, struct irqaction *new)
382 } else 405 } else
383 /* Undo nested disables: */ 406 /* Undo nested disables: */
384 desc->depth = 1; 407 desc->depth = 1;
408
409 /* Set default affinity mask once everything is setup */
410 irq_select_affinity(irq);
385 } 411 }
386 /* Reset broken irq detection when installing new handler */ 412 /* Reset broken irq detection when installing new handler */
387 desc->irq_count = 0; 413 desc->irq_count = 0;
@@ -571,8 +597,6 @@ int request_irq(unsigned int irq, irq_handler_t handler,
571 action->next = NULL; 597 action->next = NULL;
572 action->dev_id = dev_id; 598 action->dev_id = dev_id;
573 599
574 select_smp_affinity(irq);
575
576#ifdef CONFIG_DEBUG_SHIRQ 600#ifdef CONFIG_DEBUG_SHIRQ
577 if (irqflags & IRQF_SHARED) { 601 if (irqflags & IRQF_SHARED) {
578 /* 602 /*