mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yinghai.lu@amd.com>
To: "Andi Kleen" <ak@muc.de>
Cc: "linux kernel mailing list" <linux-kernel@vger.kernel.org>,
	yhlu.kernel@gmail.com
Subject: Re: [PATCH] x86_64: store Socket ID in phys_proc_id
Date: Tue, 17 Oct 2006 08:34:47 -0700	[thread overview]
Message-ID: <86802c440610170834q5921908u5bcd7c2cb4b78dd5@mail.gmail.com> (raw)
In-Reply-To: <5986589C150B2F49A46483AC44C7BCA412D6E3@ssvlexmb2.amd.com>

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

Current code store phys_proc_id with init APIC ID, and later will change
to apicid>>bits.

So for the apic id lifted system, for example BSP with apicid 0x10, the
phys_proc_id will be 8.

This patch use initial APIC ID to get Socket ID.

It also removed ht_nodeid calculating, because We already have correct
socket id for sure.

Signed-off-by: Yinghai Lu <yinghai.lu@amd.com>

[-- Attachment #2: setup_c.diff --]
[-- Type: text/x-patch, Size: 2199 bytes --]

diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index fc944b5..d30f78a 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -643,34 +643,20 @@ #endif
 
 	/* Low order bits define the core id (index of core in socket) */
 	c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1);
-	/* Convert the APIC ID into the socket ID */
-	c->phys_proc_id = phys_pkg_id(bits);
+	/* Convert the initial APIC ID into the socket ID */
+	c->phys_proc_id >>= bits; 
 
 #ifdef CONFIG_NUMA
   	node = c->phys_proc_id;
  	if (apicid_to_node[apicid] != NUMA_NO_NODE)
  		node = apicid_to_node[apicid];
  	if (!node_online(node)) {
- 		/* Two possibilities here:
- 		   - The CPU is missing memory and no node was created.
- 		   In that case try picking one from a nearby CPU
- 		   - The APIC IDs differ from the HyperTransport node IDs
- 		   which the K8 northbridge parsing fills in.
- 		   Assume they are all increased by a constant offset,
- 		   but in the same order as the HT nodeids.
- 		   If that doesn't result in a usable node fall back to the
- 		   path for the previous case.  */
- 		int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits);
- 		if (ht_nodeid >= 0 &&
- 		    apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
- 			node = apicid_to_node[ht_nodeid];
  		/* Pick a nearby node */
- 		if (!node_online(node))
- 			node = nearby_node(apicid);
+		node = nearby_node(apicid);
  	}
 	numa_set_node(cpu, node);
 
-	printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
+	printk(KERN_INFO "CPU %d/0x%02x -> Node %d\n", cpu, apicid, node);
 #endif
 #endif
 }
@@ -928,7 +914,7 @@ void __cpuinit early_identify_cpu(struct
 	}
 
 #ifdef CONFIG_SMP
-	c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
+	c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; /* initial APIC ID */
 #endif
 }
 
@@ -1136,6 +1122,7 @@ #endif
 #ifdef CONFIG_SMP
 	if (smp_num_siblings * c->x86_max_cores > 1) {
 		int cpu = c - cpu_data;
+		seq_printf(m, "apic id\t\t: 0x%02x\n", x86_cpu_to_apicid[cpu]);
 		seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
 		seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu]));
 		seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);

  reply	other threads:[~2006-10-17 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-16 18:52 Lu, Yinghai
2006-10-17 15:34 ` Yinghai Lu [this message]
2006-10-17 17:53   ` Andi Kleen
2006-10-17 18:26 Lu, Yinghai
2006-10-17 20:58 ` Andi Kleen
2006-10-17 21:15 Lu, Yinghai
2006-10-18 13:04 ` Andi Kleen
2006-10-18 17:15 Lu, Yinghai

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=86802c440610170834q5921908u5bcd7c2cb4b78dd5@mail.gmail.com \
    --to=yinghai.lu@amd.com \
    --cc=ak@muc.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yhlu.kernel@gmail.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®