KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI
Subsystems (3)
cover KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI
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(-)
Signature · 1 line
1.8.3.4
PATCH 1/6 KVM: PPC: Book3S HV: Host-side RM data structures
This patch defines the data structures to support the setting up of host side operations while running in real mode in the guest, and also the functions to allocate and free it.
The operations are for now limited to virtual XICS operations. Currently, we have only defined one operation in the data structure:
- Wake up a VCPU sleeping in the host when it receives a virtual interrupt
The operations are assigned at the core level because PowerKVM requires that the host run in SMT off mode. For each core, we will need to manage its state atomically - where the state is defined by:
1. Is the core running in the host?
2. Is there a Real Mode (RM) operation pending on the host?
Currently, core state is only managed at the whole-core level even when the system is in split-core mode. This just limits the number of free or "available" cores in the host to perform any host-side operations.
The kvmppc_host_rm_core.rm_data allows any data to be passed by KVM in real mode to the host core along with the operation to be performed.
The kvmppc_host_rm_ops structure is allocated the very first time a guest VM is started. Initial core state is also set - all online cores are in the host. This structure is never deleted, not even when there are no active guests. However, it needs to be freed when the module is unloaded because the kvmppc_host_rm_ops_hv can contain function pointers to kvm-hv.ko functions for the different supported host operations.
--- arch/powerpc/include/asm/kvm_ppc.h | 31 ++++++++++++++++ arch/powerpc/kvm/book3s_hv.c | 70 ++++++++++++++++++++++++++++++++++++ arch/powerpc/kvm/book3s_hv_builtin.c | 3 ++ 3 files changed, 104 insertions(+)
arch/powerpc/include/asm/kvm_ppc.h +31 -0
@@ -437,6 +437,8 @@ static inline int kvmppc_xics_enabled(struct kvm_vcpu *vcpu) {return vcpu->arch.irq_type ==KVMPPC_IRQ_XICS ; } +extern void kvmppc_alloc_host_rm_ops (void ); +extern void kvmppc_free_host_rm_ops (void );extern void kvmppc_xics_free_icp (struct kvm_vcpu *vcpu);extern int kvmppc_xics_create_icp (struct kvm_vcpu *vcpu,unsigned long server);extern int kvm_vm_ioctl_xics_irq (struct kvm *kvm,struct kvm_irq_level *args);
@@ -446,6 +448,8 @@ extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval);extern int kvmppc_xics_connect_vcpu (struct kvm_device *dev,struct kvm_vcpu *vcpu,u32 cpu);#else +static inline void kvmppc_alloc_host_rm_ops (void ) {}; +static inline void kvmppc_free_host_rm_ops (void ) {};static inline int kvmppc_xics_enabled (struct kvm_vcpu *vcpu) {return 0 ; }static inline void kvmppc_xics_free_icp (struct kvm_vcpu *vcpu) { }
@@ -459,6 +463,33 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) {return 0 ; }#endif +/* +* Host-side operations we want to set up while running in real +* mode in the guest operating on the xics. +* Currently only VCPU wakeup is supported. +*/ + +union kvmppc_rm_state { +unsigned long raw; +struct { +u32 in_host; +u32 rm_action; + }; +}; + +struct kvmppc_host_rm_core { +union kvmppc_rm_state rm_state; +void *rm_data; +char pad[112 ]; +}; + +struct kvmppc_host_rm_ops { +struct kvmppc_host_rm_core *rm_core; +void (*vcpu_kick)(struct kvm_vcpu *vcpu); +}; + +extern struct kvmppc_host_rm_ops *kvmppc_host_rm_ops_hv; +static inline unsigned long kvmppc_get_epr (struct kvm_vcpu *vcpu) {#ifdef CONFIG_KVM_BOOKE_HV
arch/powerpc/kvm/book3s_hv.c +70 -0
88 lines not on this page · raw message
arch/powerpc/kvm/book3s_hv_builtin.c +3 -0
@@ -283,3 +283,6 @@ void kvmhv_commence_exit(int trap)kvmhv_interrupt_vcore (vc, ee); } } + +struct kvmppc_host_rm_ops *kvmppc_host_rm_ops_hv; +EXPORT_SYMBOL_GPL (kvmppc_host_rm_ops_hv);
Signature · 1 line
1.8.3.4
PATCH 2/6 KVM: PPC: Book3S HV: Manage core host state
In reply to Suresh WarrierUpdate the core host state in kvmppc_host_rm_ops whenever the primary thread of the core enters the guest or returns back.
--- arch/powerpc/kvm/book3s_hv.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
arch/powerpc/kvm/book3s_hv.c +44 -0
@@ -2261,6 +2261,46 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master) }/* +* Clear core from the list of active host cores as we are about to +* enter the guest. Only do this if it is the primary thread of the +* core (not if a subcore) that is entering the guest. +*/ +static inline void kvmppc_clear_host_core (int cpu) +{ +int core; + +if (!kvmppc_host_rm_ops_hv ||cpu_thread_in_core (cpu)) +return ; +/* +* Memory barrier can be omitted here as we will do a smp_wmb() +* later in kvmppc_start_thread and we need ensure that state is +* visible to other CPUs only after we enter guest. +*/ + core = cpu >> threads_shift; + kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host =0 ; +} + +/* +* Advertise this core as an active host core since we exited the guest +* Only need to do this if it is the primary thread of the core that is +* exiting. +*/ +static inline void kvmppc_set_host_core (int cpu) +{ +int core; + +if (!kvmppc_host_rm_ops_hv ||cpu_thread_in_core (cpu)) +return ; + +/* +* Memory barrier can be omitted here because we do a spin_unlock +* immediately after this which provides the memory barrier. +*/ + core = cpu >> threads_shift; + kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host =1 ; +} + +/* * Run a set of guest threads on a physical core. * Called with vc->lock held. */
@@ -2372,6 +2412,8 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) } } +kvmppc_clear_host_core (pcpu); +/* Start all the threads */ active =0 ;for (sub =0 ; sub < core_info.n_subcores; ++sub) {
@@ -2468,6 +2510,8 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)kvmppc_ipi_thread (pcpu + i); } +kvmppc_set_host_core (pcpu); +spin_unlock (&vc->lock);/* make sure updates to secondary vcpu structs are visible now */
Signature · 1 line
1.8.3.4
PATCH 3/6 KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs
In reply to Suresh WarrierThe kvmppc_host_rm_ops structure keeps track of which cores are are in the host by maintaining a bitmask of active/runnable online CPUs that have not entered the guest. This patch adds support to manage the bitmask when a CPU is offlined or onlined in the host.
--- arch/powerpc/kvm/book3s_hv.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
arch/powerpc/kvm/book3s_hv.c +39 -0
@@ -3012,6 +3012,36 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) }#ifdef CONFIG_KVM_XICS +static int kvmppc_cpu_notify (struct notifier_block *self,unsigned long action, +void *hcpu) +{ +unsigned long cpu = (long )hcpu; + +switch (action) { +case CPU_UP_PREPARE : +case CPU_UP_PREPARE_FROZEN : +kvmppc_set_host_core (cpu); +break ; + +#ifdef CONFIG_HOTPLUG_CPU +case CPU_DEAD : +case CPU_DEAD_FROZEN : +case CPU_UP_CANCELED : +case CPU_UP_CANCELED_FROZEN : +kvmppc_clear_host_core (cpu); +break ; +#endif +default : +break ; + } + +return NOTIFY_OK ; +} + +static struct notifier_block kvmppc_cpu_notifier = { + .notifier_call = kvmppc_cpu_notify, +}; +/* * Allocate a per-core structure for managing state about which cores are * running in the host versus the guest and for exchanging data between
@@ -3045,6 +3075,8 @@ void kvmppc_alloc_host_rm_ops(void)return ; } +get_online_cpus (); +for (cpu =0 ; cpu < nr_cpu_ids; cpu += threads_per_core) {if (!cpu_online (cpu))continue ;
@@ -3063,14 +3095,21 @@ void kvmppc_alloc_host_rm_ops(void) l_ops = (unsigned long ) ops;if (cmpxchg64 ((unsigned long *)&kvmppc_host_rm_ops_hv,0 , l_ops)) { +put_online_cpus ();kfree (ops->rm_core);kfree (ops); +return ; } + +register_cpu_notifier (&kvmppc_cpu_notifier); + +put_online_cpus (); }void kvmppc_free_host_rm_ops (void ) {if (kvmppc_host_rm_ops_hv) { +unregister_cpu_notifier (&kvmppc_cpu_notifier);kfree (kvmppc_host_rm_ops_hv->rm_core);kfree (kvmppc_host_rm_ops_hv); kvmppc_host_rm_ops_hv =NULL ;
Signature · 1 line
1.8.3.4
PATCH 4/6 KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM
In reply to Suresh WarrierThis patch adds the support for the kick VCPU operation for kvmppc_host_rm_ops. The kvmppc_xics_ipi_action() function provides the function to be invoked for a host side operation when poked by the real mode KVM. This is initiated by KVM by sending an IPI to any free host core.
KVM real mode must set the rm_action to XICS_RM_KICK_VCPU and rm_data to point to the VCPU to be woken up before sending the IPI. Note that we have allocated one kvmppc_host_rm_core structure per core. The above values need to be set in the structure corresponding to the core to which the IPI will be sent.
--- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 2 ++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+)
arch/powerpc/include/asm/kvm_ppc.h +1 -0
@@ -447,6 +447,7 @@ extern u64 kvmppc_xics_get_icp(struct kvm_vcpu *vcpu);extern int kvmppc_xics_set_icp (struct kvm_vcpu *vcpu,u64 icpval);extern int kvmppc_xics_connect_vcpu (struct kvm_device *dev,struct kvm_vcpu *vcpu,u32 cpu); +extern void kvmppc_xics_ipi_action (void );#else static inline void kvmppc_alloc_host_rm_ops (void ) {};static inline void kvmppc_free_host_rm_ops (void ) {};
arch/powerpc/kvm/book3s_hv.c +2 -0
@@ -3085,6 +3085,8 @@ void kvmppc_alloc_host_rm_ops(void) ops->rm_core[core].rm_state.in_host =1 ; } + ops->vcpu_kick = kvmppc_fast_vcpu_kick_hv; +/* * Make the contents of the kvmppc_host_rm_ops structure visible * to other CPUs before we assign it to the global variable.
arch/powerpc/kvm/book3s_hv_rm_xics.c +36 -0
@@ -17,6 +17,7 @@#include <asm/xics.h> #include <asm/debug.h> #include <asm/synch.h> +#include <asm/cputhreads.h> #include <asm/ppc-opcode.h> #include "book3s_xics.h"
@@ -623,3 +624,38 @@ int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr) bail:return check_too_hard (xics, icp); } + +/* --- Non-real mode XICS-related built-in routines --- */ + +/** +* Host Operations poked by RM KVM +*/ +static void rm_host_ipi_action (int action,void *data) +{ +switch (action) { +case XICS_RM_KICK_VCPU : + kvmppc_host_rm_ops_hv->vcpu_kick (data); +break ; +default : +WARN (1 ,"Unexpected rm_action=%d data=%p\n" , action, data); +break ; + } + +} + +void kvmppc_xics_ipi_action (void ) +{ +int core; +unsigned int cpu =smp_processor_id (); +struct kvmppc_host_rm_core *rm_corep; + + core = cpu >> threads_shift; + rm_corep = &kvmppc_host_rm_ops_hv->rm_core[core]; + +if (rm_corep->rm_data) { +rm_host_ipi_action (rm_corep->rm_state.rm_action, + rm_corep->rm_data); + rm_corep->rm_data =NULL ; + rm_corep->rm_state.rm_action =0 ; + } +}
Signature · 1 line
1.8.3.4
PATCH 5/6 KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
In reply to Suresh WarrierThis patch adds support to real-mode KVM to search for a core running in the host partition and send it an IPI message with VCPU to be woken. This avoids having to switch to the host partition to complete an H_IPI hypercall when the VCPU which is the target of the the H_IPI is not loaded (is not running in the guest).
The patch also includes the support in the IPI handler running in the host to do the wakeup by calling kvmppc_xics_ipi_action for the PPC_MSG_RM_HOST_ACTION message.
When a guest is being destroyed, we need to ensure that there are no pending IPIs waiting to wake up a VCPU before we free the VCPUs of the guest. This is accomplished by:
- Forces a PPC_MSG_CALL_FUNCTION IPI to be completed by all CPUs before freeing any VCPUs in kvm_arch_destroy_vm()
- Any PPC_MSG_RM_HOST_ACTION messages must be executed first before any other PPC_MSG_CALL_FUNCTION messages
--- arch/powerpc/kernel/smp.c | 11 +++++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 81 ++++++++++++++++++++++++++++++++++-- arch/powerpc/kvm/powerpc.c | 10 +++++ 3 files changed, 99 insertions(+), 3 deletions(-)
arch/powerpc/kernel/smp.c +11 -0
@@ -280,6 +280,17 @@ irqreturn_t smp_ipi_demux(void) do { all = xchg(&info->messages, 0); +#if defined(CONFIG_KVM_XICS) && defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE) + /* + * Must check for PPC_MSG_RM_HOST_ACTION messages + * before PPC_MSG_CALL_FUNCTION messages because when + * a VM is destroyed, we call kick_all_cpus_sync() + * to ensure that any pending PPC_MSG_RM_HOST_ACTION + * messages have completed before we free any VCPUs. + */ + if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION)) + kvmppc_xics_ipi_action(); +#endif if (all & IPI_MESSAGE(PPC_MSG_CALL_FUNCTION)) generic_smp_call_function_interrupt(); if (all & IPI_MESSAGE(PPC_MSG_RESCHEDULE))
arch/powerpc/kvm/book3s_hv_rm_xics.c +78 -3
107 lines not on this page · raw message
arch/powerpc/kvm/powerpc.c +10 -0
@@ -437,6 +437,16 @@ void kvm_arch_destroy_vm(struct kvm *kvm)unsigned int i;struct kvm_vcpu *vcpu; +#ifdef CONFIG_KVM_XICS +/* +* We call kick_all_cpus_sync() to ensure that all +* CPUs have executed any pending IPIs before we +* continue and free VCPUs structures below. +*/ +if (is_kvmppc_hv_enabled (kvm)) +kick_all_cpus_sync (); +#endif +kvm_for_each_vcpu (i, vcpu, kvm)kvm_arch_vcpu_free (vcpu);
Signature · 1 line
1.8.3.4
kbuild test robot
build botRe: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Suresh,
[auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329 config: powerpc-defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
>> arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
smp_muxed_ipi_rm_message_pass(hcpu,
^
arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
PPC_MSG_RM_HOST_ACTION);
^ arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
vim +/smp_muxed_ipi_rm_message_pass +142 arch/powerpc/kvm/book3s_hv_rm_xics.c
136 hcore = -1;
137 if (kvmppc_host_rm_ops_hv)
138 hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
139 if (hcore != -1) {
140 hcpu = hcore << threads_shift;
141 kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;
> 142 smp_muxed_ipi_rm_message_pass(hcpu,
143 PPC_MSG_RM_HOST_ACTION);
144 } else {
145 this_icp->rm_action |= XICS_RM_KICK_VCPU;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
This patch set depends upon a previous patch set that I had submitted to linux-ppc. The URL for that is:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-October/135794.html
-suresh
Quoted 41 lines · kbuild test robot
Hi Suresh,
[auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329 config: powerpc-defconfig (attached as .config)reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpcAll errors (new ones prefixed by >>):
arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':Quoted 1 line
Quoted 1 line
arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]smp_muxed_ipi_rm_message_pass(hcpu, ^ arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function) PPC_MSG_RM_HOST_ACTION); ^
arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errorsvim +/smp_muxed_ipi_rm_message_pass +142
arch/powerpc/kvm/book3s_hv_rm_xics.c136 hcore = -1; 137 if (kvmppc_host_rm_ops_hv) 138 hcore = find_available_hostcore(XICS_RM_KICK_VCPU); 139 if (hcore != -1) { 140 hcpu = hcore << threads_shift; 141 kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;Quoted 1 line
142 smp_muxed_ipi_rm_message_pass(hcpu,
143 PPC_MSG_RM_HOST_ACTION); 144 } else { 145 this_icp->rm_action |= XICS_RM_KICK_VCPU;---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Fengguang Wu
build botRe: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
Sorry for the noise!
Hi Suresh,
Sorry for the noise!
Do you have a git tree that the robot can monitor and test?
In this case of one patchset depending on another, there is no chance for the robot to do valid testing based on emailed patches.
Thanks,
Fengguang
On Fri, Oct 30, 2015 at 10:16:06AM -0500, Suresh E. Warrier wrote:
> This patch set depends upon a previous patch set that I had submitted to > linux-ppc. The URL for that is: > > https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-October/135794.html > > -suresh > > On 10/29/2015 11:52 PM, kbuild test robot wrote: > > Hi Suresh, > > > > [auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] > > > > url: https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329 > > config: powerpc-defconfig (attached as .config) > > reproduce: > > wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # save the attached .config to linux build tree > > make.cross ARCH=powerpc > > > > All errors (new ones prefixed by >>): > > > > arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq': > >>> arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration] > > smp_muxed_ipi_rm_message_pass(hcpu, > > ^ > > arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function) > > PPC_MSG_RM_HOST_ACTION); > > ^ > > arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in > > cc1: all warnings being treated as errors > > > > vim +/smp_muxed_ipi_rm_message_pass +142 arch/powerpc/kvm/book3s_hv_rm_xics.c > > > > 136 hcore = -1; > > 137 if (kvmppc_host_rm_ops_hv) > > 138 hcore = find_available_hostcore(XICS_RM_KICK_VCPU); > > 139 if (hcore != -1) { > > 140 hcpu = hcore << threads_shift; > > 141 kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu; > > > 142 smp_muxed_ipi_rm_message_pass(hcpu, > > 143 PPC_MSG_RM_HOST_ACTION); > > 144 } else { > > 145 this_icp->rm_action |= XICS_RM_KICK_VCPU; > > > > --- > > 0-DAY kernel test infrastructure Open Source Technology Center > > https://lists.01.org/pipermail/kbuild-all Intel Corporation > > > > _______________________________________________ > kbuild-all mailing list > [email protected] > https://lists.01.org/mailman/listinfo/kbuild-all
Re: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
Hi Fengguang,
I understand the problem.
I will send you the URL for the powerpc git tree once my patches are pulled in so that we can then pass that to the robot.
Thanks.
-suresh
Quoted 68 lines · Fengguang Wu
Hi Suresh,
Sorry for the noise!
Do you have a git tree that the robot can monitor and test?
In this case of one patchset depending on another, there is no chance for the robot to do valid testing based on emailed patches.
Thanks,
FengguangQuoted 54 lines · Suresh E. Warrier
This patch set depends upon a previous patch set that I had submitted to linux-ppc. The URL for that is:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-October/135794.html
-suresh
Quoted 32 lines · kbuild test robot
Hi Suresh,
[auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329 config: powerpc-defconfig (attached as .config)reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpcAll errors (new ones prefixed by >>):
arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':Quoted 1 line
Quoted 1 line
arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]smp_muxed_ipi_rm_message_pass(hcpu, ^ arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function) PPC_MSG_RM_HOST_ACTION); ^
arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errorsvim +/smp_muxed_ipi_rm_message_pass +142
arch/powerpc/kvm/book3s_hv_rm_xics.c136 hcore = -1; 137 if (kvmppc_host_rm_ops_hv) 138 hcore = find_available_hostcore(XICS_RM_KICK_VCPU); 139 if (hcore != -1) { 140 hcpu = hcore << threads_shift; 141 kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;Quoted 9 lines
Quoted 1 line
142 smp_muxed_ipi_rm_message_pass(hcpu,
143 PPC_MSG_RM_HOST_ACTION); 144 } else { 145 this_icp->rm_action |= XICS_RM_KICK_VCPU;---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation_______________________________________________
kbuild-all mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild-all
Michael Ellerman
reviewerRe: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
Quoted 6 lines · Suresh E. Warrier
Hi Fengguang,
I understand the problem.
I will send you the URL for the powerpc git tree once my patches are pulled in so that we can then pass that to the robot.
The robot already knows about the powerpc next tree.
It chose the KVM tree because of your subject line.
Sending a series to one tree (KVM) that depends on a series in another tree (powerpc) is always problematic, even for humans, so the robot is not really at fault here.
cheers
kbuild test robot
build botRe: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
In reply to Suresh Warrierreproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Suresh,
[auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329 config: powerpc-defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
arch/powerpc/kernel/smp.c: In function 'smp_ipi_demux':
>> arch/powerpc/kernel/smp.c:261:25: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
^
arch/powerpc/kernel/smp.c:239:41: note: in definition of macro 'IPI_MESSAGE'
#define IPI_MESSAGE(A) (1 << (24 - 8 * (A)))
^
arch/powerpc/kernel/smp.c:261:25: note: each undeclared identifier is reported only once for each function it appears in
if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
^
arch/powerpc/kernel/smp.c:239:41: note: in definition of macro 'IPI_MESSAGE'
#define IPI_MESSAGE(A) (1 << (24 - 8 * (A)))
^
--
arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
smp_muxed_ipi_rm_message_pass(hcpu,
^
>> arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
PPC_MSG_RM_HOST_ACTION);
^ arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
vim +/PPC_MSG_RM_HOST_ACTION +261 arch/powerpc/kernel/smp.c
255 * Must check for PPC_MSG_RM_HOST_ACTION messages
256 * before PPC_MSG_CALL_FUNCTION messages because when
257 * a VM is destroyed, we call kick_all_cpus_sync()
258 * to ensure that any pending PPC_MSG_RM_HOST_ACTION
259 * messages have completed before we free any VCPUs.
260 */
> 261 if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
262 kvmppc_xics_ipi_action();
263 #endif
264 if (all & IPI_MESSAGE(PPC_MSG_CALL_FUNCTION))
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 6/6 KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection
In reply to Suresh WarrierRedirecting the wakeup of a VCPU from the H_IPI hypercall to a core running in the host is usually a good idea, most workloads seemed to benefit. However, in one heavily interrupt-driven SMT1 workload, some regression was observed. This patch adds a kvm_hv module parameter called h_ipi_redirect to control this feature.
The default value for this tunable is 1 - that is enable the feature.
--- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 11 +++++++++++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/kvm_ppc.h +1 -0
@@ -448,6 +448,7 @@ extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval);extern int kvmppc_xics_connect_vcpu (struct kvm_device *dev,struct kvm_vcpu *vcpu,u32 cpu);extern void kvmppc_xics_ipi_action (void ); +extern int h_ipi_redirect;#else static inline void kvmppc_alloc_host_rm_ops (void ) {};static inline void kvmppc_free_host_rm_ops (void ) {};
arch/powerpc/kvm/book3s_hv.c +11 -0
@@ -81,6 +81,17 @@ static int target_smt_mode;module_param (target_smt_mode, int,S_IRUGO |S_IWUSR );MODULE_PARM_DESC (target_smt_mode,"Target threads per core (0 = max)" ); +#ifdef CONFIG_KVM_XICS +static struct kernel_param_ops module_param_ops = { + .set = param_set_int, + .get = param_get_int, +}; + +module_param_cb (h_ipi_redirect, &module_param_ops, &h_ipi_redirect, +S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (h_ipi_redirect,"Redirect H_IPI wakeup to a free host core" ); +#endif +static void kvmppc_end_cede (struct kvm_vcpu *vcpu);static int kvmppc_hv_setup_htab_rma (struct kvm_vcpu *vcpu);
arch/powerpc/kvm/book3s_hv_rm_xics.c +4 -1
@@ -24,6 +24,9 @@#define DEBUG_PASSUP +int h_ipi_redirect =1 ; +EXPORT_SYMBOL (h_ipi_redirect); +static void icp_rm_deliver_irq (struct kvmppc_xics *xics,struct kvmppc_icp *icp,u32 new_irq);
@@ -134,7 +137,7 @@ static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu, cpu = vcpu->arch.thread_cpu;if (cpu <0 || cpu >= nr_cpu_ids) { hcore =-1 ; -if (kvmppc_host_rm_ops_hv) +if (kvmppc_host_rm_ops_hv && h_ipi_redirect) hcore =find_available_hostcore (XICS_RM_KICK_VCPU );if (hcore !=-1 ) { hcpu = hcore << threads_shift;
Signature · 1 line
1.8.3.4