linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <bp@alien8.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	torvalds@linux-foundation.org, bp@alien8.de, ryan@innosecc.com,
	tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/cpu] x86, cpu: Fix X86_FEATURE_NOPL
Date: Mon, 4 Oct 2010 20:36:15 GMT	[thread overview]
Message-ID: <tip-366d4a43b1a7a861c356a0e407c4f03f454d42ea@git.kernel.org> (raw)
In-Reply-To: <20101004073127.GA20305@liondog.tnic>

Commit-ID:  366d4a43b1a7a861c356a0e407c4f03f454d42ea
Gitweb:     http://git.kernel.org/tip/366d4a43b1a7a861c356a0e407c4f03f454d42ea
Author:     Borislav Petkov <bp@alien8.de>
AuthorDate: Mon, 4 Oct 2010 09:31:27 +0200
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 4 Oct 2010 11:22:24 -0700

x86, cpu: Fix X86_FEATURE_NOPL

ba0593bf553c450a03dbc5f8c1f0ff58b778a0c8 cleared the aforementioned
cpuid bit only on 32-bit due to various problems with Virtual PC. This
somehow got lost during the 32- + 64-bit merge so restore the feature
bit on 64-bit. For that, set it explicitly for non-constant arguments of
cpu_has(). Update comment for future reference.

Signed-off-by: Borislav Petkov <bp@alien8.de>
LKML-Reference: <20101004073127.GA20305@liondog.tnic>
Cc: Ryan O'Neill <ryan@innosecc.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/cpu/common.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index f2f9ac7..927e630 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -704,16 +704,21 @@ void __init early_cpu_init(void)
 }
 
 /*
- * The NOPL instruction is supposed to exist on all CPUs with
- * family >= 6; unfortunately, that's not true in practice because
- * of early VIA chips and (more importantly) broken virtualizers that
- * are not easy to detect.  In the latter case it doesn't even *fail*
- * reliably, so probing for it doesn't even work.  Disable it completely
+ * The NOPL instruction is supposed to exist on all CPUs of family >= 6;
+ * unfortunately, that's not true in practice because of early VIA
+ * chips and (more importantly) broken virtualizers that are not easy
+ * to detect. In the latter case it doesn't even *fail* reliably, so
+ * probing for it doesn't even work. Disable it completely on 32-bit
  * unless we can find a reliable way to detect all the broken cases.
+ * Enable it explicitly on 64-bit for non-constant inputs of cpu_has().
  */
 static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
 {
+#ifdef CONFIG_X86_32
 	clear_cpu_cap(c, X86_FEATURE_NOPL);
+#else
+	set_cpu_cap(c, X86_FEATURE_NOPL);
+#endif
 }
 
 static void __cpuinit generic_identify(struct cpuinfo_x86 *c)

  reply	other threads:[~2010-10-04 20:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-03  9:37 NOPL on 32-bit Borislav Petkov
2010-10-03 14:43 ` H. Peter Anvin
2010-10-03 15:22   ` [PATCH] x86, cpu: X86_FEATURE_NOPL should be disabled on 32-bit only Borislav Petkov
2010-10-03 18:19     ` H. Peter Anvin
2010-10-03 20:11       ` Borislav Petkov
2010-10-03 22:22         ` H. Peter Anvin
2010-10-04  7:31           ` [PATCH] x86, cpu: Fix X86_FEATURE_NOPL Borislav Petkov
2010-10-04 20:36             ` tip-bot for Borislav Petkov [this message]
2010-10-05  9:47               ` [tip:x86/cpu] " Borislav Petkov
2010-10-05 16:30                 ` H. Peter Anvin
2010-10-05 16:53                   ` Borislav Petkov
2010-10-04 20:47             ` [PATCH] " Linus Torvalds
2010-10-04 21:02               ` H. Peter Anvin
2010-10-04 21:12                 ` Linus Torvalds
2010-10-04 21:21                   ` H. Peter Anvin
2010-10-04 21:48                     ` Borislav Petkov
2010-10-04 21:50                       ` H. Peter Anvin
2010-10-04 21:53                       ` H. Peter Anvin
2010-10-05  6:19                         ` Borislav Petkov
2010-10-04 22:17                     ` Hugh Dickins
2010-10-04 22:19                       ` H. Peter Anvin

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=tip-366d4a43b1a7a861c356a0e407c4f03f454d42ea@git.kernel.org \
    --to=bp@alien8.de \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=ryan@innosecc.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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).