linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
	Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Joe Korty <joe.korty@ccur.com>
Subject: [patch 18/32] Fix misreporting of #cores as #hyperthreads for Q9550
Date: Fri, 20 Mar 2009 15:26:29 -0700	[thread overview]
Message-ID: <20090320222711.812245959@mini.kroah.org> (raw)
In-Reply-To: <20090320231037.GA2732@kroah.com>

[-- Attachment #1: fix-misreporting-of-cores-as-hyperthreads-for-q9550.patch --]
[-- Type: text/plain, Size: 4546 bytes --]

2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Joe Korty <joe.korty@ccur.com>

Fix misreporting of #cores for the Intel Quad Core Q9550.

For the Q9550, in x86_64 mode, /proc/cpuinfo mistakenly
reports the #cores present as the #hyperthreads present.
i386 mode was not examined but is assumed to have the
same problem.

A backport of the following three 2.6.29-rc1 patches
fixes the problem:
  066941bd4eeb159307a5d7d795100d0887c00442:
    [PATCH] x86: unmask CPUID levels on Intel CPUs
  99fb4d349db7e7dacb2099c5cc320a9e2d31c1ef:
    [PATCH] x86: unmask CPUID levels on Intel CPUs, fix
  bdf21a49bab28f0d9613e8d8724ef9c9168b61b9:
    [PATCH] x86: add MSR_IA32_MISC_ENABLE bits to <asm/msr-index.h>

>From the first patch: "If the CPUID limit bit in
MSR_IA32_MISC_ENABLE is set, clear it to make all CPUID
information available.  This is required for some features
to work, in particular XSAVE."

Originally-Developed-by: H. Peter Anvin <hpa@linux.intel.com>
Backported-by: Joe Korty <joe.korty@ccur.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/kernel/cpu/intel.c    |   13 +++++++++++++
 arch/x86/kernel/cpu/intel_64.c |   13 +++++++++++++
 include/asm-x86/msr-index.h    |   29 +++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)

--- a/arch/x86/kernel/cpu/intel_64.c
+++ b/arch/x86/kernel/cpu/intel_64.c
@@ -9,6 +9,19 @@
 
 static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
 {
+	/* Unmask CPUID levels if masked: */
+	if (c->x86 == 6 && c->x86_model >= 15) {
+		u64 misc_enable;
+
+		rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+
+		if (misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID) {
+			misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
+			wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+			c->cpuid_level = cpuid_eax(0);
+		}
+	}
+
 	if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
 	    (c->x86 == 0x6 && c->x86_model >= 0x0e))
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -32,6 +32,19 @@ struct movsl_mask movsl_mask __read_most
 
 static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
 {
+	/* Unmask CPUID levels if masked: */
+	if (c->x86 == 6 && c->x86_model >= 15) {
+		u64 misc_enable;
+
+		rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+
+		if (misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID) {
+			misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
+			wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+			c->cpuid_level = cpuid_eax(0);
+		}
+	}
+
 	/* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */
 	if (c->x86 == 15 && c->x86_cache_alignment == 64)
 		c->x86_cache_alignment = 128;
--- a/include/asm-x86/msr-index.h
+++ b/include/asm-x86/msr-index.h
@@ -196,6 +196,35 @@
 #define MSR_IA32_THERM_STATUS		0x0000019c
 #define MSR_IA32_MISC_ENABLE		0x000001a0
 
+/* MISC_ENABLE bits: architectural */
+#define MSR_IA32_MISC_ENABLE_FAST_STRING	(1ULL << 0)
+#define MSR_IA32_MISC_ENABLE_TCC		(1ULL << 1)
+#define MSR_IA32_MISC_ENABLE_EMON		(1ULL << 7)
+#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL	(1ULL << 11)
+#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL	(1ULL << 12)
+#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP	(1ULL << 16)
+#define MSR_IA32_MISC_ENABLE_MWAIT		(1ULL << 18)
+#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID	(1ULL << 22)
+#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE	(1ULL << 23)
+#define MSR_IA32_MISC_ENABLE_XD_DISABLE		(1ULL << 34)
+
+/* MISC_ENABLE bits: model-specific, meaning may vary from core to core */
+#define MSR_IA32_MISC_ENABLE_X87_COMPAT		(1ULL << 2)
+#define MSR_IA32_MISC_ENABLE_TM1		(1ULL << 3)
+#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE	(1ULL << 4)
+#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE	(1ULL << 6)
+#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK	(1ULL << 8)
+#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE	(1ULL << 9)
+#define MSR_IA32_MISC_ENABLE_FERR		(1ULL << 10)
+#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX	(1ULL << 10)
+#define MSR_IA32_MISC_ENABLE_TM2		(1ULL << 13)
+#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE	(1ULL << 19)
+#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK	(1ULL << 20)
+#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT	(1ULL << 24)
+#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE	(1ULL << 37)
+#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE	(1ULL << 38)
+#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE	(1ULL << 39)
+
 /* Intel Model 6 */
 #define MSR_P6_EVNTSEL0			0x00000186
 #define MSR_P6_EVNTSEL1			0x00000187



  parent reply	other threads:[~2009-03-20 23:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090320222611.872315885@mini.kroah.org>
2009-03-20 23:10 ` [patch 00/32] 2.6.27.21-stable review Greg KH
2009-03-20 22:26   ` [patch 01/32] [IA64] Build fix for __early_pfn_to_nid() undefined link error Greg KH
2009-03-20 22:26   ` [patch 02/32] Add -fwrapv to gcc CFLAGS Greg KH
2009-03-20 22:26   ` [patch 03/32] Move cc-option to below arch-specific setup Greg KH
2009-03-20 22:26   ` [patch 04/32] nfsd: nfsd should drop CAP_MKNOD for non-root Greg KH
2009-03-20 22:26   ` [patch 05/32] NFSD: provide encode routine for OP_OPENATTR Greg KH
2009-03-20 22:26   ` [patch 06/32] ALSA: Fix vunmap and free order in snd_free_sgbuf_pages() Greg KH
2009-03-20 22:26   ` [patch 07/32] ALSA: hda - Fix DMA mask for ATI controllers Greg KH
2009-03-20 22:26   ` [patch 08/32] ALSA: mixart, fix lock imbalance Greg KH
2009-03-20 22:26   ` [patch 09/32] ALSA: pcm_oss, fix locking typo Greg KH
2009-03-20 22:26   ` [patch 10/32] ata_piix: add workaround for Samsung DB-P70 Greg KH
2009-03-20 22:26   ` [patch 11/32] dm crypt: fix kcryptd_async_done parameter Greg KH
2009-03-20 22:26   ` [patch 12/32] dm ioctl: validate name length when renaming Greg KH
2009-03-20 22:26   ` [patch 13/32] dm io: respect BIO_MAX_PAGES limit Greg KH
2009-03-20 22:26   ` [patch 14/32] eventfd: remove fput() call from possible IRQ context Greg KH
2009-03-20 22:26   ` [patch 15/32] S390: __div64_31 broken for CONFIG_MARCH_G5 Greg KH
2009-03-20 22:26   ` [patch 16/32] thinkpad-acpi: fix module autoloading for older models Greg KH
2009-03-20 22:26   ` [patch 17/32] V4L/DVB (10218): cx23885: Fix Oops for mixed install of analog and digital only cards Greg KH
2009-03-20 22:26   ` Greg KH [this message]
2009-03-20 22:26   ` [patch 19/32] powerpc: Remove extra semicolon in fsl_soc.c Greg KH
2009-03-20 22:26   ` [patch 20/32] USB: EHCI: expedite unlinks when the root hub is suspended Greg KH
2009-03-20 22:26   ` [patch 21/32] USB: EHCI: Fix isochronous URB leak Greg KH
2009-03-20 22:26   ` [patch 22/32] USB: Add Vendor/Product ID for new CDMA U727 to option driver Greg KH
2009-03-20 22:26   ` [patch 23/32] USB: option.c: add ZTE 622 modem device Greg KH
2009-03-20 22:26   ` [patch 24/32] USB: Add device id for Option GTM380 to option driver Greg KH
2009-03-20 22:26   ` [patch 25/32] USB: Option: let cdc-acm handle Sony Ericsson F3507g / Dell 5530 Greg KH
2009-03-20 22:26   ` [patch 26/32] USB: serial: add FTDI USB/Serial converter devices Greg KH
2009-03-20 22:26   ` [patch 27/32] USB: serial: ftdi: enable UART detection on gnICE JTAG adaptors blacklist interface0 Greg KH
2009-03-20 22:26   ` [patch 28/32] USB: serial: new cp2101 device id Greg KH
2009-03-20 22:26   ` [patch 29/32] USB: storage: Unusual USB device Prolific 2507 variation added Greg KH
2009-03-20 22:26   ` [patch 30/32] USB: unusual_devs: Add support for GI 0431 SD-Card interface Greg KH
2009-03-20 22:26   ` [patch 31/32] USB: Updated unusual-devs entry for USB mass storage on Nokia 6233 Greg KH
2009-03-20 22:26   ` [patch 32/32] USB: usbfs: keep async URBs until the device file is closed Greg KH

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=20090320222711.812245959@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=eteo@redhat.com \
    --cc=hpa@linux.intel.com \
    --cc=jake@lwn.net \
    --cc=jmforbes@linuxtx.org \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mkrufky@linuxtv.org \
    --cc=rbranco@la.checkpoint.com \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /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).