[PATCH 00/27] KVM PPC PV framework v3
Alexander Graf
agraf at suse.de
Thu Jul 29 22:47:41 EST 2010
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.
To make use of this whole thing you also need patches to qemu and openbios. I
have them in my queue, but want to see this set upstream first before I start
sending patches to the other projects.
Now go and have fun with fast VMs on PPC! Get yourself a G5 on ebay and start
experiencing the power yourself. - heh
v1 -> v2:
- change hypervisor calls to use r0 and r3
- make crit detection only trigger in supervisor mode
- RMO -> PAM
- introduce kvm_patch_ins
- only flush icache when patching
- introduce kvm_patch_ins_b
- update documentation
v2 -> v3:
- use pPAPR conventions for hypercall interface
- only use r0 as magic sc number
- remove PVR detection
- remove BookE shared page mapping support
- combine book3s-64 and -32 magic page ra override
- add self-test check if the mapping works to guest code
- add safety check for relocatable kernels
Alexander Graf (27):
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 PAM a define
KVM: PPC: First magic page steps
KVM: PPC: Magic Page Book3s 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: Introduce branch patching helper
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
KVM: PPC: Add get_pvinfo interface to query hypercall instructions
Documentation/kvm/api.txt | 23 ++
Documentation/kvm/ppc-pv.txt | 180 +++++++++++
arch/powerpc/include/asm/kvm_book3s.h | 2 +-
arch/powerpc/include/asm/kvm_host.h | 15 +-
arch/powerpc/include/asm/kvm_para.h | 135 ++++++++-
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 | 485 ++++++++++++++++++++++++++++++
arch/powerpc/kernel/kvm_emul.S | 247 +++++++++++++++
arch/powerpc/kvm/44x.c | 7 +
arch/powerpc/kvm/44x_tlb.c | 8 +-
arch/powerpc/kvm/book3s.c | 188 ++++++++----
arch/powerpc/kvm/book3s_32_mmu.c | 28 ++-
arch/powerpc/kvm/book3s_32_mmu_host.c | 6 +-
arch/powerpc/kvm/book3s_64_mmu.c | 42 +++-
arch/powerpc/kvm/book3s_64_mmu_host.c | 13 +-
arch/powerpc/kvm/book3s_emulate.c | 25 +-
arch/powerpc/kvm/book3s_paired_singles.c | 11 +-
arch/powerpc/kvm/booke.c | 83 ++++--
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 | 12 +-
arch/powerpc/kvm/e500_tlb.h | 2 +-
arch/powerpc/kvm/emulate.c | 36 ++-
arch/powerpc/kvm/powerpc.c | 84 +++++-
arch/powerpc/platforms/Kconfig | 10 +
arch/x86/include/asm/kvm_para.h | 6 +
include/linux/kvm.h | 11 +
include/linux/kvm_para.h | 7 +-
32 files changed, 1538 insertions(+), 179 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
More information about the Linuxppc-dev
mailing list