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 11/11] KVM: MMU: improve write flooding detected
Date: Thu, 25 Aug 2011 15:40:56 +0800 [thread overview]
Message-ID: <4E55FC88.4040300@cn.fujitsu.com> (raw)
In-Reply-To: <20110825020424.GA2542@amt.cnet>
On 08/25/2011 10:04 AM, Marcelo Tosatti wrote:
>>> Yes, in this case, the sp is not zapped, but it is hardly to know the gfn
>>> is not used as gpte just depends on writing, for example, the guest can
>>> change the mapping address or the status bit, and so on...The sp can be
>>> zapped if the guest write it again(on the same address), i think it is
>>> acceptable, anymore, it is just the speculative way to zap the unused
>>> shadow page...your opinion?
>>
>> It could increase the flood count independently of the accessed bit of
>> the spte being updated, zapping after 3 attempts as it is now.
>>
>> But additionally reset the flood count if the gpte appears to be valid
>> (points to an existant gfn if the present bit is set, or if its zeroed).
>
> Well not zero, as thats a common pattern for non ptes.
>
Hi Marcelo,
Maybe it is not good i think, for some reasons:
- checking gfn valid which it is pointed by gpte is high overload,
it needs to call gfn_to_hva to walk memslots, especially. kvm_mmu_pte_write
is called very frequently on shadow mmu.
- MMIO gfn is not an existent gfn, but it is valid pointed by gpte
- we can check the reserved bits in the gpte to check whether it is valid a
gpte, but for some paging modes, all bits are valid.(for example, non-PAE mode)
- it can not work if the gfn has multiple shadow pages, for example:
if the gfn was used as PDE, later it is used as PTE, then we have two shadow
pages: sp1.level = 2, sp2.level = 1, sp1 can not be zapped even even though it
is not used anymore.
- sometime, we need to zap the shadow page even though the gpte is written validly:
if the gpte is written frequently but infrequently accessed, we do better zap the
shadow page to let it is writable(write it directly without #PF) and map it when it
is accessed, one example is from Avi, the guest OS may update many gptes at one time
after one page fault.
next prev parent reply other threads:[~2011-08-25 7:38 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-16 6:40 [PATCH 01/11] KVM: MMU: avoid pte_list_desc running out in kvm_mmu_pte_write Xiao Guangrong
2011-08-16 6:41 ` [PATCH 02/11] KVM: x86: tag the instructions which are used to write page table Xiao Guangrong
2011-08-22 14:32 ` Marcelo Tosatti
2011-08-22 14:36 ` Avi Kivity
2011-08-16 6:42 ` [PATCH 03/11] KVM: x86: retry non-page-table writing instruction Xiao Guangrong
2011-08-22 19:59 ` Marcelo Tosatti
2011-08-22 20:21 ` Xiao Guangrong
2011-08-22 20:42 ` Marcelo Tosatti
2011-08-16 6:42 ` [PATCH 04/11] KVM: x86: cleanup port-in/port-out emulated Xiao Guangrong
2011-08-16 6:43 ` [PATCH 05/11] KVM: MMU: do not mark access bit on pte write path Xiao Guangrong
2011-08-16 6:44 ` [PATCH 06/11] KVM: MMU: cleanup FNAME(invlpg) Xiao Guangrong
2011-08-16 6:44 ` [PATCH 07/11] KVM: MMU: fast prefetch spte on invlpg path Xiao Guangrong
2011-08-22 22:28 ` Marcelo Tosatti
2011-08-23 1:50 ` Xiao Guangrong
2011-08-16 6:45 ` [PATCH 08/11] KVM: MMU: remove unnecessary kvm_mmu_free_some_pages Xiao Guangrong
2011-08-16 6:45 ` [PATCH 09/11] KVM: MMU: split kvm_mmu_pte_write function Xiao Guangrong
2011-08-16 6:46 ` [PATCH 10/11] KVM: MMU: fix detecting misaligned accessed Xiao Guangrong
2011-08-16 6:46 ` [PATCH 11/11] KVM: MMU: improve write flooding detected Xiao Guangrong
2011-08-23 8:00 ` Marcelo Tosatti
2011-08-23 10:55 ` Xiao Guangrong
2011-08-23 12:38 ` Marcelo Tosatti
2011-08-23 16:32 ` Xiao Guangrong
2011-08-23 19:09 ` Marcelo Tosatti
2011-08-23 20:16 ` Xiao Guangrong
2011-08-24 20:05 ` Marcelo Tosatti
2011-08-25 2:04 ` Marcelo Tosatti
2011-08-25 4:42 ` Avi Kivity
2011-08-25 13:21 ` Marcelo Tosatti
2011-08-25 14:06 ` Avi Kivity
2011-08-25 14:07 ` Avi Kivity
2011-08-25 7:40 ` Xiao Guangrong [this message]
2011-08-25 7:57 ` Xiao Guangrong
2011-08-25 13:47 ` Marcelo Tosatti
2011-08-26 3:18 ` Xiao Guangrong
2011-08-26 10:53 ` Marcelo Tosatti
2011-08-26 14:24 ` Xiao Guangrong
-- strict thread matches above, loose matches on Subject: below --
2011-07-26 11:24 [PATCH 0/11] KVM: x86: optimize for guest page written Xiao Guangrong
2011-07-26 11:32 ` [PATCH 11/11] KVM: MMU: improve write flooding detected Xiao Guangrong
2011-07-27 9:23 ` Avi Kivity
2011-07-27 10:20 ` Xiao Guangrong
2011-07-27 11:08 ` Avi Kivity
2011-07-28 2:43 ` Xiao Guangrong
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=4E55FC88.4040300@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