From: Davidlohr Bueso <dave@gnu.org>
To: Sunil Agham <sunil.agham@gmail.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>, kvm@vger.kernel.org
Subject: Re: KVM: MMU: Tracking guest writes through EPT entries ?
Date: Thu, 30 Aug 2012 23:30:57 +0200 [thread overview]
Message-ID: <1346362257.2747.19.camel@offbook> (raw)
In-Reply-To: <CALSEb2cs9cXYvMs3aUFAmZ50SOo5FJ=0+M425HSnU-=-==BbTg@mail.gmail.com>
On Tue, 2012-07-31 at 14:53 -0400, Sunil Agham wrote:
> On Mon, Jul 30, 2012 at 10:49 PM, Xiao Guangrong
> <xiaoguangrong@linux.vnet.ibm.com> wrote:
> > On 07/31/2012 01:18 AM, Sunil wrote:
> >> Hello List,
> >>
> >> I am a KVM newbie and studying KVM mmu code.
> >>
> >> On the existing guest, I am trying to track all guest writes by
> >> marking page table entry as read-only in EPT entry [ I am using Intel
> >> machine with vmx and ept support ]. Looks like EPT support re-uses
> >> shadow page table(SPT) code and hence some of SPT routines.
> >>
> >> I was thinking of below possible approach. Use pte_list_walk() to
> >> traverse through list of sptes and use mmu_spte_update() to flip the
> >> PT_WRITABLE_MASK flag. But all SPTEs are not part of any single list;
> >> but on separate lists (based on gfn, page level, memory_slot). So,
> >> recording all the faulted guest GFN and then using above method work ?
> >>
> >
> > There are two ways to write-protect all sptes:
> > - use kvm_mmu_slot_remove_write_access() on all memslots
> > - walk the shadow page cache to get the shadow pages in the highest level
> > (level = 4 on EPT), then write-protect its entries.
> >
> > If you just want to do it for the specified gfn, you can use
> > rmap_write_protect().
> >
> > Just inquisitive, what is your purpose? :)
> >
>
>
> Thanks Xiao !
>
> Just hands on with virtualization hardware. Trying to preserve guest
> state after migration.
This is actually a very common technique for tracking guest pfn accesses
-- triggering false page faults by write protecting the page tables. I
used a similar approach to compute guest working sets and build miss
rate curves.
- Davidlohr
next prev parent reply other threads:[~2012-08-30 21:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 17:18 KVM: MMU: Tracking guest writes through EPT entries ? Sunil
2012-07-31 2:49 ` Xiao Guangrong
2012-07-31 18:53 ` Sunil Agham
2012-08-30 21:30 ` Davidlohr Bueso [this message]
2012-08-28 3:30 ` Felix
2012-08-30 10:22 ` Xiao Guangrong
2012-08-30 18:59 ` Hugo
2012-08-31 2:54 ` Xiao Guangrong
2012-08-31 21:30 ` Hui Lin (Hugo)
2012-09-02 13:29 ` Xiao Guangrong
[not found] ` <bb786815f6c14144acc31b8041486282@CITESHT1.ad.uillinois.edu>
2012-09-03 2:09 ` Hugo
2012-09-03 6:11 ` Xiao Guangrong
2012-09-05 3:23 ` Hugo
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=1346362257.2747.19.camel@offbook \
--to=dave@gnu.org \
--cc=kvm@vger.kernel.org \
--cc=sunil.agham@gmail.com \
--cc=xiaoguangrong@linux.vnet.ibm.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.