[PATCH] x86/x86_64: deferred handling of writes to /proc/irqxx/smp_affinity
When handling writes to /proc/irq, current code is re-programming rte entries directly. This is not recommended and could potentially cause chipset's to lockup, or cause missing interrupts. CONFIG_IRQ_BALANCE does this correctly, where it re-programs only when the interrupt is pending. The same needs to be done for /proc/irq handling as well. Otherwise user space irq balancers are really not doing the right thing. - Changed pending_irq_balance_cpumask to pending_irq_migrate_cpumask for lack of a generic name. - added move_irq out of IRQ_BALANCE, and added this same to X86_64 - Added new proc handler for write, so we can do deferred write at irq handling time. - Display of /proc/irq/XX/smp_affinity used to display CPU_MASKALL, instead it now shows only active cpu masks, or exactly what was set. - Provided a common move_irq implementation, instead of duplicating when using generic irq framework. Tested on i386/x86_64 and ia64 with CONFIG_PCI_MSI turned on and off. Tested UP builds as well. MSI testing: tbd: I have cards, need to look for a x-over cable, although I did test an earlier version of this patch. Will test in a couple days. Signed-off-by: Ashok Raj <ashok.raj@intel.com> Acked-by: Zwane Mwaikambo <zwane@holomorphy.com> Grudgingly-acked-by: Andi Kleen <ak@muc.de> Signed-off-by: Coywolf Qi Hunt <coywolf@lovecn.org> Signed-off-by: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
f63ed39c57
commit
54d5d42404
@ -434,6 +434,11 @@ config GENERIC_IRQ_PROBE
|
||||
bool
|
||||
default y
|
||||
|
||||
config GENERIC_PENDING_IRQ
|
||||
bool
|
||||
depends on GENERIC_HARDIRQS && SMP
|
||||
default y
|
||||
|
||||
source "arch/ia64/hp/sim/Kconfig"
|
||||
|
||||
source "arch/ia64/oprofile/Kconfig"
|
||||
|
@ -91,23 +91,8 @@ skip:
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/*
|
||||
* This is updated when the user sets irq affinity via /proc
|
||||
*/
|
||||
static cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS];
|
||||
static unsigned long pending_irq_redir[BITS_TO_LONGS(NR_IRQS)];
|
||||
|
||||
static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 };
|
||||
|
||||
/*
|
||||
* Arch specific routine for deferred write to iosapic rte to reprogram
|
||||
* intr destination.
|
||||
*/
|
||||
void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
|
||||
{
|
||||
pending_irq_cpumask[irq] = mask_val;
|
||||
}
|
||||
|
||||
void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
|
||||
{
|
||||
cpumask_t mask = CPU_MASK_NONE;
|
||||
@ -116,32 +101,10 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
|
||||
|
||||
if (irq < NR_IRQS) {
|
||||
irq_affinity[irq] = mask;
|
||||
set_irq_info(irq, mask);
|
||||
irq_redir[irq] = (char) (redir & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void move_irq(int irq)
|
||||
{
|
||||
/* note - we hold desc->lock */
|
||||
cpumask_t tmp;
|
||||
irq_desc_t *desc = irq_descp(irq);
|
||||
int redir = test_bit(irq, pending_irq_redir);
|
||||
|
||||
if (unlikely(!desc->handler->set_affinity))
|
||||
return;
|
||||
|
||||
if (!cpus_empty(pending_irq_cpumask[irq])) {
|
||||
cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
|
||||
if (unlikely(!cpus_empty(tmp))) {
|
||||
desc->handler->set_affinity(irq | (redir ? IA64_IRQ_REDIRECTED : 0),
|
||||
pending_irq_cpumask[irq]);
|
||||
}
|
||||
cpus_clear(pending_irq_cpumask[irq]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
|
Reference in New Issue
Block a user