public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCH] get rid of mmu_only parameter in emulator_write_emulated()
Date: Tue, 13 Apr 2010 10:40:59 +0300	[thread overview]
Message-ID: <20100413074059.GH23554@redhat.com> (raw)
In-Reply-To: <4BC41ED9.1000506@redhat.com>

On Tue, Apr 13, 2010 at 10:35:53AM +0300, Avi Kivity wrote:
> On 04/13/2010 10:26 AM, Gleb Natapov wrote:
> >On Tue, Apr 13, 2010 at 10:24:40AM +0300, Avi Kivity wrote:
> >>On 04/13/2010 10:21 AM, Gleb Natapov wrote:
> >>>May be I am missing something here, but it seams we can call
> >>>kvm_mmu_pte_write() directly from emulator_cmpxchg_emulated()
> >>>instead of passing mmu_only down to emulator_write_emulated_onepage()
> >>>and call it there.
> >>>
> >>>
> >>>@@ -3460,7 +3444,9 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
> >>>  	if (!exchanged)
> >>>  		return X86EMUL_CMPXCHG_FAILED;
> >>>
> >>>-	return __emulator_write_emulated(addr, new, bytes, vcpu, true);
> >>>+	kvm_mmu_pte_write(vcpu, gpa, new, bytes, 1);
> >>>+
> >>>+	return X86EMUL_CONTINUE;
> >>>
> >>The written range might cross a page boundary, which
> >>kvm_mmu_pte_write() is not prepared to handle.
> >>
> >Don't we emulate exchange as write in this case?
> >
> >	if (((gpa + bytes - 1)&  PAGE_MASK) != (gpa&  PAGE_MASK))
> >		goto emul_write;
> 
> We do, but that's unrelated.  We still have to invalidate potential
> ptes on both pages
> 
The code path executed in case of cmpxchg crossing page boundary is not
touched by the patch as far as I can see. In this case
emulator_write_emulated() is executed with mmu_only false and
kvm_mmu_pte_write() is called from emulator_write_phys().

--
			Gleb.

  reply	other threads:[~2010-04-13  7:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13  7:21 [PATCH] get rid of mmu_only parameter in emulator_write_emulated() Gleb Natapov
2010-04-13  7:24 ` Avi Kivity
2010-04-13  7:26   ` Gleb Natapov
2010-04-13  7:35     ` Avi Kivity
2010-04-13  7:40       ` Gleb Natapov [this message]
2010-04-13  9:21         ` Avi Kivity
2010-04-14 17:20 ` 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=20100413074059.GH23554@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox