public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@sgi.com>
To: linux-kernel@vger.kernel.org, greg@kroah.com
Subject: Re: Exporting physical topology information
Date: Fri, 19 Mar 2004 10:53:38 -0800	[thread overview]
Message-ID: <200403191053.38131.jbarnes@sgi.com> (raw)
In-Reply-To: <20040319175957.GB10432@kroah.com>

On Friday 19 March 2004 9:59 am, Greg KH wrote:
> Hm, that looks to violate the "one value per file" mandate of sysfs,
> right?  Right now PCI Hotplug slots have a LED on them that you can

Yeah... my original patch to implement node physids used the Altix
module id, which looks like rrrtss, where rrr is a rack id, t is a
brick type, and ss is the rack slot, e.g. 001c12, so it was one value.
The example above was just brainstorming, I'm sure there are better
ways to do it.

> flash from userspace to help locate the physical slot that you want to
> change.  I also know of large PCI drawers that have LEDs that flash to
> locate them.

Yeah, that makes things easy, but it would be nice to cover CPUs and
memory banks too, so you can go remove the DIMM with a persistent
single or double bit error, or a CPU with a bad cache or whatever.  I
imagine some hardware has blinking lights for that too.

> Also, this is _very_ hardware/platform specific.  If you want to try to
> implement this, I'd be interested in what the patch would look like.

Here's the (very platform specific) patch I did for Altix, just to see
what it would look like, and to solicit comments.  There's some other
per-node stuff that would be nice to have available to userspace too,
mostly for administrative purposes, like the chipset revision and
type, firmware revision, and other hardware specific details.  One way
to export that sort of thing is with some sort of arbitrary data blob,
but like you said, that violates the sysfs one file, one value
principle.

Thanks,
Jesse


===== arch/ia64/mm/numa.c 1.6 vs edited =====
--- 1.6/arch/ia64/mm/numa.c	Sun Jan 11 22:54:38 2004
+++ edited/arch/ia64/mm/numa.c	Fri Jan 23 11:56:48 2004
@@ -20,6 +20,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 memblk *sysfs_memblks;
 static struct node *sysfs_nodes;
@@ -50,6 +52,13 @@
 			break;
 
 	return (i < num_memblks) ? node_memblk[i].nid : (num_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.16 vs edited =====
--- 1.16/drivers/base/node.c	Mon Dec 29 13:37:47 2003
+++ edited/drivers/base/node.c	Fri Jan 23 12:25:44 2004
@@ -56,6 +56,17 @@
 static SYSDEV_ATTR(meminfo,S_IRUGO,node_read_meminfo,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.
@@ -67,6 +78,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 = sys_device_register(&node->sysdev);
@@ -74,6 +86,7 @@
 	if (!error){
 		sysdev_create_file(&node->sysdev, &attr_cpumap);
 		sysdev_create_file(&node->sysdev, &attr_meminfo);
+		sysdev_create_file(&node->sysdev, &attr_physid);
 	}
 	return error;
 }
===== include/asm-ia64/topology.h 1.9 vs edited =====
--- 1.9/include/asm-ia64/topology.h	Wed Jun 18 18:38:50 2003
+++ edited/include/asm-ia64/topology.h	Fri Jan 23 11:40:51 2004
@@ -60,6 +60,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.10 vs edited =====
--- 1.10/include/asm-ia64/sn/module.h	Sun Jan 18 22:36:15 2004
+++ edited/include/asm-ia64/sn/module.h	Fri Jan 23 11:38:34 2004
@@ -14,6 +14,7 @@
 
 
 #include <linux/config.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	Mon Aug 18 19:46:23 2003
+++ edited/include/linux/node.h	Fri Jan 23 11:32:44 2004
@@ -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-03-19 18:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-17 21:37 Exporting physical topology information Martin Hicks
2004-03-18 17:44 ` Jesse Barnes
2004-03-18 23:21 ` Greg KH
2004-03-19 17:48   ` Martin Hicks
2004-03-19 17:57     ` Greg KH
2004-03-19 17:51   ` Jesse Barnes
2004-03-19 17:59     ` Greg KH
2004-03-19 18:53       ` Jesse Barnes [this message]
2004-05-07 20:13         ` Jesse Barnes
2004-05-07 22:38           ` Greg KH

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=200403191053.38131.jbarnes@sgi.com \
    --to=jbarnes@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