From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQ7QR-0001vr-VN for qemu-devel@nongnu.org; Fri, 14 Aug 2015 01:21:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQ7QO-0001xa-SK for qemu-devel@nongnu.org; Fri, 14 Aug 2015 01:21:07 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:36245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQ7QO-0001vy-84 for qemu-devel@nongnu.org; Fri, 14 Aug 2015 01:21:04 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Aug 2015 10:51:00 +0530 Date: Fri, 14 Aug 2015 10:50:55 +0530 From: Bharata B Rao Message-ID: <20150814052055.GF4587@in.ibm.com> References: <1439470382-17540-1-git-send-email-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1439470382-17540-1-git-send-email-lvivier@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC] pseries: define coldplugged devices as "configured" Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: Michael Roth , dgibson@redhat.com, qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org On Thu, Aug 13, 2015 at 02:53:02PM +0200, Laurent Vivier wrote: > When a device is hotplugged, attach() sets "configured" to > false, waiting an action from the OS to configure it and then > to call ibm,configure-connector. On ibm,configure-connector, > the hypervisor sets "configured" to true. > > In case of coldplugged device, attach() sets "configured" to > false, but firmware and OS never call the ibm,configure-connector > in this case, so it remains set to false. > > It could be harmless, but when we unplug a device, hypervisor > waits the device becomes configured because for it, a not configured > device is a device being configured, so it waits the end of configuration > to unplug it... and it never happens, so it is never unplugged. Not true for at least logical DR device like CPU. I am able to cleanly unplug a cold plugged CPU in the patchset I posted at: https://lists.gnu.org/archive/html/qemu-ppc/2015-08/msg00041.html And this is how the state transitions work for cold plugged CPU devices: - Cold plugged CPU DRC is explicitly set with allocation_state=USABLE and isolation_state=UNISOLATED. - device_del results in drck->detach() that just returns by setting drc->awaiting_release to true. - Unplug notification is sent to guest. - Guest comes back with set_indicator RTAS call for setting isolation_state to ISOLATED. set_isolation_state() sets drc->configured to false. - Guest comes back again with set_indicator RTAS call for setting allocation state to UNUSABLE. set_allocation_state() finalizes the device removal by calling drck->detach() - drck->detach() now calls drc->detach_cb() that truly releases the CPU resource by getting rid of vCPU thread in QEMU. Regards, Bharata.