All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] x86, irq: update the vector domain for legacy irqs handled by io-apic
@ 2010-01-29 19:42 Suresh Siddha
  2010-01-29 19:42 ` [patch 2/2] x86, irq: move __setup_vector_irq() before the first irq enable in cpu online path Suresh Siddha
  2010-01-29 23:12 ` [tip:x86/apic] x86, irq: Update the vector domain for legacy irqs handled by io-apic tip-bot for Suresh Siddha
  0 siblings, 2 replies; 4+ messages in thread
From: Suresh Siddha @ 2010-01-29 19:42 UTC (permalink / raw)
  To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner
  Cc: LKML, Suresh Siddha, Yinghai Lu, Eric W. Biederman, lizf

[-- Attachment #1: update_legacyirq_cfg_domains_handled_by_ioapic.patch --]
[-- Type: text/plain, Size: 1630 bytes --]

In the recent change of not reserving IRQ0_VECTOR..IRQ15_VECTOR's on all
cpu's, we start with irq 0..15 getting directed to (and handled on) cpu-0.

In the logical flat mode, once the AP's are online (and before irqbalance
comes into picture), kernel intends to handle these IRQ's on any cpu (as the
logical flat mode allows to specify multiple cpu's for the irq destination and
the chipset based routing can deliver to the interrupt to any one of
the specified cpu's). This was broken with our recent change, which was ending
up using only cpu 0 as the destination, even when the kernel was specifying to
use all online cpu's for the logical flat mode case.

Fix this by updating vector allocation domain (cfg->domain) for legacy irqs,
when the IO-APIC handles them.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Tested-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 0cc7022..a18bab0 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1428,6 +1428,14 @@ static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq
 
 	cfg = desc->chip_data;
 
+	/*
+ 	 * For legacy irqs, cfg->domain starts with cpu 0 for legacy
+ 	 * controllers like 8259. Now that IO-APIC can handle this irq, update
+ 	 * the cfg->domain.
+ 	 */
+	if (irq < nr_legacy_irqs && cpumask_test_cpu(0, cfg->domain))
+		apic->vector_allocation_domain(0, cfg->domain);
+
 	if (assign_irq_vector(irq, cfg, apic->target_cpus()))
 		return;
 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch 2/2] x86, irq: move __setup_vector_irq() before the first irq enable in cpu online path
  2010-01-29 19:42 [patch 1/2] x86, irq: update the vector domain for legacy irqs handled by io-apic Suresh Siddha
@ 2010-01-29 19:42 ` Suresh Siddha
  2010-01-29 23:12   ` [tip:x86/apic] x86, irq: Move " tip-bot for Suresh Siddha
  2010-01-29 23:12 ` [tip:x86/apic] x86, irq: Update the vector domain for legacy irqs handled by io-apic tip-bot for Suresh Siddha
  1 sibling, 1 reply; 4+ messages in thread
From: Suresh Siddha @ 2010-01-29 19:42 UTC (permalink / raw)
  To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner
  Cc: LKML, Suresh Siddha, Yinghai Lu, Eric W. Biederman, lizf

[-- Attachment #1: move_setup_vector_irq_before_first_enable_irq_during_cpu_online.patch --]
[-- Type: text/plain, Size: 2745 bytes --]

Lowest priority delivery of logical flat mode is broken on some systems,
such that even when IO-APIC RTE says deliver the interrupt to a particular CPU,
interrupt subsystem delivers the interrupt to totally different CPU.

For example, this behavior was observed on a P4 based system with SiS chipset
which was reported by Li Zefan. We have been handling this kind of behavior by
making sure that in logical flat mode, we assign the same vector to irq
mappings on all the 8 possible logical cpu's.

But we have been doing this initial assignment (__setup_vector_irq()) a little
late (before which interrupts were already enabled for a short duration).

Move the __setup_vector_irq() before the first irq enable point in the
cpu online path to avoid the issue of not handling some interrupts that
wrongly hit the cpu which is still coming online.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Tested-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 0cc7022..f99104c 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1256,11 +1256,16 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg)
 void __setup_vector_irq(int cpu)
 {
 	/* Initialize vector_irq on a new cpu */
-	/* This function must be called with vector_lock held */
 	int irq, vector;
 	struct irq_cfg *cfg;
 	struct irq_desc *desc;
 
+	/*
+ 	 * vector_lock will make sure that we don't run into irq vector
+ 	 * assignments that might be happening on another cpu in parallel,
+ 	 * while we setup our initial vector to irq mappings.
+ 	 */
+	spin_lock(&vector_lock);
 	/* Mark the inuse vectors */
 	for_each_irq_desc(irq, desc) {
 		cfg = desc->chip_data;
@@ -1279,6 +1284,7 @@ void __setup_vector_irq(int cpu)
 		if (!cpumask_test_cpu(cpu, cfg->domain))
 			per_cpu(vector_irq, cpu)[vector] = -1;
 	}
+	spin_unlock(&vector_lock);
 }
 
 static struct irq_chip ioapic_chip;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 678d0b8..d685049 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -241,6 +241,11 @@ static void __cpuinit smp_callin(void)
 	map_cpu_to_logical_apicid();
 
 	notify_cpu_starting(cpuid);
+
+	/*
+ 	 * Need to setup vector mappings before we enable interrupts.
+ 	 */
+	__setup_vector_irq(smp_processor_id());
 	/*
 	 * Get our bogomips.
 	 *
@@ -315,7 +320,6 @@ notrace static void __cpuinit start_secondary(void *unused)
 	 */
 	ipi_call_lock();
 	lock_vector_lock();
-	__setup_vector_irq(smp_processor_id());
 	set_cpu_online(smp_processor_id(), true);
 	unlock_vector_lock();
 	ipi_call_unlock();



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip:x86/apic] x86, irq: Update the vector domain for legacy irqs handled by io-apic
  2010-01-29 19:42 [patch 1/2] x86, irq: update the vector domain for legacy irqs handled by io-apic Suresh Siddha
  2010-01-29 19:42 ` [patch 2/2] x86, irq: move __setup_vector_irq() before the first irq enable in cpu online path Suresh Siddha
@ 2010-01-29 23:12 ` tip-bot for Suresh Siddha
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-01-29 23:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, lizf, suresh.b.siddha, tglx, ebiederm

Commit-ID:  69c89efb51510b3dc0fa336f7fa257c6e1799ee4
Gitweb:     http://git.kernel.org/tip/69c89efb51510b3dc0fa336f7fa257c6e1799ee4
Author:     Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Fri, 29 Jan 2010 11:42:20 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Fri, 29 Jan 2010 14:47:17 -0800

x86, irq: Update the vector domain for legacy irqs handled by io-apic

In the recent change of not reserving IRQ0_VECTOR..IRQ15_VECTOR's on all
cpu's, we start with irq 0..15 getting directed to (and handled on) cpu-0.

In the logical flat mode, once the AP's are online (and before irqbalance
comes into picture), kernel intends to handle these IRQ's on any cpu (as the
logical flat mode allows to specify multiple cpu's for the irq destination and
the chipset based routing can deliver to the interrupt to any one of
the specified cpu's). This was broken with our recent change, which was ending
up using only cpu 0 as the destination, even when the kernel was specifying to
use all online cpu's for the logical flat mode case.

Fix this by updating vector allocation domain (cfg->domain) for legacy irqs,
when the IO-APIC handles them.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <20100129194330.207790269@sbs-t61.sc.intel.com>
Tested-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/apic/io_apic.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 1a30587..2430b31 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1428,6 +1428,14 @@ static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq
 
 	cfg = desc->chip_data;
 
+	/*
+	 * For legacy irqs, cfg->domain starts with cpu 0 for legacy
+	 * controllers like 8259. Now that IO-APIC can handle this irq, update
+	 * the cfg->domain.
+	 */
+	if (irq < nr_legacy_irqs && cpumask_test_cpu(0, cfg->domain))
+		apic->vector_allocation_domain(0, cfg->domain);
+
 	if (assign_irq_vector(irq, cfg, apic->target_cpus()))
 		return;
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip:x86/apic] x86, irq: Move __setup_vector_irq() before the first irq enable in cpu online path
  2010-01-29 19:42 ` [patch 2/2] x86, irq: move __setup_vector_irq() before the first irq enable in cpu online path Suresh Siddha
@ 2010-01-29 23:12   ` tip-bot for Suresh Siddha
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Suresh Siddha @ 2010-01-29 23:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, lizf, suresh.b.siddha, tglx, ebiederm

Commit-ID:  9d133e5db993d577bd868b54083869fe5479fcff
Gitweb:     http://git.kernel.org/tip/9d133e5db993d577bd868b54083869fe5479fcff
Author:     Suresh Siddha <suresh.b.siddha@intel.com>
AuthorDate: Fri, 29 Jan 2010 11:42:21 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Fri, 29 Jan 2010 14:47:22 -0800

x86, irq: Move __setup_vector_irq() before the first irq enable in cpu online path

Lowest priority delivery of logical flat mode is broken on some systems,
such that even when IO-APIC RTE says deliver the interrupt to a particular CPU,
interrupt subsystem delivers the interrupt to totally different CPU.

For example, this behavior was observed on a P4 based system with SiS chipset
which was reported by Li Zefan. We have been handling this kind of behavior by
making sure that in logical flat mode, we assign the same vector to irq
mappings on all the 8 possible logical cpu's.

But we have been doing this initial assignment (__setup_vector_irq()) a little
late (before which interrupts were already enabled for a short duration).

Move the __setup_vector_irq() before the first irq enable point in the
cpu online path to avoid the issue of not handling some interrupts that
wrongly hit the cpu which is still coming online.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <20100129194330.283696385@sbs-t61.sc.intel.com>
Tested-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/apic/io_apic.c |    8 +++++++-
 arch/x86/kernel/smpboot.c      |    6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 2430b31..937150e 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1256,11 +1256,16 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg)
 void __setup_vector_irq(int cpu)
 {
 	/* Initialize vector_irq on a new cpu */
-	/* This function must be called with vector_lock held */
 	int irq, vector;
 	struct irq_cfg *cfg;
 	struct irq_desc *desc;
 
+	/*
+	 * vector_lock will make sure that we don't run into irq vector
+	 * assignments that might be happening on another cpu in parallel,
+	 * while we setup our initial vector to irq mappings.
+	 */
+	spin_lock(&vector_lock);
 	/* Mark the inuse vectors */
 	for_each_irq_desc(irq, desc) {
 		cfg = desc->chip_data;
@@ -1279,6 +1284,7 @@ void __setup_vector_irq(int cpu)
 		if (!cpumask_test_cpu(cpu, cfg->domain))
 			per_cpu(vector_irq, cpu)[vector] = -1;
 	}
+	spin_unlock(&vector_lock);
 }
 
 static struct irq_chip ioapic_chip;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 678d0b8..b2ebcba 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -241,6 +241,11 @@ static void __cpuinit smp_callin(void)
 	map_cpu_to_logical_apicid();
 
 	notify_cpu_starting(cpuid);
+
+	/*
+	 * Need to setup vector mappings before we enable interrupts.
+	 */
+	__setup_vector_irq(smp_processor_id());
 	/*
 	 * Get our bogomips.
 	 *
@@ -315,7 +320,6 @@ notrace static void __cpuinit start_secondary(void *unused)
 	 */
 	ipi_call_lock();
 	lock_vector_lock();
-	__setup_vector_irq(smp_processor_id());
 	set_cpu_online(smp_processor_id(), true);
 	unlock_vector_lock();
 	ipi_call_unlock();

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-29 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-29 19:42 [patch 1/2] x86, irq: update the vector domain for legacy irqs handled by io-apic Suresh Siddha
2010-01-29 19:42 ` [patch 2/2] x86, irq: move __setup_vector_irq() before the first irq enable in cpu online path Suresh Siddha
2010-01-29 23:12   ` [tip:x86/apic] x86, irq: Move " tip-bot for Suresh Siddha
2010-01-29 23:12 ` [tip:x86/apic] x86, irq: Update the vector domain for legacy irqs handled by io-apic tip-bot for Suresh Siddha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.