kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI
@ 2015-10-30  0:09 Suresh Warrier
  2015-10-30  0:09 ` [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures Suresh Warrier
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

When the VCPU target of an H_IPI hypercall is not running
in the guest, we need to do a kick VCPU (wake the VCPU thread)
to make it runnable. The real-mode version of the H_IPI hypercall
cannot do this because it involves waking a sleeping thread.
Thus the hcall returns H_TOO_HARD which forces a switch back
to host so that the H_IPI call can be completed in virtual mode.
This has been found to cause a slowdown for many workloads like
YCSB MongoDB, small message networking, etc. 

This patch set optimizes the wakeup of the target VCPU by posting
a free core already running in the host to do the wakeup, thus
avoiding the switch to host and back. It requires maintaining a
bitmask of all the available cores in the system to indicate if
they are in the host or running in some guest. It also requires
the H_IPI hypercall to search for a free host core and send it a
new IPI message PPC_MSG_RM_HOST_ACTION after stashing away some
parameters like the pointer to VCPU for the IPI handler. Locks
are avoided by using atomic operations to save core state, to
find and reserve a core in the host, etc.

Note that it is possible for a guest to be destroyed and its
VCPUs freed before the IPI handler gets to run. This case is
handled by ensuring that any pending PPC_MSG_RM_HOST_ACTION
IPIs are completed before proceeding with freeing the VCPUs.

A tunable h_ipi_redirect is also included in the patch set to
disable the feature. 

This patch set depends upon patches to powerpc to increase the
number of supported IPI messages to 8 and which also defines
the PPC_MSG_RM_HOST_ACTION message.

Suresh Warrier (6):
  KVM: PPC: Book3S HV: Host-side RM data structures
  KVM: PPC: Book3S HV: Manage core host state
  KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs
  KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM
  KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection

 arch/powerpc/include/asm/kvm_ppc.h   |  33 +++++++
 arch/powerpc/kernel/smp.c            |  11 +++
 arch/powerpc/kvm/book3s_hv.c         | 166 +++++++++++++++++++++++++++++++++++
 arch/powerpc/kvm/book3s_hv_builtin.c |   3 +
 arch/powerpc/kvm/book3s_hv_rm_xics.c | 120 ++++++++++++++++++++++++-
 arch/powerpc/kvm/powerpc.c           |  10 +++
 6 files changed, 340 insertions(+), 3 deletions(-)

-- 
1.8.3.4


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

end of thread, other threads:[~2015-11-02 22:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
2015-10-30  0:09 ` [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures Suresh Warrier
2015-10-30  0:09 ` [PATCH 2/6] KVM: PPC: Book3S HV: Manage core host state Suresh Warrier
2015-10-30  0:09 ` [PATCH 3/6] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs Suresh Warrier
2015-10-30  0:09 ` [PATCH 4/6] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM Suresh Warrier
2015-10-30  0:09 ` [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU Suresh Warrier
2015-10-30  4:52   ` kbuild test robot
2015-10-30 15:16     ` Suresh E. Warrier
2015-11-02  2:51       ` [kbuild-all] " Fengguang Wu
2015-11-02 22:10         ` Suresh E. Warrier
2015-11-02 22:46           ` Michael Ellerman
2015-10-30  9:23   ` kbuild test robot
2015-10-30  0:09 ` [PATCH 6/6] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection Suresh Warrier

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).