1. 25 8月, 2017 3 次提交
  2. 18 8月, 2017 1 次提交
  3. 14 7月, 2017 1 次提交
  4. 03 7月, 2017 1 次提交
  5. 11 6月, 2017 1 次提交
    • W
      KVM: async_pf: avoid async pf injection when in guest mode · 9bc1f09f
      Wanpeng Li 提交于
       INFO: task gnome-terminal-:1734 blocked for more than 120 seconds.
             Not tainted 4.12.0-rc4+ #8
       "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
       gnome-terminal- D    0  1734   1015 0x00000000
       Call Trace:
        __schedule+0x3cd/0xb30
        schedule+0x40/0x90
        kvm_async_pf_task_wait+0x1cc/0x270
        ? __vfs_read+0x37/0x150
        ? prepare_to_swait+0x22/0x70
        do_async_page_fault+0x77/0xb0
        ? do_async_page_fault+0x77/0xb0
        async_page_fault+0x28/0x30
      
      This is triggered by running both win7 and win2016 on L1 KVM simultaneously,
      and then gives stress to memory on L1, I can observed this hang on L1 when
      at least ~70% swap area is occupied on L0.
      
      This is due to async pf was injected to L2 which should be injected to L1,
      L2 guest starts receiving pagefault w/ bogus %cr2(apf token from the host
      actually), and L1 guest starts accumulating tasks stuck in D state in
      kvm_async_pf_task_wait() since missing PAGE_READY async_pfs.
      
      This patch fixes the hang by doing async pf when executing L1 guest.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NWanpeng Li <wanpeng.li@hotmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9bc1f09f
  6. 09 5月, 2017 1 次提交
  7. 07 4月, 2017 1 次提交
    • P
      kvm: nVMX: support EPT accessed/dirty bits · ae1e2d10
      Paolo Bonzini 提交于
      Now use bit 6 of EPTP to optionally enable A/D bits for EPTP.  Another
      thing to change is that, when EPT accessed and dirty bits are not in use,
      VMX treats accesses to guest paging structures as data reads.  When they
      are in use (bit 6 of EPTP is set), they are treated as writes and the
      corresponding EPT dirty bit is set.  The MMU didn't know this detail,
      so this patch adds it.
      
      We also have to fix up the exit qualification.  It may be wrong because
      KVM sets bit 6 but the guest might not.
      
      L1 emulates EPT A/D bits using write permissions, so in principle it may
      be possible for EPT A/D bits to be used by L1 even though not available
      in hardware.  The problem is that guest page-table walks will be treated
      as reads rather than writes, so they would not cause an EPT violation.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      [Fixed typo in walk_addr_generic() comment and changed bit clear +
       conditional-set pattern in handle_ept_violation() to conditional-clear]
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      ae1e2d10
  8. 14 7月, 2016 1 次提交
  9. 11 4月, 2016 1 次提交
    • X
      KVM: MMU: fix permission_fault() · 7a98205d
      Xiao Guangrong 提交于
      kvm-unit-tests complained about the PFEC is not set properly, e.g,:
      test pte.rw pte.d pte.nx pde.p pde.rw pde.pse user fetch: FAIL: error code 15
      expected 5
      Dump mapping: address: 0x123400000000
      ------L4: 3e95007
      ------L3: 3e96007
      ------L2: 2000083
      
      It's caused by the reason that PFEC returned to guest is copied from the
      PFEC triggered by shadow page table
      
      This patch fixes it and makes the logic of updating errcode more clean
      Signed-off-by: NXiao Guangrong <guangrong.xiao@linux.intel.com>
      [Do not assume pfec.p=1. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7a98205d
  10. 22 3月, 2016 2 次提交
  11. 03 3月, 2016 2 次提交
  12. 10 11月, 2015 1 次提交
  13. 05 8月, 2015 2 次提交
  14. 20 5月, 2015 3 次提交
  15. 11 5月, 2015 2 次提交
  16. 08 5月, 2015 1 次提交
  17. 09 1月, 2015 2 次提交
  18. 03 9月, 2014 1 次提交
  19. 24 4月, 2014 1 次提交
  20. 15 4月, 2014 1 次提交
  21. 03 10月, 2013 1 次提交
  22. 07 8月, 2013 1 次提交
  23. 27 6月, 2013 2 次提交
  24. 05 6月, 2013 1 次提交
    • X
      KVM: MMU: fast invalidate all pages · 5304b8d3
      Xiao Guangrong 提交于
      The current kvm_mmu_zap_all is really slow - it is holding mmu-lock to
      walk and zap all shadow pages one by one, also it need to zap all guest
      page's rmap and all shadow page's parent spte list. Particularly, things
      become worse if guest uses more memory or vcpus. It is not good for
      scalability
      
      In this patch, we introduce a faster way to invalidate all shadow pages.
      KVM maintains a global mmu invalid generation-number which is stored in
      kvm->arch.mmu_valid_gen and every shadow page stores the current global
      generation-number into sp->mmu_valid_gen when it is created
      
      When KVM need zap all shadow pages sptes, it just simply increase the
      global generation-number then reload root shadow pages on all vcpus.
      Vcpu will create a new shadow page table according to current kvm's
      generation-number. It ensures the old pages are not used any more.
      Then the obsolete pages (sp->mmu_valid_gen != kvm->arch.mmu_valid_gen)
      are zapped by using lock-break technique
      Signed-off-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      5304b8d3
  25. 22 3月, 2013 1 次提交
  26. 13 3月, 2013 1 次提交
  27. 20 9月, 2012 3 次提交
    • A
      KVM: MMU: Optimize is_last_gpte() · 6fd01b71
      Avi Kivity 提交于
      Instead of branchy code depending on level, gpte.ps, and mmu configuration,
      prepare everything in a bitmap during mode changes and look it up during
      runtime.
      Reviewed-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      6fd01b71
    • A
      KVM: MMU: Optimize pte permission checks · 97d64b78
      Avi Kivity 提交于
      walk_addr_generic() permission checks are a maze of branchy code, which is
      performed four times per lookup.  It depends on the type of access, efer.nxe,
      cr0.wp, cr4.smep, and in the near future, cr4.smap.
      
      Optimize this away by precalculating all variants and storing them in a
      bitmap.  The bitmap is recalculated when rarely-changing variables change
      (cr0, cr4) and is indexed by the often-changing variables (page fault error
      code, pte access permissions).
      
      The permission check is moved to the end of the loop, otherwise an SMEP
      fault could be reported as a false positive, when PDE.U=1 but PTE.U=0.
      Noted by Xiao Guangrong.
      
      The result is short, branch-free code.
      Reviewed-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      97d64b78
    • A
      KVM: MMU: Push clean gpte write protection out of gpte_access() · 8ea667f2
      Avi Kivity 提交于
      gpte_access() computes the access permissions of a guest pte and also
      write-protects clean gptes.  This is wrong when we are servicing a
      write fault (since we'll be setting the dirty bit momentarily) but
      correct when instantiating a speculative spte, or when servicing a
      read fault (since we'll want to trap a following write in order to
      set the dirty bit).
      
      It doesn't seem to hurt in practice, but in order to make the code
      readable, push the write protection out of gpte_access() and into
      a new protect_clean_gpte() which is called explicitly when needed.
      Reviewed-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      8ea667f2
  28. 24 7月, 2011 1 次提交
    • X
      KVM: MMU: mmio page fault support · ce88decf
      Xiao Guangrong 提交于
      The idea is from Avi:
      
      | We could cache the result of a miss in an spte by using a reserved bit, and
      | checking the page fault error code (or seeing if we get an ept violation or
      | ept misconfiguration), so if we get repeated mmio on a page, we don't need to
      | search the slot list/tree.
      | (https://lkml.org/lkml/2011/2/22/221)
      
      When the page fault is caused by mmio, we cache the info in the shadow page
      table, and also set the reserved bits in the shadow page table, so if the mmio
      is caused again, we can quickly identify it and emulate it directly
      
      Searching mmio gfn in memslots is heavy since we need to walk all memeslots, it
      can be reduced by this feature, and also avoid walking guest page table for
      soft mmu.
      
      [jan: fix operator precedence issue]
      Signed-off-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      ce88decf