Re: [PATCH] More PCI fixes for 2.6.10-rc2

From: Greg KH
Date: Tue Nov 30 2004 - 19:35:26 EST


ChangeSet 1.2223.2.3, 2004/11/29 11:12:54-08:00, ak@xxxxxxx

[PATCH] PCI: Add sysfs file to map PCI busses to cpus

Add sysfs file to map PCI busses to cpus

Export the information from pcibus_to_cpumask() to sysfs. This
is useful for some user space programs who want to optimize their IO
using O_DIRECT.

There was some indecision on whether it's more useful to report
cpus or nodes here. In the end cpus was chosen because that is
what the existing macros report.

Signed-off-by: Andi Kleen <ak@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/pci/pci-sysfs.c | 11 +++++++++++
1 files changed, 11 insertions(+)


diff -Nru a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
--- a/drivers/pci/pci-sysfs.c 2004-11-30 15:47:18 -08:00
+++ b/drivers/pci/pci-sysfs.c 2004-11-30 15:47:18 -08:00
@@ -19,6 +19,7 @@
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/stat.h>
+#include <linux/topology.h>

#include "pci.h"

@@ -42,6 +43,15 @@
pci_config_attr(class, "0x%06x\n");
pci_config_attr(irq, "%u\n");

+static ssize_t local_cpus_show(struct device *dev, char *buf)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ cpumask_t mask = pcibus_to_cpumask(pdev->bus->number);
+ int len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
+ strcat(buf,"\n");
+ return 1+len;
+}
+
/* show resources */
static ssize_t
resource_show(struct device * dev, char * buf)
@@ -71,6 +81,7 @@
__ATTR_RO(subsystem_device),
__ATTR_RO(class),
__ATTR_RO(irq),
+ __ATTR_RO(local_cpus),
__ATTR_NULL,
};


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/