From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YafRT-0000nN-Ge for qemu-devel@nongnu.org; Wed, 25 Mar 2015 03:09:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YafRR-0008RB-MC for qemu-devel@nongnu.org; Wed, 25 Mar 2015 03:09:31 -0400 Date: Wed, 25 Mar 2015 16:24:39 +1100 From: David Gibson Message-ID: <20150325052439.GB25043@voom.fritz.box> References: <1427117764-23008-1-git-send-email-bharata@linux.vnet.ibm.com> <1427117764-23008-18-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="c1ZK2iIXW32Oz72x" Content-Disposition: inline In-Reply-To: <1427117764-23008-18-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v2 17/23] xics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de --c1ZK2iIXW32Oz72x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 23, 2015 at 07:05:58PM +0530, Bharata B Rao wrote: > When supporting CPU hot removal by parking the vCPU fd and reusing > it during hotplug again, there can be cases where we try to reenable > KVM_CAP_IRQ_XICS CAP for the vCPU for which it was already enabled. > Introduce a boolean member in ICPState to track this and don't > reenable the CAP if it was already enabled earlier. >=20 > This change allows CPU hot removal to work for sPAPR. >=20 > Signed-off-by: Bharata B Rao Why does double enabling the capability cause problems? I would have expected it to be unnecessary, but harmless. > --- > hw/intc/xics_kvm.c | 10 ++++++++++ > include/hw/ppc/xics.h | 1 + > 2 files changed, 11 insertions(+) >=20 > diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c > index c15453f..5b27bf8 100644 > --- a/hw/intc/xics_kvm.c > +++ b/hw/intc/xics_kvm.c > @@ -331,6 +331,15 @@ static void xics_kvm_cpu_setup(XICSState *icp, Power= PCCPU *cpu) > abort(); > } > =20 > + /* > + * If we are reusing a parked vCPU fd corresponding to the CPU > + * which was hot-removed earlier we don't have to renable > + * KVM_CAP_IRQ_XICS capability again. > + */ > + if (ss->cap_irq_xics_enabled) { > + return; > + } > + > if (icpkvm->kernel_xics_fd !=3D -1) { > int ret; > =20 > @@ -343,6 +352,7 @@ static void xics_kvm_cpu_setup(XICSState *icp, PowerP= CCPU *cpu) > kvm_arch_vcpu_id(cs), strerror(errno)); > exit(1); > } > + ss->cap_irq_xics_enabled =3D true; > } > } > =20 > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index a214dd7..355a966 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -109,6 +109,7 @@ struct ICPState { > uint8_t pending_priority; > uint8_t mfrr; > qemu_irq output; > + bool cap_irq_xics_enabled; > }; > =20 > #define TYPE_ICS "ics" --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --c1ZK2iIXW32Oz72x Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVEkaWAAoJEGw4ysog2bOS+FcQAOWZQ+K9oNOO6fZa2YwQB5Nt i5hPBhkq3gR7w4eBirrG2r7X05MQ5WAjmZidzF5a93vez7JH7npIRkq8YpI5iCPX DRLFZXyqcy1TCKZlzHXkj8sNgXzK3FOJuR8oy6PuXnMIEyuj05YiNZ0Kmpt+Q3L1 cYXC0oQLqviy8MJekbO6rAjaoW8M1sskUbfQ36V4+UmZHQ6DhxTPpBUzOayqQJoD pvqr8ERn6sbkOzlVw6Sq2SjSK4b2y8QdxKeBkZ/xrTOlrMCERfGrUJTxBpl7yN3f te60uEBrzgu3rbq956UatQ6YLa+msv/n7PjQ42vFJVF9Xn71ECsXb1dAM/G1Ibfp OeYmBY6D7Rk9JwFEzVvC3cVwVJNesVZeR85+pr/yg1mDSnRlJPqDUvvGah7Lbsp3 bIWsiU5bxgpzMX+9fhmmC+TxPPsjyKNMFA+BmcS2Lun9v2rQoEPTV6pnb0f32lHG FAeMWbdbmswTUWwl6fUR12ap/H7OWjQKP4bx5EjdOVx7vZ0J6qAFRIxbb6QyplFL 1VXi17nDQbi+WXHMGrS+kcSS4ZrFnUzpJPO2Q6XH0erRh1swGhbStcI0qF0FQOci PaLfJIq0tC66DVTeTK3YjL9PO0o0/Pr1CX/0padKi/5lbS/XGknGe2uCVY4DtThE GIwgWNlQBVKiVbHcctcv =fOdd -----END PGP SIGNATURE----- --c1ZK2iIXW32Oz72x--