All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] add apic_irqs bitmap to identify irqs from apic
@ 2014-04-21  1:18 Jason Chen
  2014-04-21  1:18 ` [RFC PATCH 1/1] x86/apic: " Jason Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Chen @ 2014-04-21  1:18 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86; +Cc: linux-kernel, Jason Chen

During irq migration, irq_force_complete_move() will consider all irqs coming from apic kind of
irq chip, but they may also coming from other irq chip, such kind of irqs should be filtered out.

Jason Chen (1):
  x86/apic: add apic_irqs bitmap to identify irqs from apic

 arch/x86/kernel/apic/io_apic.c | 21 ++++++++++++++++++++-
 include/linux/irqdesc.h        |  6 ++++++
 kernel/irq/internals.h         |  6 ------
 3 files changed, 26 insertions(+), 7 deletions(-)

-- 
1.8.1.2


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

* [RFC PATCH 1/1] x86/apic: add apic_irqs bitmap to identify irqs from apic
  2014-04-21  1:18 [RFC PATCH 0/1] add apic_irqs bitmap to identify irqs from apic Jason Chen
@ 2014-04-21  1:18 ` Jason Chen
  2014-04-24  7:22   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Chen @ 2014-04-21  1:18 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86; +Cc: linux-kernel, Jason Chen

The function irq_force_complete_move() might handle irqs based on
the non-apic irq_chip the way apic does, which has the structure
irq_cfg as its chip_data.
Wrong operations on non-apic irq_chip might make its chip_data changed
and bring unexpected issues.
Add apic_irqs bitmap to identify irqs from apic, and filter out all other
irq_chips by checking this bitmap.

Signed-off-by: Jason Chen <jason.cj.chen@intel.com>
---
 arch/x86/kernel/apic/io_apic.c | 21 ++++++++++++++++++++-
 include/linux/irqdesc.h        |  6 ++++++
 kernel/irq/internals.h         |  6 ------
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 6ad4658..1e2bcb5 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -37,6 +37,7 @@
 #include <linux/kthread.h>
 #include <linux/jiffies.h>	/* time_after() */
 #include <linux/slab.h>
+#include <linux/irqdesc.h>
 #include <linux/bootmem.h>
 #include <linux/dmar.h>
 #include <linux/hpet.h>
@@ -74,6 +75,8 @@ int sis_apic_bug = -1;
 static DEFINE_RAW_SPINLOCK(ioapic_lock);
 static DEFINE_RAW_SPINLOCK(vector_lock);
 
+static DECLARE_BITMAP(apic_irqs, IRQ_BITMAP_BITS);
+
 static struct ioapic {
 	/*
 	 * # of IRQ routing registers
@@ -1158,6 +1161,10 @@ next:
 		err = 0;
 		break;
 	}
+
+	if (err == 0)
+		set_bit(irq, apic_irqs);
+
 	free_cpumask_var(tmp_mask);
 	return err;
 }
@@ -1185,6 +1192,7 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg)
 
 	cfg->vector = 0;
 	cpumask_clear(cfg->domain);
+	clear_bit(irq, apic_irqs);
 
 	if (likely(!cfg->move_in_progress))
 		return;
@@ -1213,6 +1221,9 @@ void __setup_vector_irq(int cpu)
 	raw_spin_lock(&vector_lock);
 	/* Mark the inuse vectors */
 	for_each_active_irq(irq) {
+		if (!test_bit(irq, apic_irqs))
+			continue;
+
 		cfg = irq_get_chip_data(irq);
 		if (!cfg)
 			continue;
@@ -2268,7 +2279,12 @@ static void irq_complete_move(struct irq_cfg *cfg)
 
 void irq_force_complete_move(int irq)
 {
-	struct irq_cfg *cfg = irq_get_chip_data(irq);
+	struct irq_cfg *cfg;
+
+	if (!test_bit(irq, apic_irqs))
+		return;
+
+	cfg = irq_get_chip_data(irq);
 
 	if (!cfg)
 		return;
@@ -2541,6 +2557,9 @@ static inline void init_IO_APIC_traps(void)
 	 * 0x80, because int 0x80 is hm, kind of importantish. ;)
 	 */
 	for_each_active_irq(irq) {
+		if (!test_bit(irq, apic_irqs))
+			continue;
+
 		cfg = irq_get_chip_data(irq);
 		if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
 			/*
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 26e2661..1b20979 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -1,6 +1,12 @@
 #ifndef _LINUX_IRQDESC_H
 #define _LINUX_IRQDESC_H
 
+#ifdef CONFIG_SPARSE_IRQ
+# define IRQ_BITMAP_BITS	(NR_IRQS + 8196)
+#else
+# define IRQ_BITMAP_BITS	NR_IRQS
+#endif
+
 /*
  * Core internal functions to deal with irq descriptors
  *
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index ddf1ffe..b2fb994 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -8,12 +8,6 @@
 #include <linux/irqdesc.h>
 #include <linux/kernel_stat.h>
 
-#ifdef CONFIG_SPARSE_IRQ
-# define IRQ_BITMAP_BITS	(NR_IRQS + 8196)
-#else
-# define IRQ_BITMAP_BITS	NR_IRQS
-#endif
-
 #define istate core_internal_state__do_not_mess_with_it
 
 extern bool noirqdebug;
-- 
1.8.1.2


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

* Re: [RFC PATCH 1/1] x86/apic: add apic_irqs bitmap to identify irqs from apic
  2014-04-21  1:18 ` [RFC PATCH 1/1] x86/apic: " Jason Chen
@ 2014-04-24  7:22   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2014-04-24  7:22 UTC (permalink / raw)
  To: Jason Chen; +Cc: tglx, mingo, hpa, x86, linux-kernel


* Jason Chen <jason.cj.chen@intel.com> wrote:

> The function irq_force_complete_move() might handle irqs based on
> the non-apic irq_chip the way apic does, which has the structure
> irq_cfg as its chip_data.
> Wrong operations on non-apic irq_chip might make its chip_data changed
> and bring unexpected issues.
> Add apic_irqs bitmap to identify irqs from apic, and filter out all other
> irq_chips by checking this bitmap.

Please update the changelog to describe the current behavior, and how 
it affects your platform. (I.e. how do users notice, if at all?)

Then describe why you think that behavior should be changed. ie: 
what's the reason for this patch.

Only then describe the details of the change itself.

Thanks,

	Ingo

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

end of thread, other threads:[~2014-04-24  7:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21  1:18 [RFC PATCH 0/1] add apic_irqs bitmap to identify irqs from apic Jason Chen
2014-04-21  1:18 ` [RFC PATCH 1/1] x86/apic: " Jason Chen
2014-04-24  7:22   ` Ingo Molnar

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.