mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [RFC PATCH] drivers/base: use cpu->node_id for from_nid
Date: Thu, 30 Jul 2015 20:35:51 +0200	[thread overview]
Message-ID: <1438281351-56556-1-git-send-email-holzheu@linux.vnet.ibm.com> (raw)

Hello Greg,

Is it possible to use "from_nid = cpu->node_id"?

Background:

I am currently working on (fake) NUMA support for s390. At startup, for
"deconfigured" CPUs, we don't know to which nodes the CPUs belong. Therefore
we always return node 0 for cpu_to_node().

For each present CPU the register_cpu() function is called which sets an
initial NUMA node via cpu_to_node(), which is then first node 0 for
"deconfigured" CPUs on s390.

After we "configure" a CPU we know to which node it belongs. Then when setting
a CPU online, the following is done in cpu_subsys_online():

     from_nid = cpu_to_node(cpuid); -> we return node x
     cpu_up(cpuid);
     to_nid = cpu_to_node(cpuid);   -> we return node x
     if (from_nid != to_nid)        -> x != x -> false
           change_cpu_under_node(cpu, from_nid, to_nid);

The result is that each CPU that was deconfigured at boot time stays in
node 0 because cpu_to_node() returns the same node before and after
setting the CPU online.

Using "cpu->node_id" for "from_nid" instead of calling cpu_to_node()
would help in our case.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index f160ea4..2dd889c 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -47,7 +47,7 @@ static int __ref cpu_subsys_online(struct device *dev)
 	int from_nid, to_nid;
 	int ret;
 
-	from_nid = cpu_to_node(cpuid);
+	from_nid = cpu->node_id;
 	if (from_nid == NUMA_NO_NODE)
 		return -ENODEV;
 
-- 
2.3.8


             reply	other threads:[~2015-07-30 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 18:35 Michael Holzheu [this message]
2015-08-05 20:51 ` Greg Kroah-Hartman
2015-08-06  8:32   ` Michael Holzheu

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=1438281351-56556-1-git-send-email-holzheu@linux.vnet.ibm.com \
    --to=holzheu@linux.vnet.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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®