Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1685566 > unrolled thread
| Started by | Mikulas Patocka <mpatocka@redhat.com> |
|---|---|
| First post | 2017-07-12 09:30 +0200 |
| Last post | 2017-07-13 08:40 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor Mikulas Patocka <mpatocka@redhat.com> - 2017-07-12 09:30 +0200
Re: [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor Borislav Petkov <bp@alien8.de> - 2017-07-12 15:50 +0200
Re: [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor Mikulas Patocka <mpatocka@redhat.com> - 2017-07-13 04:30 +0200
Re: [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor Borislav Petkov <bp@alien8.de> - 2017-07-13 08:40 +0200
| From | Mikulas Patocka <mpatocka@redhat.com> |
|---|---|
| Date | 2017-07-12 09:30 +0200 |
| Subject | [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor |
| Message-ID | <u2kfT-5aW-15@gated-at.bofh.it> |
When I start a virtual machine, kvm complains about accesses to an unknown
MSR ("vcpu0 unhandled rdmsr: 0xc001100d"). This is caused by the code in
init_amd_k8 that tries to work around a BIOS bug that incorrectly sets
lahf_lm.
This patch disables this workaround when running in a hypervisor.
Note that the processors for which this erratum applies do not support
virtualization at all, so if we are running in a hypervisor, we can be
sure that the workaronud doesn't apply.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
arch/x86/kernel/cpu/amd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: linux-2.6/arch/x86/kernel/cpu/amd.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd.c
+++ linux-2.6/arch/x86/kernel/cpu/amd.c
@@ -627,8 +627,12 @@ static void init_amd_k8(struct cpuinfo_x
* Some BIOSes incorrectly force this feature, but only K8 revision D
* (model = 0x14) and later actually support it.
* (AMD Erratum #110, docId: 25759).
+ *
+ * Don't apply this workaround in a virtual machine because kvm
+ * complains about reads from an unknown MSR.
*/
- if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM)) {
+ if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM) &&
+ !boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
clear_cpu_cap(c, X86_FEATURE_LAHF_LM);
if (!rdmsrl_amd_safe(0xc001100d, &value)) {
value &= ~BIT_64(32);
[toc] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2017-07-12 15:50 +0200 |
| Subject | Re: [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor |
| Message-ID | <u2qbD-pT-3@gated-at.bofh.it> |
| In reply to | #1685566 |
On Wed, Jul 12, 2017 at 03:19:56AM -0400, Mikulas Patocka wrote:
> When I start a virtual machine, kvm complains about accesses to an unknown
> MSR ("vcpu0 unhandled rdmsr: 0xc001100d"). This is caused by the code in
> init_amd_k8 that tries to work around a BIOS bug that incorrectly sets
> lahf_lm.
No need - there are a lot of qemu configurations which cause the
unhandled MSR warning so no need to pollute the kernel unnecessarily.
The warning is harmless at that.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
[toc] | [prev] | [next] | [standalone]
| From | Mikulas Patocka <mpatocka@redhat.com> |
|---|---|
| Date | 2017-07-13 04:30 +0200 |
| Subject | Re: [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor |
| Message-ID | <u2C37-84q-11@gated-at.bofh.it> |
| In reply to | #1685782 |
On Wed, 12 Jul 2017, Borislav Petkov wrote:
> On Wed, Jul 12, 2017 at 03:19:56AM -0400, Mikulas Patocka wrote:
> > When I start a virtual machine, kvm complains about accesses to an unknown
> > MSR ("vcpu0 unhandled rdmsr: 0xc001100d"). This is caused by the code in
> > init_amd_k8 that tries to work around a BIOS bug that incorrectly sets
> > lahf_lm.
>
> No need - there are a lot of qemu configurations which cause the
> unhandled MSR warning so no need to pollute the kernel unnecessarily.
> The warning is harmless at that.
It is not strictly needed, but it is annoying. I work in the console and
it is annoying to see these "unhandled rdmsr" messages printed over the
screen every time I reboot a virtual machine.
Or do you thnik that the code that prints this warning should be removed
from the kernel instead?
Mikulas
> --
> Regards/Gruss,
> Boris.
>
> ECO tip #101: Trim your mails when you reply.
> --
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2017-07-13 08:40 +0200 |
| Subject | Re: [PATCH] x86/kernel/cpu/amd.c: don't apply the lahf_lm workaround in a hypervisor |
| Message-ID | <u2FX4-240-9@gated-at.bofh.it> |
| In reply to | #1686189 |
On Wed, Jul 12, 2017 at 10:27:44PM -0400, Mikulas Patocka wrote:
> It is not strictly needed, but it is annoying. I work in the console and
> it is annoying to see these "unhandled rdmsr" messages printed over the
> screen every time I reboot a virtual machine.
Those messages are already pr_debug_ratelimited(). Fix your loglevel to
not see them.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web