Re: Question about guest page tracking for x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/10/2017 15:49, Ren Kimura wrote:
> Hi.
> I'm using KVM guest page tracking API like,
> kvm_page_track_register_notifier/kvm_page_track_add_page for my
> project.
> https://lwn.net/Articles/675571/
> 
> But I can't catch some points about these API. So would anyone help me?
> 
> My primary question is how track_write is called?
> track_write hook function seems to be called by kvm_page_track_write
> from emulator_write_phys.
> 
> https://github.com/torvalds/linux/blob/3206e7d5e25ef94b5a29e2c81e6fb8d5fb48422f/arch/x86/kvm/x86.c#L4601
> 
> But page hook is set by removing write permission from spte. (assuming
> direct shadow paging case)
> When EPT violation happen due to writing this page, how is
> emulator_write_phys called?

When kvm_mmu_page_fault calls vcpu->arch.mmu.page_fault, the
implementation of the function (tdp_page_fault for EPT) calls
page_fault_handle_page_track.

If page_fault_handle_page_track says that the page is being tracked,
tdp_page_fault returns 1 which causes emulation to run.  (As an aside,
the magic "1" will change to RET_PF_EMULATE in 4.15, which is more
self-explanatory).

Paolo



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux