lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49F777F8.7070102@kernel.org>
Date:	Tue, 28 Apr 2009 14:41:12 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	Suresh Siddha <suresh.b.siddha@...el.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] x86/irq: use move_irq_desc only when CONFIG_NUMA_IRQ_DESC
 is set


add config NUMA_IRQ_DESC, and create_irq_nr(), it will call move_irq_desc.

move_irq_desc will try to move irq_desc to node wanted if allocated one is not correct.
(happen on device on different nodes that are using MSI, driver are loaded and unloaded
randomly)

[ Impact: make irq_desc go with device on node ]

Signed-off-by: Yinghai Lu <yinghai@...nel.org>

---
 arch/x86/Kconfig               |    9 +++++++++
 arch/x86/kernel/apic/io_apic.c |   18 +++++++++++-------
 include/linux/irq.h            |   11 +++++++++--
 kernel/irq/Makefile            |    2 +-
 4 files changed, 30 insertions(+), 10 deletions(-)

Index: linux-2.6/arch/x86/Kconfig
===================================================================
--- linux-2.6.orig/arch/x86/Kconfig
+++ linux-2.6/arch/x86/Kconfig
@@ -280,6 +280,15 @@ config SPARSE_IRQ
 
 	  If you don't know what to do here, say N.
 
+config NUMA_IRQ_DESC
+       bool "put irq desc on numa node memory"
+       depends on SPARSE_IRQ && NUMA
+       default n
+       ---help---
+         This enables irq_desc to cpu/node that that device is connected.
+
+         If you don't know what to do here, say N.
+
 config X86_MPPARSE
 	bool "Enable MPS table" if ACPI
 	default y
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -246,7 +246,7 @@ int arch_init_chip_data(struct irq_desc
 	return 0;
 }
 
-/* for move_irq_desc */
+#ifdef CONFIG_NUMA_IRQ_DESC
 static void
 init_copy_irq_2_pin(struct irq_cfg *old_cfg, struct irq_cfg *cfg, int node)
 {
@@ -347,7 +347,7 @@ void arch_free_chip_data(struct irq_desc
 		old_desc->chip_data = NULL;
 	}
 }
-/* end for move_irq_desc */
+#endif
 
 #else
 static struct irq_cfg *irq_cfg(unsigned int irq)
@@ -3143,6 +3143,10 @@ unsigned int create_irq_nr(unsigned int
 	if (irq_want < nr_irqs_gsi)
 		irq_want = nr_irqs_gsi;
 
+#ifndef CONFIG_NUMA_IRQ_DESC
+	node = cpu_to_node(boot_cpu_id);
+#endif
+
 	spin_lock_irqsave(&vector_lock, flags);
 	for (new = irq_want; new < nr_irqs; new++) {
 		desc_new = irq_to_desc_alloc_node(new, node);
@@ -3155,11 +3159,7 @@ unsigned int create_irq_nr(unsigned int
 		if (cfg_new->vector != 0)
 			continue;
 
-#ifdef CONFIG_NUMA_IRQ_DESC
-		/* different node ?*/
-		if (desc_new->node != node)
-			desc = move_irq_desc(desc, node);
-#endif
+		desc_new = move_irq_desc(desc_new, node);
 
 		if (__assign_irq_vector(new, cfg_new, apic->target_cpus()) == 0)
 			irq = new;
@@ -3938,10 +3938,14 @@ int io_apic_set_pci_routing(struct devic
 		return -EINVAL;
 	}
 
+#ifdef CONFIG_NUMA_IRQ_DESC
 	if (dev)
 		node = dev_to_node(dev);
 	else
 		node = cpu_to_node(boot_cpu_id);
+#else
+	node = cpu_to_node(boot_cpu_id);
+#endif
 
 	desc = irq_to_desc_alloc_node(irq, node);
 	if (!desc) {
Index: linux-2.6/include/linux/irq.h
===================================================================
--- linux-2.6.orig/include/linux/irq.h
+++ linux-2.6/include/linux/irq.h
@@ -206,10 +206,17 @@ extern void arch_free_chip_data(struct i
 
 #ifndef CONFIG_SPARSE_IRQ
 extern struct irq_desc irq_desc[NR_IRQS];
-#else /* CONFIG_SPARSE_IRQ */
-extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int node);
 #endif /* CONFIG_SPARSE_IRQ */
 
+#ifdef CONFIG_NUMA_IRQ_DESC
+extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int node);
+#else
+static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
+{
+	return desc;
+}
+#endif
+
 extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
 
 /*
Index: linux-2.6/kernel/irq/Makefile
===================================================================
--- linux-2.6.orig/kernel/irq/Makefile
+++ linux-2.6/kernel/irq/Makefile
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o re
 obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o
-obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o
+obj-$(CONFIG_NUMA_IRQ_DESC) += numa_migrate.o
 obj-$(CONFIG_PM_SLEEP) += pm.o
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ