From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Correct way of tracking reads on given gfn ? Date: Mon, 09 Sep 2013 12:08:00 +0200 Message-ID: <522D9E00.3090806@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" To: Sunil Return-path: Received: from mail-ee0-f42.google.com ([74.125.83.42]:34916 "EHLO mail-ee0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714Ab3IIKH4 (ORCPT ); Mon, 9 Sep 2013 06:07:56 -0400 Received: by mail-ee0-f42.google.com with SMTP id b45so3022872eek.15 for ; Mon, 09 Sep 2013 03:07:55 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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 >