From: "Joachim Deguara" <joachim.deguara@amd.com>
To: "lkml List" <linux-kernel@vger.kernel.org>
Cc: gregkh@suse.de, "Andreas Kleen" <ak@suse.de>,
lenb@kernel.org, "Christoph Lameter" <clameter@sgi.com>
Subject: [PATCH 2/2] make node distance writeable
Date: Wed, 18 Jul 2007 11:31:27 +0200 [thread overview]
Message-ID: <200707181131.27718.joachim.deguara@amd.com> (raw)
In-Reply-To: <200707181130.01861.joachim.deguara@amd.com>
This adds the ability to write the node distance for NUMA systems. This is
generally handled by the SLIT but unfortunately the large majority of systems
do not have a SLIT as Windows does not use them. Until now if no SLIT was
found all remote nodes had a distance of 20 which is ok for 2P systems but
wrong for 4P and larger.
Signed-off-by: Joachim Deguara <joachim.deguara@amd.com>
--
Index: kernel/drivers/base/node.c
===================================================================
--- kernel.orig/drivers/base/node.c
+++ kernel/drivers/base/node.c
@@ -129,7 +129,30 @@ static ssize_t node_read_distance(struct
len += sprintf(buf + len, "\n");
return len;
}
-static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
+
+//takes a space seperated string as the distances of online nodes
+static ssize_t node_write_distance(struct sys_device * dev, const char * buf,
+ size_t size){
+ int i, ret;
+ u8 dist;
+
+ for_each_online_node(i){
+ if (i){
+ buf = strchr(buf, ' ');
+ buf++;
+ }
+ ret = sscanf(buf, "%hu", &dist);
+ if (!ret)
+ return -EINVAL;
+ if (dist < 10)
+ dist = 10;
+ set_node_distance(dev->id, i, dist);
+ }
+ return size;
+}
+
+static SYSDEV_ATTR(distance, S_IRUGO | S_IWUSR, node_read_distance,
+ node_write_distance);
/*
Index: kernel/arch/x86_64/mm/srat.c
===================================================================
--- kernel.orig/arch/x86_64/mm/srat.c
+++ kernel/arch/x86_64/mm/srat.c
@@ -471,6 +471,18 @@ int __node_distance(int a, int b)
EXPORT_SYMBOL(__node_distance);
+void __set_node_distance(int a, int b, u8 dist)
+{
+ int index;
+
+ if (!acpi_slit)
+ return;
+ index = acpi_slit->locality_count * node_to_pxm(a);
+ acpi_slit->entry[index + node_to_pxm(b)] = dist;
+}
+
+EXPORT_SYMBOL(__set_node_distance);
+
int memory_add_physaddr_to_nid(u64 start)
{
int i, ret = 0;
Index: kernel/include/asm-x86_64/topology.h
===================================================================
--- kernel.orig/include/asm-x86_64/topology.h
+++ kernel/include/asm-x86_64/topology.h
@@ -14,7 +14,9 @@ extern cpumask_t node_to_cpumask[];
#ifdef CONFIG_ACPI_NUMA
extern int __node_distance(int, int);
+extern void __set_node_distance(int, int, u8);
#define node_distance(a,b) __node_distance(a,b)
+#define set_node_distance(a,b,dist) __set_node_distance(a,b,dist)
/* #else fallback version */
#endif
next prev parent reply other threads:[~2007-07-18 9:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-18 9:30 [PATCH 0/2] faking and fixing the NUMA SLIT Joachim Deguara
2007-07-18 9:30 ` [PATCH 1/2] fake " Joachim Deguara
2007-07-18 9:31 ` Joachim Deguara [this message]
2007-07-18 9:42 ` [PATCH 0/2] faking and fixing " Andi Kleen
2007-07-18 9:57 ` Joachim Deguara
2007-07-23 20:25 ` Christoph Lameter
2007-07-23 22:10 ` Len Brown
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=200707181131.27718.joachim.deguara@amd.com \
--to=joachim.deguara@amd.com \
--cc=ak@suse.de \
--cc=clameter@sgi.com \
--cc=gregkh@suse.de \
--cc=lenb@kernel.org \
--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®