2007-01-31 15:00:23

by Avi Kivity

[permalink] [raw]
Subject: [PATCH] KVM: Fix lockup on 32-bit intel hosts with nx disabled in the bios

Intel hosts, without long mode, and with nx support disabled in the bios
have an efer that is readable but not writable. This causes a lockup on
switch to guest mode (even though it should exit with reason 34 according to
the documentation).

Signed-off-by: Avi Kivity <[email protected]>

Index: linux-2.6/drivers/kvm/vmx.c
===================================================================
--- linux-2.6.orig/drivers/kvm/vmx.c
+++ linux-2.6/drivers/kvm/vmx.c
@@ -1128,6 +1128,8 @@ static int vmx_vcpu_setup(struct kvm_vcp

if (rdmsr_safe(index, &data_low, &data_high) < 0)
continue;
+ if (wrmsr_safe(index, data_low, data_high) < 0)
+ continue;
data = data_low | ((u64)data_high << 32);
vcpu->host_msrs[j].index = index;
vcpu->host_msrs[j].reserved = 0;


2007-01-31 15:02:06

by Avi Kivity

[permalink] [raw]
Subject: Re: [PATCH] KVM: Fix lockup on 32-bit intel hosts with nx disabled in the bios

Avi Kivity wrote:
> Intel hosts, without long mode, and with nx support disabled in the bios
> have an efer that is readable but not writable. This causes a lockup on
> switch to guest mode (even though it should exit with reason 34 according to
> the documentation).
>
>

Andrew, I believe this is 2.6.20 material.

> Signed-off-by: Avi Kivity <[email protected]>
>
> Index: linux-2.6/drivers/kvm/vmx.c
> ===================================================================
> --- linux-2.6.orig/drivers/kvm/vmx.c
> +++ linux-2.6/drivers/kvm/vmx.c
> @@ -1128,6 +1128,8 @@ static int vmx_vcpu_setup(struct kvm_vcp
>
> if (rdmsr_safe(index, &data_low, &data_high) < 0)
> continue;
> + if (wrmsr_safe(index, data_low, data_high) < 0)
> + continue;
> data = data_low | ((u64)data_high << 32);
> vcpu->host_msrs[j].index = index;
> vcpu->host_msrs[j].reserved = 0;
>


--
error compiling committee.c: too many arguments to function

2007-02-01 02:52:47

by Jeff Chua

[permalink] [raw]
Subject: Re: [kvm-devel] [PATCH] KVM: Fix lockup on 32-bit intel hosts with nx disabled in the bios

On 1/31/07, Avi Kivity <[email protected]> wrote:
> Intel hosts, without long mode, and with nx support disabled in the bios
> have an efer that is readable but not writable. This causes a lockup on
> switch to guest mode (even though it should exit with reason 34 according to
> the documentation).

Avi, thank you for the patch. I can confirm that this patch works on
my IBM X60s notebook. Without it, the whole PC locks up upon starting
qemu.

Thanks,
Jeff.

2007-02-01 07:56:57

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] KVM: Fix lockup on 32-bit intel hosts with nx disabled in the bios


* Avi Kivity <[email protected]> wrote:

> Intel hosts, without long mode, and with nx support disabled in the
> bios have an efer that is readable but not writable. This causes a
> lockup on switch to guest mode (even though it should exit with reason
> 34 according to the documentation).
>
> Signed-off-by: Avi Kivity <[email protected]>

i think this is for v2.6.20. I have tested this ontop of -rc7.

Acked-by: Ingo Molnar <[email protected]>

Ingo