mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@engr.sgi.com>
To: linux-kernel@vger.kernel.org, greg@kroah.com
Subject: [PATCH] physid for nodes
Date: Mon, 26 Jul 2004 09:51:27 -0700	[thread overview]
Message-ID: <200407260951.27968.jbarnes@engr.sgi.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

Here's the node physid patch refreshed against the latest BK bits.  It works 
ok for nodes, but I'm wondering what to do about other devices.  Is there a 
structure that we could embed the physid string into that would apply to PCI 
devices, busses, CPUs, and memory?  Or should we just add the strings on a 
case-by-case basis?

The ia64 bits also need to be abstracted out...

Thanks,
Jesse

[-- Attachment #2: node-physid.patch --]
[-- Type: text/plain, Size: 2954 bytes --]

===== arch/ia64/mm/numa.c 1.7 vs edited =====
--- 1.7/arch/ia64/mm/numa.c	2004-02-03 21:35:17 -08:00
+++ edited/arch/ia64/mm/numa.c	2004-07-26 09:42:34 -07:00
@@ -19,6 +19,8 @@
 #include <linux/bootmem.h>
 #include <asm/mmzone.h>
 #include <asm/numa.h>
+#include <asm/sn/nodepda.h>
+#include <asm/sn/module.h>
 
 static struct node *sysfs_nodes;
 static struct cpu *sysfs_cpus;
@@ -48,6 +50,12 @@
 			break;
 
 	return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
+}
+
+void node_to_physid(int node, char *buf)
+{
+	struct nodepda_s *nodeinfo = NODEPDA(node);
+	format_module_id(buf, nodeinfo->module->id, MODULE_FORMAT_BRIEF);
 }
 
 static int __init topology_init(void)
===== drivers/base/node.c 1.22 vs edited =====
--- 1.22/drivers/base/node.c	2004-06-27 00:19:31 -07:00
+++ edited/drivers/base/node.c	2004-07-26 09:43:07 -07:00
@@ -101,6 +101,17 @@
 }
 static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
 
+static ssize_t node_read_physid(struct sys_device * dev, char * buf)
+{
+	struct node *node_dev = to_node(dev);
+	int len;
+
+	len = snprintf(buf, NODE_MAX_PHYSID + 1, "%s\n", node_dev->physid);
+	return len;
+}
+
+static SYSDEV_ATTR(physid,S_IRUGO,node_read_physid,NULL);
+
 /*
  * register_node - Setup a driverfs device for a node.
  * @num - Node number to use when creating the device.
@@ -112,6 +123,7 @@
 	int error;
 
 	node->cpumap = node_to_cpumask(num);
+	node_to_physid(num, node->physid);
 	node->sysdev.id = num;
 	node->sysdev.cls = &node_class;
 	error = sysdev_register(&node->sysdev);
@@ -120,6 +132,7 @@
 		sysdev_create_file(&node->sysdev, &attr_cpumap);
 		sysdev_create_file(&node->sysdev, &attr_meminfo);
 		sysdev_create_file(&node->sysdev, &attr_numastat);
+		sysdev_create_file(&node->sysdev, &attr_physid);
 	}
 	return error;
 }
===== include/asm-ia64/topology.h 1.10 vs edited =====
--- 1.10/include/asm-ia64/topology.h	2004-02-03 21:35:17 -08:00
+++ edited/include/asm-ia64/topology.h	2004-07-26 09:41:24 -07:00
@@ -45,6 +45,8 @@
 
 void build_cpu_to_node_map(void);
 
+extern void node_to_physid(int node, char *buf);
+
 #endif /* CONFIG_NUMA */
 
 #include <asm-generic/topology.h>
===== include/asm-ia64/sn/module.h 1.15 vs edited =====
--- 1.15/include/asm-ia64/sn/module.h	2004-06-07 08:45:42 -07:00
+++ edited/include/asm-ia64/sn/module.h	2004-07-26 09:43:29 -07:00
@@ -8,6 +8,7 @@
 #ifndef _ASM_IA64_SN_MODULE_H
 #define _ASM_IA64_SN_MODULE_H
 
+#include <asm/sn/sgi.h>
 #include <asm/sn/klconfig.h>
 #include <asm/sn/ksys/elsc.h>
 
===== include/linux/node.h 1.5 vs edited =====
--- 1.5/include/linux/node.h	2003-08-18 19:46:23 -07:00
+++ edited/include/linux/node.h	2004-07-26 09:41:26 -07:00
@@ -22,8 +22,11 @@
 #include <linux/sysdev.h>
 #include <linux/cpumask.h>
 
+#define NODE_MAX_PHYSID 80
+
 struct node {
 	cpumask_t cpumap;	/* Bitmap of CPUs on the Node */
+	char physid[NODE_MAX_PHYSID]; /* Physical ID of node */
 	struct sys_device	sysdev;
 };
 

                 reply	other threads:[~2004-07-26 18:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407260951.27968.jbarnes@engr.sgi.com \
    --to=jbarnes@engr.sgi.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®