From: tip-bot for Andreas Herrmann <herrmann.der.user@googlemail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
andreas.herrmann3@amd.com, herrmann.der.user@googlemail.com,
tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/urgent] x86, amd: Check X86_FEATURE_OSVW bit before accessing OSVW MSRs
Date: Thu, 13 May 2010 23:39:52 GMT [thread overview]
Message-ID: <tip-f01487119dda3d9f58c9729c7361ecc50a61c188@git.kernel.org> (raw)
In-Reply-To: <20100427101348.GC4489@alberich.amd.com>
Commit-ID: f01487119dda3d9f58c9729c7361ecc50a61c188
Gitweb: http://git.kernel.org/tip/f01487119dda3d9f58c9729c7361ecc50a61c188
Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
AuthorDate: Tue, 27 Apr 2010 12:13:48 +0200
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 13 May 2010 16:21:20 -0700
x86, amd: Check X86_FEATURE_OSVW bit before accessing OSVW MSRs
If host CPU is exposed to a guest the OSVW MSRs are not guaranteed
to be present and a GP fault occurs. Thus checking the feature flag is
essential.
Cc: <stable@kernel.org> # .32.x .33.x
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
LKML-Reference: <20100427101348.GC4489@alberich.amd.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
arch/x86/kernel/process.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 28ad9f4..0415c3e 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -546,11 +546,13 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
* check OSVW bit for CPUs that are not affected
* by erratum #400
*/
- rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
- if (val >= 2) {
- rdmsrl(MSR_AMD64_OSVW_STATUS, val);
- if (!(val & BIT(1)))
- goto no_c1e_idle;
+ if (cpu_has(c, X86_FEATURE_OSVW)) {
+ rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
+ if (val >= 2) {
+ rdmsrl(MSR_AMD64_OSVW_STATUS, val);
+ if (!(val & BIT(1)))
+ goto no_c1e_idle;
+ }
}
return 1;
}
prev parent reply other threads:[~2010-05-13 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-27 10:13 [PATCH] " Andreas Herrmann
2010-05-13 23:39 ` tip-bot for Andreas Herrmann [this message]
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-f01487119dda3d9f58c9729c7361ecc50a61c188@git.kernel.org \
--to=herrmann.der.user@googlemail.com \
--cc=andreas.herrmann3@amd.com \
--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=tglx@linutronix.de \
/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®