public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]  pci: derive nearby CPUs from device's instead of bus' NUMA information
@ 2009-04-17 10:01 Andreas Herrmann
  2009-04-17 16:21 ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Herrmann @ 2009-04-17 10:01 UTC (permalink / raw)
  To: jbarnes; +Cc: Ingo Molnar, H. Peter Anvin, linux-kernel

In case of AMD CPU northbridge functions this NUMA information might
differ.

Here is an example from a 4-socket system.

Currently Linux shows

  root@hagen:/sys/devices/pci0000:00/0000:00:1a.4# cat numa_node
  0
  root@hagen:/sys/devices/pci0000:00/0000:00:1a.4# cat local_cpu*
  0-3
  00000000,0000000f

which is not correct for northbridge functions as the local CPUs
are those of the same socket.

With this patch and a quirk for AMD CPU NB functions Linux can
do better and correctly show

  root@hagen:/sys/devices/pci0000:00/0000:00:1a.4# cat numa_node
  2
  root@hagen:/sys/devices/pci0000:00/0000:00:1a.4# cat local_cpu*
  8-11
  00000000,00000f00

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 drivers/pci/pci-sysfs.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

The quirk for AMD CPU NB functions is contained in another patch
that I'll send to x86-maintainers for inclusion into tip tree.

Please apply.

Thanks,
Andreas

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index a7eb1b4..9360f3d 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -74,7 +74,11 @@ static ssize_t local_cpus_show(struct device *dev,
 	const struct cpumask *mask;
 	int len;
 
+#ifdef CONFIG_NUMA
+	mask = cpumask_of_node(dev_to_node(dev));
+#else
 	mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
+#endif
 	len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
 	buf[len++] = '\n';
 	buf[len] = '\0';
@@ -88,7 +92,11 @@ static ssize_t local_cpulist_show(struct device *dev,
 	const struct cpumask *mask;
 	int len;
 
+#ifdef CONFIG_NUMA
+	mask = cpumask_of_node(dev_to_node(dev));
+#else
 	mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
+#endif
 	len = cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
 	buf[len++] = '\n';
 	buf[len] = '\0';
-- 
1.6.2




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

end of thread, other threads:[~2009-06-09  5:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-17 10:01 [PATCH] pci: derive nearby CPUs from device's instead of bus' NUMA information Andreas Herrmann
2009-04-17 16:21 ` Ingo Molnar
2009-04-17 19:26   ` Yinghai Lu
2009-04-20  8:47     ` Andreas Herrmann
2009-04-20 20:03       ` Jesse Barnes
2009-05-07  8:51         ` Andreas Herrmann
2009-05-11 21:54           ` Jesse Barnes
2009-06-09  5:47             ` Andreas Herrmann
2009-04-20 21:23       ` Yinghai Lu
2009-04-21 18:05         ` Andreas Herrmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox