public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sunil <infinite.questions@gmail.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Correct way of tracking reads on given gfn ?
Date: Mon, 09 Sep 2013 12:08:00 +0200	[thread overview]
Message-ID: <522D9E00.3090806@redhat.com> (raw)
In-Reply-To: <CALSEb2fzW9b+8_336Vh0zQuPP+ETTCk+u_asV1ofFs+Ui938HQ@mail.gmail.com>

Il 09/09/2013 11:45, Sunil ha scritto:
> Hello List,
> 
> (1) What is the correct way of tracking reads on given gfn ?
> 
> Looks like functions rmap_write_protect(kvm, gfn) and
> kvm_mmu_rmap_write_protect(kvm, gfn, slot) removes the write
> permission for the given page, by flipping write bit using
> PT_WRITABLE_MASK. Thus trapping writes.
> 
> For trapping reads, are there similar routines ? If not, I see
> equivalent flag PM_PRESENT_MASK. Thus one way probably is writing
> wrapper routines similar to above to flip both read(present) and write
> bits. Or would it be just enough to drop the spte instead using
> function drop_spte() ?

If you are using EPT and your processor has the accessed and dirty bits
for EPT page tables (cat /sys/module/kvm_intel/parameters/eptad), you
could use the accessed bit to track reads.  They wouldn't trap, but you
would be able to poll the EPT page tables.

Paolo

> (2) Is kvm_flush_remote_tlbs() required after either of above approaches ?
> Is kvm_flush_remote_tlbs() correct function to flush tlbs ?
> 
> --
> --
> 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
> 


  reply	other threads:[~2013-09-09 10:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09  9:45 Correct way of tracking reads on given gfn ? Sunil
2013-09-09 10:08 ` Paolo Bonzini [this message]
2013-09-09 10:22   ` SPA
2013-09-09 10:53     ` Paolo Bonzini
2013-09-09 12:29       ` Gleb Natapov
2013-09-10  1:12         ` Arthur Chunqi Li
2013-09-10  6:08           ` Gleb Natapov

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=522D9E00.3090806@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=infinite.questions@gmail.com \
    --cc=kvm@vger.kernel.org \
    /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