kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] KVM: MMU: fast invalidate all mmio sptes
@ 2013-06-07  8:51 Xiao Guangrong
  2013-06-07  8:51 ` [PATCH v3 1/6] KVM: MMU: retain more available bits on mmio spte Xiao Guangrong
                   ` (9 more replies)
  0 siblings, 10 replies; 32+ messages in thread
From: Xiao Guangrong @ 2013-06-07  8:51 UTC (permalink / raw)
  To: gleb; +Cc: avi.kivity, mtosatti, pbonzini, linux-kernel, kvm, Xiao Guangrong

Changelog:
V3:
  All of these changes are from Gleb's review:
  1) rename RET_MMIO_PF_EMU to RET_MMIO_PF_EMULATE.
  2) smartly adjust kvm generation number in kvm_current_mmio_generatio()
     to avoid kvm_memslots->generation overflow.

V2:
  - rename kvm_mmu_invalid_mmio_spte to kvm_mmu_invalid_mmio_sptes
  - use kvm->memslots->generation as kvm global generation-number
  - fix comment and codestyle
  - init kvm generation close to mmio wrap-around value
  - keep kvm_mmu_zap_mmio_sptes

The current way is holding hot mmu-lock and walking all shadow pages, this
is not scale. This patchset tries to introduce a very simple and scale way
to fast invalidate all mmio sptes - it need not walk any shadow pages and hold
any locks.

The idea is simple:
KVM maintains a global mmio valid generation-number which is stored in
kvm->memslots.generation and every mmio spte stores the current global
generation-number into his available bits when it is created

When KVM need zap all mmio sptes, it just simply increase the global
generation-number. When guests do mmio access, KVM intercepts a MMIO #PF
then it walks the shadow page table and get the mmio spte. If the
generation-number on the spte does not equal the global generation-number,
it will go to the normal #PF handler to update the mmio spte

Since 19 bits are used to store generation-number on mmio spte, we zap all
mmio sptes when the number is round

Xiao Guangrong (6):
  KVM: MMU: retain more available bits on mmio spte
  KVM: MMU: store generation-number into mmio spte
  KVM: MMU: make return value of mmio page fault handler more readable
  KVM: MMU: fast invalidate all mmio sptes
  KVM: MMU: add tracepoint for check_mmio_spte
  KVM: MMU: init kvm generation close to mmio wrap-around value

 arch/x86/include/asm/kvm_host.h |   2 +-
 arch/x86/kvm/mmu.c              | 131 ++++++++++++++++++++++++++++++++--------
 arch/x86/kvm/mmu.h              |  17 ++++++
 arch/x86/kvm/mmutrace.h         |  34 +++++++++--
 arch/x86/kvm/paging_tmpl.h      |  10 ++-
 arch/x86/kvm/vmx.c              |  12 ++--
 arch/x86/kvm/x86.c              |  11 +++-
 7 files changed, 177 insertions(+), 40 deletions(-)

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2013-06-27 11:10 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07  8:51 [PATCH v3 0/6] KVM: MMU: fast invalidate all mmio sptes Xiao Guangrong
2013-06-07  8:51 ` [PATCH v3 1/6] KVM: MMU: retain more available bits on mmio spte Xiao Guangrong
2013-06-07  8:51 ` [PATCH v3 2/6] KVM: MMU: store generation-number into " Xiao Guangrong
2013-06-07  8:51 ` [PATCH v3 3/6] KVM: MMU: make return value of mmio page fault handler more readable Xiao Guangrong
2013-06-10  7:57   ` Gleb Natapov
2013-06-10  8:45     ` Xiao Guangrong
2013-06-10 13:16     ` Takuya Yoshikawa
2013-06-11  9:18       ` Gleb Natapov
2013-06-07  8:51 ` [PATCH v3 4/6] KVM: MMU: fast invalidate all mmio sptes Xiao Guangrong
2013-06-27  8:29   ` Gleb Natapov
2013-06-27  9:01     ` Gleb Natapov
2013-06-27  9:14       ` Gleb Natapov
2013-06-27  9:21         ` Gleb Natapov
2013-06-27  9:50           ` Xiao Guangrong
2013-06-27 10:19             ` Gleb Natapov
2013-06-27 11:05               ` Xiao Guangrong
2013-06-27 11:10                 ` Gleb Natapov
2013-06-07  8:51 ` [PATCH v3 5/6] KVM: MMU: add tracepoint for check_mmio_spte Xiao Guangrong
2013-06-07  8:51 ` [PATCH v3 6/6] KVM: MMU: init kvm generation close to mmio wrap-around value Xiao Guangrong
2013-06-10  7:56 ` [PATCH v3 0/6] KVM: MMU: fast invalidate all mmio sptes Gleb Natapov
2013-06-10  8:39   ` Xiao Guangrong
2013-06-10 13:43     ` Takuya Yoshikawa
2013-06-10 17:03       ` Gleb Natapov
2013-06-19 11:08         ` Paolo Bonzini
2013-06-19 11:27           ` Xiao Guangrong
2013-06-14  0:08 ` Marcelo Tosatti
2013-06-15  2:22   ` Takuya Yoshikawa
2013-06-17 11:59     ` Xiao Guangrong
2013-06-18 22:21       ` Marcelo Tosatti
2013-06-18 14:26 ` Paolo Bonzini
2013-06-19  2:47   ` Xiao Guangrong
2013-06-19 17:40 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).