public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Borislav Petkov <bp@suse.de>, Gleb Natapov <gleb@redhat.com>
Subject: [PATCH 1/2] x86, CPU, AMD: Fix WC+ workaround for older hosts
Date: Tue, 19 Feb 2013 19:33:12 +0100	[thread overview]
Message-ID: <1361298793-31834-1-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <5123BBBC.2080008@zytor.com>

From: Borislav Petkov <bp@suse.de>

The WC+ workaround for F10h introduces a new MSR and kvm host #GPs
on accesses to unknown MSRs if paravirt is not compiled in. Use the
exception-handling MSR accessors so as not to break 3.8 and later guests
booting on older hosts.

Remove a redundant family check while at it.

Cc: Gleb Natapov <gleb@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: http://lkml.kernel.org/r/20130219153655.GD26748@pd.tnic
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/amd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 721ef3208eb5..163af4a91d09 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -723,12 +723,14 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 		 * performance degradation for certain nested-paging guests.
 		 * Prevent this conversion by clearing bit 24 in
 		 * MSR_AMD64_BU_CFG2.
+		 *
+		 * NOTE: we want to use the _safe accessors so as not to #GP kvm
+		 * guests on older kvm hosts.
 		 */
-		if (c->x86 == 0x10) {
-			rdmsrl(MSR_AMD64_BU_CFG2, value);
-			value &= ~(1ULL << 24);
-			wrmsrl(MSR_AMD64_BU_CFG2, value);
-		}
+
+		rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
+		value &= ~(1ULL << 24);
+		wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
 	}
 
 	rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
-- 
1.8.1.3.535.ga923c31


  reply	other threads:[~2013-02-19 18:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 15:25 [GIT PULL] x86/cpu changes for v3.9 Ingo Molnar
2013-02-19 15:36 ` Borislav Petkov
2013-02-19 15:47   ` Ingo Molnar
2013-02-19 17:38     ` H. Peter Anvin
2013-02-19 17:47       ` Borislav Petkov
2013-02-19 17:51         ` H. Peter Anvin
2013-02-19 18:33           ` Borislav Petkov [this message]
2013-02-19 18:33             ` [PATCH 2/2] x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs Borislav Petkov
2013-02-19 19:30               ` [tip:x86/cpu] " tip-bot for Borislav Petkov
2013-02-19 19:29             ` [tip:x86/cpu] x86, cpu, amd: Fix WC+ workaround for older virtual hosts tip-bot for Borislav Petkov
2013-02-19 17:57         ` [GIT PULL] x86/cpu changes for v3.9 Konrad Rzeszutek Wilk
2013-02-19 18:01           ` Borislav Petkov
2013-02-19 18:19           ` Boris Ostrovsky
2013-02-19 18:21             ` H. Peter Anvin
2013-02-19 18:26               ` Boris Ostrovsky

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=1361298793-31834-1-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=akpm@linux-foundation.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@suse.de \
    --cc=gleb@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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