From: Gleb Natapov <gleb@redhat.com>
To: Wei Yongjun <yjwei@cn.fujitsu.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86 emulator: fix xchg instruction emulation
Date: Wed, 14 Jul 2010 11:35:35 +0300 [thread overview]
Message-ID: <20100714083535.GD4689@redhat.com> (raw)
In-Reply-To: <4C3D47DD.4010108@cn.fujitsu.com>
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@cn.fujitsu.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Gleb.
next prev parent reply other threads:[~2010-07-14 8:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 5:15 [PATCH] KVM: x86 emulator: fix xchg instruction emulation Wei Yongjun
2010-07-14 8:35 ` Gleb Natapov [this message]
2010-07-14 16:37 ` Marcelo Tosatti
2010-07-15 0:51 ` [PATCHv2] " Wei Yongjun
2010-07-16 2:05 ` Marcelo Tosatti
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=20100714083535.GD4689@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=yjwei@cn.fujitsu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.