Skip to content

RFC kvmppc: paravirtualization interface - host part v2

[email protected] kvm-ppc linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6kvmppc: add hypercall infrastructure - host partarch/powerpc/kvm/emulate.c include/asm-powerpc/kvm_para.h+30 -00 replies
2/6kvmppc: magic page hypercall - host partarch/powerpc/kvm/booke_guest.c arch/powerpc/kvm/emulate.c arch/powerpc/kvm/powerpc.c +3 more+79 -22 replies
2/6kvmppc: magic page hypercall - host partarch/powerpc/kvm/booke_guest.c arch/powerpc/kvm/emulate.c arch/powerpc/kvm/powerpc.c +3 more+74 -20 replies
3/6kvmppc: rewrite guest code - sprg0-3arch/powerpc/kvm/booke_guest.c arch/powerpc/kvm/emulate.c include/asm-powerpc/kvm_para.h+200 -29 replies
3/6kvmppc: rewrite guest code - sprg0-3arch/powerpc/kvm/booke_guest.c arch/powerpc/kvm/emulate.c include/asm-powerpc/kvm_para.h+310 -80 replies
4/6kvmppc: rewrite guest code - dear, esr, srr0, srr1arch/powerpc/kvm/booke_guest.c arch/powerpc/kvm/emulate.c include/asm-powerpc/kvm_para.h+77 -120 replies
5/6kvmppc: rewrite guest code - wrteearch/powerpc/kvm/booke_guest.c arch/powerpc/kvm/emulate.c arch/powerpc/kvm/powerpc.c +2 more+35 -100 replies
6/6kvmppc: kvm-userspace: device tree modification for magic pagelibkvm/libkvm-powerpc.c libkvm/libkvm.h qemu/hw/device_tree.c +4 more+45 -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 0/6][RFC] kvmppc: paravirtualization interface - host part v2

From: Christian Ehrhardt <[email protected]>

This patch series implements the host part of an paravirtualization interface using:
- the device tree mechanism to pass hypervisor informations to the guest (kvm-userspace)
- hypercalls backend for guest->host calls
- an example exploiter of that interface (magic page) that uses that for binary rewriting saving guest exits by avoiding privileged instructions

Version 2 contains the feedback to my last submission and implemented an exploitation of that interface using the magic page mechanism to rewrite guest code.

The used hypercall ABI was already discussed on the embedded-hypervisor mailing list and is available at http://kvm.qumranet.com/kvmwiki/PowerPC_Hypercall_ABI

The device tree format used here (ºse for the discussions on embedded-hypervisor) is the following.
- A node "hypervisor" to show the general availability of some hypervisor data
- flags for features like the example "feature,pv-magicpage" setting 1 = available, everything else = unavailable
- Some features might need to pass more data and can use an entry in the device tree like the example of "data,pv-magicpage-size"

If the guest wants that pv support it has to allocate the requested size of memory (aligned to the tlb entry size rounded up => e.g. 4000 bytes 4k aligned, 4096 bytes 4k aligned, 4097 bytes 16k aligned and so on).

The speedup with both patch queues applied is around 40% dependent on what the guest is doing (measured with boot times and some simple tasks). The raw saving of exits about ~50-60% as you can see in the kvm stat exit counters.

[patches in series]
[PATCH 1/6] kvmppc: add hypercall infrastructure - host part [PATCH 2/6] kvmppc: magic page hypercall - host part
[PATCH 3/6] kvmppc: rewrite guest code - sprg0-3
[PATCH 4/6] kvmppc: rewrite guest code - dear, esr, srr0, srr1 [PATCH 5/6] kvmppc: rewrite guest code - wrtee
[PATCH 6/6] kvmppc: kvm-userspace: device tree modification for magic page

---
[diffstat]

 arch/powerpc/kvm/booke_guest.c   |   78 ++++++++++---
 arch/powerpc/kvm/emulate.c       |  233 +++++++++++++++++++++++++++++++++++++--
 arch/powerpc/kvm/powerpc.c       |    1
 b/arch/powerpc/kvm/booke_guest.c |   14 ++
 b/arch/powerpc/kvm/emulate.c     |   28 ++++
 b/arch/powerpc/kvm/powerpc.c     |   19 +++
 b/include/asm-powerpc/kvm_host.h |    6 +
 b/include/asm-powerpc/kvm_para.h |    2
 b/include/asm-powerpc/kvm_ppc.h  |    5
 b/include/linux/kvm.h            |    5
 b/libkvm/libkvm-powerpc.c        |    6 +
 b/libkvm/libkvm.h                |    4
 b/qemu/hw/device_tree.c          |   10 +
 b/qemu/hw/device_tree.h          |    1
 b/qemu/hw/ppc440_bamboo.c        |   18 +++
 b/qemu/qemu-kvm-powerpc.c        |    5
 b/qemu/qemu-kvm.h                |    1
 include/asm-powerpc/kvm_para.h   |   56 +++++++++
 18 files changed, 466 insertions(+), 26 deletions(-)