From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YahMg-0008Cx-82 for qemu-devel@nongnu.org; Wed, 25 Mar 2015 05:12:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YahMc-0006bJ-7j for qemu-devel@nongnu.org; Wed, 25 Mar 2015 05:12:42 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:40546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YahMb-0006ad-K6 for qemu-devel@nongnu.org; Wed, 25 Mar 2015 05:12:38 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Mar 2015 14:42:34 +0530 Date: Wed, 25 Mar 2015 14:42:24 +0530 From: Bharata B Rao Message-ID: <20150325091224.GG32581@in.ibm.com> References: <1427117764-23008-1-git-send-email-bharata@linux.vnet.ibm.com> <1427117764-23008-18-git-send-email-bharata@linux.vnet.ibm.com> <20150325052439.GB25043@voom.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150325052439.GB25043@voom.fritz.box> Subject: Re: [Qemu-devel] [RFC PATCH v2 17/23] xics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson 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 On Wed, Mar 25, 2015 at 04:24:39PM +1100, David Gibson wrote: > 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. > > > > This change allows CPU hot removal to work for sPAPR. > > > > Signed-off-by: Bharata B Rao > > Why does double enabling the capability cause problems? I would have > expected it to be unnecessary, but harmless. We are reusing the vCPU here w/o closing its fd. As things stand currently, enabling this cap again will result in kernel trying to create and associate ICP with this vCPU and that fails since there is already an ICP associated with it. Ref: arch/powerpc/kvm/book3s_xics.c:kvmppc_xics_connect_vcpu() kernel code. So this patch will ensure that we don't renable this cap. Regards, Bharata.