From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpXXS-0001dT-Cm for qemu-devel@nongnu.org; Tue, 05 May 2015 03:45:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpXXP-00031o-Ta for qemu-devel@nongnu.org; Tue, 05 May 2015 03:45:10 -0400 Date: Tue, 5 May 2015 17:22:52 +1000 From: David Gibson Message-ID: <20150505072252.GP14090@voom.redhat.com> References: <1429858066-12088-1-git-send-email-bharata@linux.vnet.ibm.com> <1429858066-12088-19-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xXygN3QAmJYWdGtb" Content-Disposition: inline In-Reply-To: <1429858066-12088-19-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v3 18/24] 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, aik@ozlabs.ru, 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 --xXygN3QAmJYWdGtb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 24, 2015 at 12:17:40PM +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 Do you actually need this? Is there any harm in setting the capability multiple times, or could you just ignore the "already set" error? > --- > 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 --xXygN3QAmJYWdGtb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVSG/MAAoJEGw4ysog2bOSB64QAL85YI4VGfHdB+++gE8pgN0E hU8cQYyNE7B6JeHnzD4hOU4hikPOjxqtoGmqDLj5SKRLOILn4RRNYFe8csTZQE2A No8wOsUyjvP54ek4Ps5/bZ4KRQOPQoQZxGDtOZQWhyvpxhhHtfcx7p+ZHiITYMR5 G5Bc/EXptG26qJxq9ifgMON8t+N3HTAk2QlUvYmNX34TLVRgoQ6iIDkF1Qhhm7Ab jC+2Z0HjG85GMo4NHR2OY+N9qvXRfZVsXZQeT3Kjisiysg4MelqDzYcaqepKvDsP 5Lwr7VoSvIqM6kRNr8aV4QVPCGWlU0UE31v/jVnhsL4mFzhlChrIz4HPuUFEncQu dRrnpLxLMDPWr3E2zCqPRjx23ubm8Ngy0UbXM3ENGyr4FdeuyAB+Q2WxgEFNb+b8 bymwZhLBg0HuMqvCvGSNjTATNCRN4bWlp9NoEVYQiJm1CSnhU69liWDoF6VgU4te u1kmvAbRudcmZVBVC2K4ipyn4H2pt1XptnQpUZda91YrscPnQosFhEs6hkcQgBeV KLJHsgGMhdFhnnkxyXT1J2mxUdcSD9OC3vv44CjnCw61ycp5e6CtsjlSpS/t2cwu AJPYTbNEXXWPYMDYxL6puGHIzycgPXkIpE+FvemDcaAneE4QYGb5b7IY00GOtrFO MRiiPTAv3RJbwnwfwG5s =ByzL -----END PGP SIGNATURE----- --xXygN3QAmJYWdGtb--