Re: [PATCH] KVM: x86 emulator: fix xchg instruction emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 14, 2010 at 01:15:09PM +0800, Wei Yongjun wrote:
> If the destination is a memory operand and the memory
> cannot map to a valid page, the xchg instruction emulation
> will fail. If so, we should emulate exchange as write
> to fix it.
> 
> Signed-off-by: Wei Yongjun <yjwei@xxxxxxxxxxxxxx>
Acked-by: Gleb Natapov <gleb@xxxxxxxxxx>

Without this patch locked instruction does not work on io regions.
They don't just fail, they stuck in endless loop.

> ---
>  arch/x86/kvm/x86.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index d94811e..ac63f6f 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3560,6 +3560,8 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
>  		goto emul_write;
>  
>  	page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT);
> +	if (is_error_page(page))
> +		goto emul_write;
>  
>  	kaddr = kmap_atomic(page, KM_USER0);
>  	kaddr += offset_in_page(gpa);
> -- 
> 1.7.0.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux