mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luming Yu <luming.yu@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: suresh.b.siddha@intel.com, venkatesh.pallipadi@intel.com
Subject: [RFC patch] disable the assumption of apic_is_clustered_box for cores  >= 6
Date: Tue, 30 Jun 2009 10:53:23 +0800	[thread overview]
Message-ID: <3877989d0906291953n599b7047x5fdf6033114e0eed@mail.gmail.com> (raw)

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

Hello,

We have to disable the assumption of apic_is_clustered_box that assumes high
4bits of 8 bit APIC ID was cluster id, which is just the function's guess.
On a normal 4-socket system with >6cores Processor and HT enabled, we hit the
limitation of the guess and failed. Have to disable the guess on any
cores > 6 system.

Without this patch, we can't use good TSC on any SMP system with 48+ logical CPU

**The patch is enclosed in text attachment*
**Using web client to send the patch* *
**below is for review, please apply attached  patch*/

Thanks,
Luming

 apic/apic.c |   15 ++++++++++++++-
 cpu/intel.c |    2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

--- linux-2.6.30-rc6/arch/x86/kernel/apic/apic.c.0	2009-06-29
19:54:15.000000000 -0600
+++ linux-2.6.30-rc6/arch/x86/kernel/apic/apic.c	2009-06-29
20:14:15.000000000 -0600
@@ -2119,6 +2119,16 @@
 #endif	/* CONFIG_PM */

 #ifdef CONFIG_X86_64
+extern int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c);
+
+__cpuinit int __detect_cores(void)
+{
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+		boot_cpu_data.x86_max_cores =
+			intel_num_cpu_cores(&boot_cpu_data);
+	return boot_cpu_data.x86_max_cores;
+}
+
 /*
  * apic_is_clustered_box() -- Check if we can expect good TSC
  *
@@ -2190,7 +2200,10 @@
 	 * May have to revisit this when multi-core + hyperthreaded CPUs come
 	 * out, but AFAIK this will work even for them.
 	 */
-	return (clusters > 2);
+	if (clusters > 2)
+		return (__detect_cores() >= 6) ? 0 : 1;
+	else
+		return 0;
 }
 #endif

--- linux-2.6.30-rc6/arch/x86/kernel/cpu/intel.c.0	2009-06-29
19:53:29.000000000 -0600
+++ linux-2.6.30-rc6/arch/x86/kernel/cpu/intel.c	2009-06-29
08:46:12.000000000 -0600
@@ -250,7 +250,7 @@
 /*
  * find out the number of processor cores on the die
  */
-static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
+int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
 {
 	unsigned int eax, ebx, ecx, edx;

[-- Attachment #2: 1.patch --]
[-- Type: application/octet-stream, Size: 1281 bytes --]

--- linux-2.6.30-rc6/arch/x86/kernel/apic/apic.c.0	2009-06-29 19:54:15.000000000 -0600
+++ linux-2.6.30-rc6/arch/x86/kernel/apic/apic.c	2009-06-29 20:14:15.000000000 -0600
@@ -2119,6 +2119,16 @@
 #endif	/* CONFIG_PM */
 
 #ifdef CONFIG_X86_64
+extern int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c);
+
+__cpuinit int __detect_cores(void)
+{
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+		boot_cpu_data.x86_max_cores = 
+			intel_num_cpu_cores(&boot_cpu_data);
+	return boot_cpu_data.x86_max_cores;
+}
+
 /*
  * apic_is_clustered_box() -- Check if we can expect good TSC
  *
@@ -2190,7 +2200,10 @@
 	 * May have to revisit this when multi-core + hyperthreaded CPUs come
 	 * out, but AFAIK this will work even for them.
 	 */
-	return (clusters > 2);
+	if (clusters > 2)
+		return (__detect_cores() >= 6) ? 0 : 1;
+	else
+		return 0;
 }
 #endif
 
--- linux-2.6.30-rc6/arch/x86/kernel/cpu/intel.c.0	2009-06-29 19:53:29.000000000 -0600
+++ linux-2.6.30-rc6/arch/x86/kernel/cpu/intel.c	2009-06-29 08:46:12.000000000 -0600
@@ -250,7 +250,7 @@
 /*
  * find out the number of processor cores on the die
  */
-static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
+int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
 {
 	unsigned int eax, ebx, ecx, edx;
 

             reply	other threads:[~2009-06-30  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30  2:53 Luming Yu [this message]
2009-07-02 19:04 ` Suresh Siddha
2009-07-03  2:36   ` Luming Yu

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=3877989d0906291953n599b7047x5fdf6033114e0eed@mail.gmail.com \
    --to=luming.yu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suresh.b.siddha@intel.com \
    --cc=venkatesh.pallipadi@intel.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®