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 On 11/01/2015 08:51 PM, Fengguang Wu wrote: > 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 infrastructureOpen Source Technology >>> Center >>> https://lists.01.org/pipermail/kbuild-all Intel >>> Corporation >>> >> >> ___ >> kbuild-all mailing list >> kbuild-...@lists.01.org >> https://lists.01.org/mailman/listinfo/kbuild-all > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
On Mon, 2015-11-02 at 16:10 -0600, Suresh E. Warrier wrote: > 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
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 infrastructureOpen Source Technology > > Center > > https://lists.01.org/pipermail/kbuild-all Intel > > Corporation > > > > ___ > kbuild-all mailing list > kbuild-...@lists.01.org > https://lists.01.org/mailman/listinfo/kbuild-all -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
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 infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
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 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 > >136hcore = -1; >137if (kvmppc_host_rm_ops_hv) >138hcore = > find_available_hostcore(XICS_RM_KICK_VCPU); >139if (hcore != -1) { >140hcpu = hcore << threads_shift; >141 > kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu; > > 142smp_muxed_ipi_rm_message_pass(hcpu, >143 > PPC_MSG_RM_HOST_ACTION); >144} else { >145this_icp->rm_action |= > XICS_RM_KICK_VCPU; > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
This 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 Signed-off-by: Suresh Warrier--- 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(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 8c07bfad..8958c2a 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -280,6 +280,17 @@ irqreturn_t smp_ipi_demux(void) do { all = xchg(>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)) diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c index 43ffbfe..b8d6403 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_xics.c +++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c @@ -51,11 +51,70 @@ static void ics_rm_check_resend(struct kvmppc_xics *xics, /* -- ICP routines -- */ +/* + * We start the search from our current CPU Id in the core map + * and go in a circle until we get back to our ID looking for a + * core that is running in host context and that hasn't already + * been targeted for another rm_host_ops. + * + * In the future, could consider using a fairer algorithm (one + * that distributes the IPIs better) + * + * Returns -1, if no CPU could be found in the host + * Else, returns a CPU Id which has been reserved for use + */ +static inline int grab_next_hostcore(int start, + struct kvmppc_host_rm_core *rm_core, int max, int action) +{ + bool success; + int core; + union kvmppc_rm_state old, new; + + for (core = start + 1; core < max; core++) { + old = new = READ_ONCE(rm_core[core].rm_state); + + if (!old.in_host || old.rm_action) + continue; + + /* Try to grab this host core if not taken already. */ + new.rm_action = action; + + success = cmpxchg64(_core[core].rm_state.raw, + old.raw, new.raw) == old.raw; + if (success) { + /* +* Make sure that the store to the rm_action is made +* visible before we return to caller (and the +* subsequent store to rm_data) to synchronize with +* the IPI handler. +*/ + smp_wmb(); + return core; + } + } + + return -1; +} + +static inline int find_available_hostcore(int action) +{ + int core; + int my_core = smp_processor_id() >> threads_shift; + struct kvmppc_host_rm_core *rm_core = kvmppc_host_rm_ops_hv->rm_core; + + core = grab_next_hostcore(my_core, rm_core, cpu_nr_cores(), action); + if (core == -1) + core = grab_next_hostcore(core, rm_core, my_core, action); + + return core; +} + static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu, struct kvm_vcpu *this_vcpu) { struct kvmppc_icp *this_icp = this_vcpu->arch.icp; int cpu; + int hcore, hcpu; /* Mark the target VCPU as having an interrupt pending */ vcpu->stat.queue_intr++; @@ -67,11 +126,25 @@ static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu, return; } -
Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
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 infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data