From: James Cleverdon <jamesclv@us.ibm.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
"Martin J. Bligh" <mbligh@aracnet.com>
Cc: John Stultz <johnstul@us.ibm.com>, Chris McDermott <lcm@us.ibm.com>
Subject: [PATCH] 2.6.0-test9-mm2: cpu_sibling_map fix
Date: Tue, 11 Nov 2003 17:19:21 -0800 [thread overview]
Message-ID: <200311111719.23690.jamesclv@us.ibm.com> (raw)
On summit-based machines the cpu_sibling_map data has been hosed for some
time. I found out why in Intel's IA-32 Software Deveveopers' Manual Vol 2
under CPUID. Looks like the value that cpuid returns is the one latched at
reset, and doesn't reflect any changes made by the BIOS later:
* Local APIC ID (high byte of EBX)--this number is the 8-bit ID that is
assigned to the local APIC on the processor during power up. This field
was introduced in the Pentium 4 processor.
Also, the code in init_intel was a bit overdesigned. Until Intel releases a
chip with a non-power-of-2 sibling count on it, there's no point in all that
bit bashing.
diff -pru 2.6.0-test9-mm2/arch/i386/kernel/cpu/intel.c
q9m2/arch/i386/kernel/cpu/intel.c
--- 2.6.0-test9-mm2/arch/i386/kernel/cpu/intel.c 2003-11-11 11:38:01.000000000
-0800
+++ q9m2/arch/i386/kernel/cpu/intel.c 2003-11-11 16:16:56.000000000 -0800
@@ -276,8 +276,6 @@ static void __init init_intel(struct cpu
extern int phys_proc_id[NR_CPUS];
u32 eax, ebx, ecx, edx;
- int index_lsb, index_msb, tmp;
- int initial_apic_id;
int cpu = smp_processor_id();
cpuid(1, &eax, &ebx, &ecx, &edx);
@@ -286,8 +284,6 @@ static void __init init_intel(struct cpu
if (smp_num_siblings == 1) {
printk(KERN_INFO "CPU: Hyper-Threading is disabled\n");
} else if (smp_num_siblings > 1 ) {
- index_lsb = 0;
- index_msb = 31;
/*
* At this point we only support two siblings per
* processor package.
@@ -298,20 +294,13 @@ static void __init init_intel(struct cpu
smp_num_siblings = 1;
goto too_many_siblings;
}
- tmp = smp_num_siblings;
- while ((tmp & 1) == 0) {
- tmp >>=1 ;
- index_lsb++;
- }
- tmp = smp_num_siblings;
- while ((tmp & 0x80000000 ) == 0) {
- tmp <<=1 ;
- index_msb--;
- }
- if (index_lsb != index_msb )
- index_msb++;
- initial_apic_id = ebx >> 24 & 0xff;
- phys_proc_id[cpu] = initial_apic_id >> index_msb;
+ /* cpuid returns the value latched in the HW at reset,
+ * not the APIC ID register's value. For any box
+ * whose BIOS changes APIC IDs, like clustered APIC
+ * systems, we must use hard_smp_processor_id.
+ * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
+ */
+ phys_proc_id[cpu] = hard_smp_processor_id() & ~(smp_num_siblings - 1);
printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
phys_proc_id[cpu]);
reply other threads:[~2003-11-12 1:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200311111719.23690.jamesclv@us.ibm.com \
--to=jamesclv@us.ibm.com \
--cc=akpm@osdl.org \
--cc=johnstul@us.ibm.com \
--cc=lcm@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.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;
as well as URLs for NNTP newsgroup(s).