mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
[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 <[email protected]> Acked-by: Zwane Mwaikambo <[email protected]> Grudgingly-acked-by: Andi Kleen <[email protected]> Signed-off-by: Coywolf Qi Hunt <[email protected]> Signed-off-by: Ashok Raj <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f63ed39c57
commit
54d5d42404
13 changed files with 253 additions and 134 deletions
|
|
@ -91,6 +91,7 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask)
|
|||
{
|
||||
struct msi_desc *entry;
|
||||
struct msg_address address;
|
||||
unsigned int irq = vector;
|
||||
|
||||
entry = (struct msi_desc *)msi_desc[vector];
|
||||
if (!entry || !entry->dev)
|
||||
|
|
@ -112,6 +113,7 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask)
|
|||
entry->msi_attrib.current_cpu = cpu_mask_to_apicid(cpu_mask);
|
||||
pci_write_config_dword(entry->dev, msi_lower_address_reg(pos),
|
||||
address.lo_address.value);
|
||||
set_native_irq_info(irq, cpu_mask);
|
||||
break;
|
||||
}
|
||||
case PCI_CAP_ID_MSIX:
|
||||
|
|
@ -125,22 +127,13 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask)
|
|||
MSI_TARGET_CPU_SHIFT);
|
||||
entry->msi_attrib.current_cpu = cpu_mask_to_apicid(cpu_mask);
|
||||
writel(address.lo_address.value, entry->mask_base + offset);
|
||||
set_native_irq_info(irq, cpu_mask);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IRQBALANCE
|
||||
static inline void move_msi(int vector)
|
||||
{
|
||||
if (!cpus_empty(pending_irq_balance_cpumask[vector])) {
|
||||
set_msi_affinity(vector, pending_irq_balance_cpumask[vector]);
|
||||
cpus_clear(pending_irq_balance_cpumask[vector]);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_IRQBALANCE */
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
static void mask_MSI_irq(unsigned int vector)
|
||||
|
|
@ -191,13 +184,13 @@ static void shutdown_msi_irq(unsigned int vector)
|
|||
|
||||
static void end_msi_irq_wo_maskbit(unsigned int vector)
|
||||
{
|
||||
move_msi(vector);
|
||||
move_native_irq(vector);
|
||||
ack_APIC_irq();
|
||||
}
|
||||
|
||||
static void end_msi_irq_w_maskbit(unsigned int vector)
|
||||
{
|
||||
move_msi(vector);
|
||||
move_native_irq(vector);
|
||||
unmask_MSI_irq(vector);
|
||||
ack_APIC_irq();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#define NR_HP_RESERVED_VECTORS 20
|
||||
|
||||
extern int vector_irq[NR_VECTORS];
|
||||
extern cpumask_t pending_irq_balance_cpumask[NR_IRQS];
|
||||
extern void (*interrupt[NR_IRQS])(void);
|
||||
extern int pci_vector_resources(int last, int nr_released);
|
||||
|
||||
|
|
@ -29,10 +28,6 @@ extern int pci_vector_resources(int last, int nr_released);
|
|||
#define set_msi_irq_affinity NULL
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_IRQBALANCE
|
||||
static inline void move_msi(int vector) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MSI-X Address Register
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue