All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zhong <zhong@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Li Zhong <zhong@linux.vnet.ibm.com>,
	Nishanth Aravamudan <nacc@linux.vnet.ibm.com>,
	paulus@samba.org, Nathan Fontenot <nfont@linux.vnet.ibm.com>
Subject: [RFC PATCH v3 2/3] powerpc: Only set numa node information for present cpus at boottime
Date: Wed, 27 Aug 2014 17:34:00 +0800	[thread overview]
Message-ID: <1409132041-11890-2-git-send-email-zhong@linux.vnet.ibm.com> (raw)
In-Reply-To: <1409132041-11890-1-git-send-email-zhong@linux.vnet.ibm.com>

As Nish suggested, it makes more sense to init the numa node informatiion
for present cpus at boottime, which could also avoid WARN_ON(1) in
numa_setup_cpu().

With this change, we also need to change the smp_prepare_cpus() to set up
numa information only on present cpus.

For those possible, but not present cpus, their numa information
will be set up after they are started, as the original code did before commit
2fabf084b6ad.

Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/smp.c | 10 ++++++++--
 arch/powerpc/mm/numa.c    |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index a0738af..dc0e774 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -379,8 +379,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 		/*
 		 * numa_node_id() works after this.
 		 */
-		set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
-		set_cpu_numa_mem(cpu, local_memory_node(numa_cpu_lookup_table[cpu]));
+		if (cpu_present(cpu)) {
+			set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
+			set_cpu_numa_mem(cpu,
+				local_memory_node(numa_cpu_lookup_table[cpu]));
+		}
 	}
 
 	cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
@@ -728,6 +731,9 @@ void start_secondary(void *unused)
 	}
 	traverse_core_siblings(cpu, true);
 
+	set_numa_node(numa_cpu_lookup_table[cpu]);
+	set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
+
 	smp_wmb();
 	notify_cpu_starting(cpu);
 	set_cpu_online(cpu, true);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 9918c02..3a9061e 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1127,7 +1127,7 @@ void __init do_init_bootmem(void)
 	 * even before we online them, so that we can use cpu_to_{node,mem}
 	 * early in boot, cf. smp_prepare_cpus().
 	 */
-	for_each_possible_cpu(cpu) {
+	for_each_present_cpu(cpu) {
 		numa_setup_cpu((unsigned long)cpu);
 	}
 }
-- 
1.9.1

  reply	other threads:[~2014-08-27  9:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27  9:33 [RFC PATCH v3 1/3] powerpc: Fix warning reported by verify_cpu_node_mapping() Li Zhong
2014-08-27  9:34 ` Li Zhong [this message]
2014-09-03  3:02   ` [RFC PATCH v3 2/3] powerpc: Only set numa node information for present cpus at boottime Nishanth Aravamudan
2014-09-04  3:53     ` Cyril Bur
2014-08-27  9:34 ` [RFC PATCH v3 3/3] powerpc: some changes in numa_setup_cpu() Li Zhong
2014-09-03  3:04   ` Nishanth Aravamudan
2014-09-03  3:01 ` [RFC PATCH v3 1/3] powerpc: Fix warning reported by verify_cpu_node_mapping() Nishanth Aravamudan
2014-10-02 21:13 ` Nishanth Aravamudan
2014-10-02 21:28   ` Benjamin Herrenschmidt
2014-10-02 21:53     ` Nishanth Aravamudan
2014-10-02 22:23       ` Benjamin Herrenschmidt
2014-10-03  0:50   ` Michael Ellerman
2014-10-03 23:26     ` Nishanth Aravamudan
2014-10-07  6:28       ` Michael Ellerman
2014-10-07 15:33         ` Nishanth Aravamudan
2014-10-08  4:51           ` Li Zhong
2014-10-14  2:39           ` Li Zhong
2014-10-14  4:35             ` Michael Ellerman
2014-10-15  7:34               ` Li Zhong

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=1409132041-11890-2-git-send-email-zhong@linux.vnet.ibm.com \
    --to=zhong@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nacc@linux.vnet.ibm.com \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.