1. 28 Mar, 2017 1 commit
  2. 04 Nov, 2016 2 commits
  3. 02 Nov, 2016 1 commit
  4. 03 Mar, 2016 4 commits
    • Xiao Guangrong's avatar
      KVM: page track: add notifier support · 0eb05bf2
      Xiao Guangrong authored
      
      
      Notifier list is introduced so that any node wants to receive the track
      event can register to the list
      
      Two APIs are introduced here:
      - kvm_page_track_register_notifier(): register the notifier to receive
        track event
      
      - kvm_page_track_unregister_notifier(): stop receiving track event by
        unregister the notifier
      
      The callback, node->track_write() is called when a write access on the
      write tracked page happens
      
      Signed-off-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0eb05bf2
    • Xiao Guangrong's avatar
      KVM: MMU: let page fault handler be aware tracked page · 3d0c27ad
      Xiao Guangrong authored
      
      
      The page fault caused by write access on the write tracked page can not
      be fixed, it always need to be emulated. page_fault_handle_page_track()
      is the fast path we introduce here to skip holding mmu-lock and shadow
      page table walking
      
      However, if the page table is not present, it is worth making the page
      table entry present and readonly to make the read access happy
      
      mmu_need_write_protect() need to be cooked to avoid page becoming writable
      when making page table present or sync/prefetch shadow page table entries
      
      Signed-off-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3d0c27ad
    • Xiao Guangrong's avatar
      KVM: page track: introduce kvm_slot_page_track_{add,remove}_page · f29d4d78
      Xiao Guangrong authored
      
      
      These two functions are the user APIs:
      - kvm_slot_page_track_add_page(): add the page to the tracking pool
        after that later specified access on that page will be tracked
      
      - kvm_slot_page_track_remove_page(): remove the page from the tracking
        pool, the specified access on the page is not tracked after the last
        user is gone
      
      Both of these are called under the protection both of mmu-lock and
      kvm->srcu or kvm->slots_lock
      
      Signed-off-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f29d4d78
    • Xiao Guangrong's avatar
      KVM: page track: add the framework of guest page tracking · 21ebbeda
      Xiao Guangrong authored
      
      
      The array, gfn_track[mode][gfn], is introduced in memory slot for every
      guest page, this is the tracking count for the gust page on different
      modes. If the page is tracked then the count is increased, the page is
      not tracked after the count reaches zero
      
      We use 'unsigned short' as the tracking count which should be enough as
      shadow page table only can use 2^14 (2^3 for level, 2^1 for cr4_pae, 2^2
      for quadrant, 2^3 for access, 2^1 for nxe, 2^1 for cr0_wp, 2^1 for
      smep_andnot_wp, 2^1 for smap_andnot_wp, and 2^1 for smm) at most, there
      is enough room for other trackers
      
      Two callbacks, kvm_page_track_create_memslot() and
      kvm_page_track_free_memslot() are implemented in this patch, they are
      internally used to initialize and reclaim the memory of the array
      
      Currently, only write track mode is supported
      
      Signed-off-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      21ebbeda