From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/4] KVM: MMU: don't drop spte if overwrite it from W to RO
Date: Wed, 17 Nov 2010 09:42:57 +0800 [thread overview]
Message-ID: <4CE33321.10207@cn.fujitsu.com> (raw)
In-Reply-To: <20101116202414.GA24156@amt.cnet>
On 11/17/2010 04:24 AM, Marcelo Tosatti wrote:
> On Fri, Nov 12, 2010 at 06:30:22PM +0800, Xiao Guangrong wrote:
>> We just need flush tlb if overwrite a writable spte with a read-only one
>>
>> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
>> ---
>> arch/x86/kvm/mmu.c | 19 +++++++++----------
>> 1 files changed, 9 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>> index 4b6d54c..1a93ab4 100644
>> --- a/arch/x86/kvm/mmu.c
>> +++ b/arch/x86/kvm/mmu.c
>> @@ -2044,6 +2044,15 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
>> if (pte_access & ACC_WRITE_MASK)
>> mark_page_dirty(vcpu->kvm, gfn);
>>
>> + /*
>> + * If we overwrite a writable spte with a read-only one,
>> + * flush remote TLBs. Otherwise rmap_write_protect will
>> + * find a read-only spte, even though the writable spte
>> + * might be cached on a CPU's TLB.
>> + */
>> + else if (is_writable_pte(*sptep))
>> + ret = 1;
>> +
>
> The return value of set_spte indicates whether the gfn being mapped to
> was write protected, not if a TLB flush is necessary.
>
Yes, i also noticed this and have fixed in the v2 queue, thanks Marcelo!
prev parent reply other threads:[~2010-11-17 1:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 10:30 [PATCH 1/4] KVM: MMU: don't drop spte if overwrite it from W to RO Xiao Guangrong
2010-11-12 10:33 ` [PATCH 2/4] KVM: MMU: rename 'reset_host_protection' to 'host_writeable' Xiao Guangrong
2010-11-12 10:37 ` Xiao Guangrong
2010-11-12 10:34 ` [PATCH 3/4] KVM: MMU: notrap it if gpte's reserved is set Xiao Guangrong
2010-11-14 10:56 ` Avi Kivity
2010-11-15 5:41 ` Xiao Guangrong
2010-11-15 9:17 ` Avi Kivity
2010-11-17 1:45 ` Xiao Guangrong
2010-11-12 10:35 ` [PATCH 4/4] KVM: MMU: cleanup update_pte, pte_prefetch and sync_page functions Xiao Guangrong
2010-11-16 20:52 ` Marcelo Tosatti
2010-11-17 1:58 ` Xiao Guangrong
2010-11-14 10:52 ` [PATCH 1/4] KVM: MMU: don't drop spte if overwrite it from W to RO Avi Kivity
2010-11-15 5:34 ` Xiao Guangrong
2010-11-16 20:24 ` Marcelo Tosatti
2010-11-17 1:42 ` Xiao Guangrong [this message]
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=4CE33321.10207@cn.fujitsu.com \
--to=xiaoguangrong@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@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