LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yinghai Lu <Yinghai.Lu@Sun.COM>
To: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kiran@scalemp.com, shai@scalemp.com
Subject: Re: [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box v2
Date: Sun, 24 Feb 2008 18:32:37 -0800	[thread overview]
Message-ID: <200802241832.37850.yinghai.lu@sun.com> (raw)
In-Reply-To: <200802241500.52860.yinghai.lu@sun.com>

please check the fix for v2.

this one can be applied to x86.git#testing

YH

---
[PATCH] x86_64: apic_is_clustered_box fix for vsmp

quad core 8 socket system will have apic id lifting.the apic id range could
be [4, 0x23]. and apic_is_clustered_box will think that need to three clusters
and that is large than 2. So it is treated as clustered_box.

and will get

Marking TSC unstable due to TSCs unsynchronized

even the CPUs have X86_FEATURE_CONSTANT_TSC set.

v2 patch will check if the cpu is from AMD.

vsmp still need that checking...

this patch is fix for vsmp

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

diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 8f6c45e..8a47579 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1206,9 +1206,9 @@ __cpuinit int apic_is_clustered_box(void)
 	 * there is not this kind of box with AMD CPU yet.
 	 * Some AMD box with quadcore cpu and 8 sockets apicid
 	 * will be [4, 0x23] or [8, 0x27] could be thought to
-	 * have three apic_clusters. So go out early.
+	 * vsmp box still need checking...
 	 */
-	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
+	if (!is_vsmp_box() && (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
 		return 0;
 
 	bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 54202b1..09e16ff 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -72,19 +72,34 @@ static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
 
 }
 
+static int vsmp = -1;
+
+int is_vsmp_box(void)
+{
+	if (vsmp != -1)
+		return vsmp;
+
+	vsmp = 0;
+	if (!early_pci_allowed())
+		return vsmp;
+
+	/* Check if we are running on a ScaleMP vSMP box */
+	if (read_pci_config(0, 0x1f, 0, PCI_VENDOR_ID) ==
+	     (PCI_VENDOR_ID_SCALEMP || (PCI_DEVICE_ID_SCALEMP_VSMP_CTL << 16)))
+		vsmp = 1;
+
+	return vsmp;
+}
+
 void __init vsmp_init(void)
 {
 	void *address;
 	unsigned int cap, ctl, cfg;
 
-	if (!early_pci_allowed())
+	if (!vsmp)
 		return;
 
-	/* Check if we are running on a ScaleMP vSMP box */
-	if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) !=
-	     PCI_VENDOR_ID_SCALEMP) ||
-	    (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) !=
-	     PCI_DEVICE_ID_SCALEMP_VSMP_CTL))
+	if (!early_pci_allowed())
 		return;
 
 	/* If we are, use the distinguished irq functions */
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index a68dc6b..24f7a05 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -51,12 +51,17 @@ extern unsigned boot_cpu_id;
  */
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
+extern int is_vsmp_box(void);
 #else
 #define apic_write native_apic_write
 #define apic_write_atomic native_apic_write_atomic
 #define apic_read native_apic_read
 #define setup_boot_clock setup_boot_APIC_clock
 #define setup_secondary_clock setup_secondary_APIC_clock
+int inline is_vsmp_box(void)
+{
+	return 0;
+}
 #endif
 
 static inline void native_apic_write(unsigned long reg, u32 v)

  parent reply	other threads:[~2008-02-25  2:24 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-21 10:58 [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box Yinghai Lu
2008-02-22 12:25 ` Andi Kleen
2008-02-22 19:02   ` Yinghai Lu
2008-02-22 19:00     ` Andi Kleen
2008-02-22 19:04       ` Yinghai Lu
2008-02-22 19:07         ` Andi Kleen
2008-02-22 19:07           ` Yinghai Lu
2008-02-22 19:10             ` Andi Kleen
2008-02-23  8:55               ` Yinghai Lu
2008-02-24  5:48       ` [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box v2 Yinghai Lu
2008-02-24  7:50         ` Ingo Molnar
2008-02-24 12:29         ` Andi Kleen
2008-02-24 23:00           ` Yinghai Lu
2008-02-25  1:52             ` Yinghai Lu
2008-02-25  2:32             ` Yinghai Lu [this message]
2008-02-25  5:36               ` [PATCH] x86_64: for apic_is_clustered_box for vsmp v2 Yinghai Lu
2008-02-25  6:43                 ` [PATCH] x86: vSMP selection in config Yinghai Lu
2008-02-26 19:40                   ` Kconfig configuration restore bug [Was: x86: vSMP selection in config] Sam Ravnborg
2008-02-27  2:59                     ` Roman Zippel
2008-02-29  4:09                     ` [PATCH 1/3] fix recursive dependencies Roman Zippel
2008-02-29  5:05                       ` Yinghai Lu
2008-02-29 13:22                         ` Roman Zippel
2008-02-29 17:40                           ` Sam Ravnborg
2008-02-29 20:05                             ` Ingo Molnar
2008-02-29 20:04                       ` Ingo Molnar
2008-02-29  4:10                     ` [PATCH 2/3] fix choice dependency check Roman Zippel
2008-04-28 21:08                       ` Sam Ravnborg
2008-02-29  4:11                     ` [PATCH 3/3] add named choice group Roman Zippel
2008-02-26 20:05                   ` [PATCH] x86: vSMP selection in config Sam Ravnborg
2008-02-26 21:03                     ` Yinghai Lu
2008-02-25  5:39           ` [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box v2 Yinghai Lu
2008-02-25 19:08           ` Ravikiran Thirumalai
2008-02-25 22:05             ` Yinghai Lu
2008-02-26  3:39               ` Ravikiran Thirumalai
2008-02-26  3:46                 ` Andi Kleen
2008-02-26  4:05                   ` Ravikiran Thirumalai
2008-02-26  5:27                     ` Yinghai Lu
2008-02-26 18:42                       ` Ravikiran Thirumalai
2008-02-26 19:00                         ` Yinghai Lu
2008-02-26 20:32                           ` Ravikiran Thirumalai
2008-02-26 21:09                             ` Yinghai Lu
2008-02-26 21:10                             ` Yinghai Lu
2008-02-26 21:24                               ` Ravikiran Thirumalai
2008-02-26 23:16                                 ` Yinghai Lu
2008-02-26 23:31                                   ` Ravikiran Thirumalai
2008-02-26 23:41                                     ` Yinghai Lu
2008-02-22 19:08     ` [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box Yinghai Lu
2008-02-22 18:59       ` Andi Kleen

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=200802241832.37850.yinghai.lu@sun.com \
    --to=yinghai.lu@sun.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=kiran@scalemp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=shai@scalemp.com \
    --subject='Re: [PATCH] x86_64: make amd quad core 8 socket system not be clustered_box v2' \
    /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

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).