Re: [RFC v0 PATCH] kvm: powerpc: Allow reuse of vCPU object
Any feedback on the below patch ? On Mon, Mar 9, 2015 at 11:00 AM, wrote: > From: Bharata B Rao > > Since KVM isn't equipped to handle closure of vcpu fd from userspace(QEMU) > correctly, certain work arounds have to be employed to allow reuse of > vcpu array slot in KVM during cpu hot plug/unplug from guest. One such > proposed workaround is to park the vcpu fd in userspace during cpu unplug > and reuse it later during next hotplug. > > More details can be found here: > KVM: https://www.mail-archive.com/kvm@vger.kernel.org/msg102839.html > QEMU: http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg00859.html > > In order to support this workaround with PowerPC KVM, don't create or > initialize ICP if the vCPU is found to be already associated with an ICP. > > Signed-off-by: Bharata B Rao > --- > Note: It is not sure at the moment if "park vcpu and reuse" approach will > be acceptable to KVM/QEMU community, but nevertheless I wanted to check > if this little patch is harmful or not. > > arch/powerpc/kvm/book3s_xics.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c > index a4a8d9f..ead3a35 100644 > --- a/arch/powerpc/kvm/book3s_xics.c > +++ b/arch/powerpc/kvm/book3s_xics.c > @@ -1313,8 +1313,13 @@ int kvmppc_xics_connect_vcpu(struct kvm_device *dev, > struct kvm_vcpu *vcpu, > return -EPERM; > if (xics->kvm != vcpu->kvm) > return -EPERM; > - if (vcpu->arch.irq_type) > - return -EBUSY; > + > + /* > +* If irq_type is already set, don't reinialize but > +* return success allowing this vcpu to be reused. > +*/ > + if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT) > + return 0; > > r = kvmppc_xics_create_icp(vcpu, xcpu); > if (!r) > -- > 2.1.0 > -- http://raobharata.wordpress.com/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC v0 PATCH] kvm: powerpc: Allow reuse of vCPU object
Any feedback on the below patch ? On Mon, Mar 9, 2015 at 11:00 AM, bharata@gmail.com wrote: From: Bharata B Rao bhar...@linux.vnet.ibm.com Since KVM isn't equipped to handle closure of vcpu fd from userspace(QEMU) correctly, certain work arounds have to be employed to allow reuse of vcpu array slot in KVM during cpu hot plug/unplug from guest. One such proposed workaround is to park the vcpu fd in userspace during cpu unplug and reuse it later during next hotplug. More details can be found here: KVM: https://www.mail-archive.com/kvm@vger.kernel.org/msg102839.html QEMU: http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg00859.html In order to support this workaround with PowerPC KVM, don't create or initialize ICP if the vCPU is found to be already associated with an ICP. Signed-off-by: Bharata B Rao bhar...@linux.vnet.ibm.com --- Note: It is not sure at the moment if park vcpu and reuse approach will be acceptable to KVM/QEMU community, but nevertheless I wanted to check if this little patch is harmful or not. arch/powerpc/kvm/book3s_xics.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c index a4a8d9f..ead3a35 100644 --- a/arch/powerpc/kvm/book3s_xics.c +++ b/arch/powerpc/kvm/book3s_xics.c @@ -1313,8 +1313,13 @@ int kvmppc_xics_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, return -EPERM; if (xics-kvm != vcpu-kvm) return -EPERM; - if (vcpu-arch.irq_type) - return -EBUSY; + + /* +* If irq_type is already set, don't reinialize but +* return success allowing this vcpu to be reused. +*/ + if (vcpu-arch.irq_type != KVMPPC_IRQ_DEFAULT) + return 0; r = kvmppc_xics_create_icp(vcpu, xcpu); if (!r) -- 2.1.0 -- http://raobharata.wordpress.com/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC v0 PATCH] kvm: powerpc: Allow reuse of vCPU object
From: Bharata B Rao Since KVM isn't equipped to handle closure of vcpu fd from userspace(QEMU) correctly, certain work arounds have to be employed to allow reuse of vcpu array slot in KVM during cpu hot plug/unplug from guest. One such proposed workaround is to park the vcpu fd in userspace during cpu unplug and reuse it later during next hotplug. More details can be found here: KVM: https://www.mail-archive.com/kvm@vger.kernel.org/msg102839.html QEMU: http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg00859.html In order to support this workaround with PowerPC KVM, don't create or initialize ICP if the vCPU is found to be already associated with an ICP. Signed-off-by: Bharata B Rao --- Note: It is not sure at the moment if "park vcpu and reuse" approach will be acceptable to KVM/QEMU community, but nevertheless I wanted to check if this little patch is harmful or not. arch/powerpc/kvm/book3s_xics.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c index a4a8d9f..ead3a35 100644 --- a/arch/powerpc/kvm/book3s_xics.c +++ b/arch/powerpc/kvm/book3s_xics.c @@ -1313,8 +1313,13 @@ int kvmppc_xics_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, return -EPERM; if (xics->kvm != vcpu->kvm) return -EPERM; - if (vcpu->arch.irq_type) - return -EBUSY; + + /* +* If irq_type is already set, don't reinialize but +* return success allowing this vcpu to be reused. +*/ + if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT) + return 0; r = kvmppc_xics_create_icp(vcpu, xcpu); if (!r) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC v0 PATCH] kvm: powerpc: Allow reuse of vCPU object
From: Bharata B Rao bhar...@linux.vnet.ibm.com Since KVM isn't equipped to handle closure of vcpu fd from userspace(QEMU) correctly, certain work arounds have to be employed to allow reuse of vcpu array slot in KVM during cpu hot plug/unplug from guest. One such proposed workaround is to park the vcpu fd in userspace during cpu unplug and reuse it later during next hotplug. More details can be found here: KVM: https://www.mail-archive.com/kvm@vger.kernel.org/msg102839.html QEMU: http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg00859.html In order to support this workaround with PowerPC KVM, don't create or initialize ICP if the vCPU is found to be already associated with an ICP. Signed-off-by: Bharata B Rao bhar...@linux.vnet.ibm.com --- Note: It is not sure at the moment if park vcpu and reuse approach will be acceptable to KVM/QEMU community, but nevertheless I wanted to check if this little patch is harmful or not. arch/powerpc/kvm/book3s_xics.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c index a4a8d9f..ead3a35 100644 --- a/arch/powerpc/kvm/book3s_xics.c +++ b/arch/powerpc/kvm/book3s_xics.c @@ -1313,8 +1313,13 @@ int kvmppc_xics_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu, return -EPERM; if (xics-kvm != vcpu-kvm) return -EPERM; - if (vcpu-arch.irq_type) - return -EBUSY; + + /* +* If irq_type is already set, don't reinialize but +* return success allowing this vcpu to be reused. +*/ + if (vcpu-arch.irq_type != KVMPPC_IRQ_DEFAULT) + return 0; r = kvmppc_xics_create_icp(vcpu, xcpu); if (!r) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/