[PATCH v2 0/2] spapr: Fix device unplug vs CAS or migration

Greg Kurz posted 2 patches 1 week ago
Test docker-quick@centos7 passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/158169247578.3465937.4013536808417411649.stgit@bahia.lan
Maintainers: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_drc.c         |   43 ++++++++++++++++++++++++++++++++++++-------
hw/ppc/spapr_hcall.c       |   14 +++++++++-----
include/hw/ppc/spapr_drc.h |    4 +++-
3 files changed, 48 insertions(+), 13 deletions(-)

[PATCH v2 0/2] spapr: Fix device unplug vs CAS or migration

Posted by Greg Kurz 1 week ago
While working on getting rid of CAS reboot, I realized that we currently
don't handle device hot unplug properly in the following situations:

1) if the device is unplugged between boot and CAS, SLOF doesn't handle
   the even, which is a known limitation. The device hence stays around
   forever (specifically, until some other event is emitted and the guest
   eventually completes the unplug or a reboot). Until we can teach SLOF
   to correctly process the full FDT at CAS, we should trigger a CAS reboot,
   like we already do for hotplug.

2) if the guest is migrated after the even was emitted but before the
   guest could process it, the destination is unaware of the pending
   unplug operation and doesn't remove the device when the guests
   releases it. The 'unplug_requested' field of the DRC is actually state
   that should be migrated.

Changes since v1:
   - new spapr_drc_transient() helper that covers pending plug and unplug
     situations for both CAS and migration
   - as a mechanical consequence, fix unplug for CAS an migration in the
     same patch

--
Greg

---

Greg Kurz (2):
      spapr: Don't use spapr_drc_needed() in CAS code
      spapr: Fix handling of unplugged devices during CAS and migration


 hw/ppc/spapr_drc.c         |   43 ++++++++++++++++++++++++++++++++++++-------
 hw/ppc/spapr_hcall.c       |   14 +++++++++-----
 include/hw/ppc/spapr_drc.h |    4 +++-
 3 files changed, 48 insertions(+), 13 deletions(-)


Re: [PATCH v2 0/2] spapr: Fix device unplug vs CAS or migration

Posted by David Gibson 6 days ago
On Fri, Feb 14, 2020 at 04:01:16PM +0100, Greg Kurz wrote:
> While working on getting rid of CAS reboot, I realized that we currently
> don't handle device hot unplug properly in the following situations:
> 
> 1) if the device is unplugged between boot and CAS, SLOF doesn't handle
>    the even, which is a known limitation. The device hence stays around
>    forever (specifically, until some other event is emitted and the guest
>    eventually completes the unplug or a reboot). Until we can teach SLOF
>    to correctly process the full FDT at CAS, we should trigger a CAS reboot,
>    like we already do for hotplug.
> 
> 2) if the guest is migrated after the even was emitted but before the
>    guest could process it, the destination is unaware of the pending
>    unplug operation and doesn't remove the device when the guests
>    releases it. The 'unplug_requested' field of the DRC is actually state
>    that should be migrated.
> 
> Changes since v1:
>    - new spapr_drc_transient() helper that covers pending plug and unplug
>      situations for both CAS and migration
>    - as a mechanical consequence, fix unplug for CAS an migration in the
>      same patch

Applied to ppc-for-5.0, thanks.

-- 
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