Skip to content

KVM PPC PV framework

Alexander Graf kvm kvm-ppc linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest15 of 26 patches 24 repliesIn review

15 of 26 patches are in this archive. The cover letter announces 26.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26KVM: PPC: Introduce shared pagearch/powerpc/include/asm/kvm_host.h arch/powerpc/include/asm/kvm_para.h arch/powerpc/kernel/asm-offsets.c +3 more+29 -03 replies
3/26KVM: PPC: Convert DSISR to shared pagearch/powerpc/include/asm/kvm_book3s.h arch/powerpc/include/asm/kvm_para.h arch/powerpc/kvm/book3s.c +2 more+11 -100 replies
5/26KVM: PPC: Convert SRR0 and SRR1 to shared pagearch/powerpc/include/asm/kvm_host.h arch/powerpc/include/asm/kvm_para.h arch/powerpc/kvm/book3s.c +4 more+28 -230 replies
6/26KVM: PPC: Convert SPRG[0-4] to shared pagearch/powerpc/include/asm/kvm_host.h arch/powerpc/include/asm/kvm_para.h arch/powerpc/kvm/book3s.c +2 more+36 -280 replies
7/26KVM: PPC: Implement hypervisor interfacearch/powerpc/include/asm/kvm_para.h arch/powerpc/include/asm/kvm_ppc.h arch/powerpc/kvm/book3s.c +4 more+156 -60 replies
9/26KVM: PPC: Add PV guest scratch registersarch/powerpc/include/asm/kvm_para.h+3 -03 replies
10/26KVM: PPC: Tell guest about pending interruptsarch/powerpc/include/asm/kvm_para.h arch/powerpc/kvm/book3s.c arch/powerpc/kvm/booke.c+15 -00 replies
11/26KVM: PPC: Make RMO a definearch/powerpc/include/asm/kvm_host.h arch/powerpc/kvm/book3s.c+4 -26 replies
12/26KVM: PPC: First magic page stepsarch/powerpc/include/asm/kvm_host.h include/linux/kvm_para.h+3 -02 replies
15/26KVM: PPC: Expose magic page support to guestarch/powerpc/include/asm/kvm_para.h arch/powerpc/kvm/powerpc.c+13 -00 replies
16/26KVM: Move kvm_guest_init out of generic codearch/x86/include/asm/kvm_para.h include/linux/kvm_para.h+6 -50 replies
18/26KVM: PPC: KVM PV guest stubsarch/powerpc/kernel/kvm.c+59 -010 replies
21/26KVM: PPC: Introduce kvm_tmp frameworkarch/powerpc/kernel/kvm.c+39 -20 replies
23/26KVM: PPC: PV mtmsrd L=1arch/powerpc/kernel/kvm.c arch/powerpc/kernel/kvm_emul.S+101 -00 replies
25/26KVM: PPC: PV wrteeiarch/powerpc/kernel/kvm.c arch/powerpc/kernel/kvm_emul.S+91 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/26] KVM PPC PV framework

On PPC we run PR=0 (kernel mode) code in PR=1 (user mode) and don't use the hypervisor extensions.

While that is all great to show that virtualization is possible, there are quite some cases where the emulation overhead of privileged instructions is killing performance.

This patchset tackles exactly that issue. It introduces a paravirtual framework using which KVM and Linux share a page to exchange register state with. That way we don't have to switch to the hypervisor just to change a value of a privileged register.

To prove my point, I ran the same test I did for the MMU optimizations against the PV framework. Here are the results:

[without]

debian-powerpc:~# time for i in {1..1000}; do /bin/echo hello > /dev/null; done
real    0m14.659s
user    0m8.967s
sys     0m5.688s

[with]

debian-powerpc:~# time for i in {1..1000}; do /bin/echo hello > /dev/null; done
real    0m7.557s
user    0m4.121s
sys     0m3.426s

So this is a significant performance improvement! I'm quite happy how fast this whole thing becomes :)

I tried to take all comments I've heard from people so far about such a PV framework into account. In case you told me something before that is a no-go and I still did it, please just tell me again.

Now go and have fun with fast VMs on PPC! Get yourself a G5 on ebay and start experiencing the power yourself. - heh

Alexander Graf (26):
KVM: PPC: Introduce shared page
KVM: PPC: Convert MSR to shared page
KVM: PPC: Convert DSISR to shared page
KVM: PPC: Convert DAR to shared page.
KVM: PPC: Convert SRR0 and SRR1 to shared page
KVM: PPC: Convert SPRG[0-4] to shared page
KVM: PPC: Implement hypervisor interface
KVM: PPC: Add PV guest critical sections
KVM: PPC: Add PV guest scratch registers
KVM: PPC: Tell guest about pending interrupts
KVM: PPC: Make RMO a define
KVM: PPC: First magic page steps
KVM: PPC: Magic Page Book3s support
KVM: PPC: Magic Page BookE support
KVM: PPC: Expose magic page support to guest
KVM: Move kvm_guest_init out of generic code
KVM: PPC: Generic KVM PV guest support
KVM: PPC: KVM PV guest stubs
KVM: PPC: PV instructions to loads and stores
KVM: PPC: PV tlbsync to nop
KVM: PPC: Introduce kvm_tmp framework
KVM: PPC: PV assembler helpers
KVM: PPC: PV mtmsrd L=1
KVM: PPC: PV mtmsrd L=0 and mtmsr
KVM: PPC: PV wrteei
KVM: PPC: Add Documentation about PV interface

 Documentation/kvm/ppc-pv.txt             |  164 ++++++++++++
 arch/powerpc/include/asm/kvm_book3s.h    |    1 -
 arch/powerpc/include/asm/kvm_host.h      |   14 +-
 arch/powerpc/include/asm/kvm_para.h      |  121 +++++++++-
 arch/powerpc/include/asm/kvm_ppc.h       |    1 +
 arch/powerpc/kernel/Makefile             |    2 +
 arch/powerpc/kernel/asm-offsets.c        |   18 ++-
 arch/powerpc/kernel/kvm.c                |  399 ++++++++++++++++++++++++++++++
 arch/powerpc/kernel/kvm_emul.S           |  237 ++++++++++++++++++
 arch/powerpc/kvm/44x.c                   |    7 +
 arch/powerpc/kvm/44x_tlb.c               |    8 +-
 arch/powerpc/kvm/book3s.c                |  162 ++++++++-----
 arch/powerpc/kvm/book3s_32_mmu.c         |   28 ++-
 arch/powerpc/kvm/book3s_32_mmu_host.c    |   16 +-
 arch/powerpc/kvm/book3s_64_mmu.c         |   42 +++-
 arch/powerpc/kvm/book3s_64_mmu_host.c    |   16 +-
 arch/powerpc/kvm/book3s_emulate.c        |   25 +-
 arch/powerpc/kvm/book3s_paired_singles.c |   11 +-
 arch/powerpc/kvm/booke.c                 |  110 +++++++--
 arch/powerpc/kvm/booke.h                 |    6 +-
 arch/powerpc/kvm/booke_emulate.c         |   14 +-
 arch/powerpc/kvm/booke_interrupts.S      |    3 +-
 arch/powerpc/kvm/e500.c                  |    7 +
 arch/powerpc/kvm/e500_tlb.c              |   31 ++-
 arch/powerpc/kvm/e500_tlb.h              |    2 +-
 arch/powerpc/kvm/emulate.c               |   47 +++-
 arch/powerpc/kvm/powerpc.c               |   42 +++-
 arch/powerpc/platforms/Kconfig           |   10 +
 arch/x86/include/asm/kvm_para.h          |    6 +
 include/linux/kvm_para.h                 |    7 +-
 30 files changed, 1383 insertions(+), 174 deletions(-)
 create mode 100644 Documentation/kvm/ppc-pv.txt
 create mode 100644 arch/powerpc/kernel/kvm.c
 create mode 100644 arch/powerpc/kernel/kvm_emul.S