qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: mdroth@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com,
	sursingh@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/5] spapr: Use unplug_request for PCI hot unplug
Date: Mon, 3 Jul 2017 16:35:15 +1000	[thread overview]
Message-ID: <20170703063515.GR13989@umbus.fritz.box> (raw)
In-Reply-To: <20170621115008.350669a0@bahia.lab.toulouse-stg.fr.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3091 bytes --]

On Wed, Jun 21, 2017 at 11:50:08AM +0200, Greg Kurz wrote:
> On Tue, 20 Jun 2017 09:53:32 +0800
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > AIUI, ->unplug_request in the HotplugHandler is used for "soft"
> > unplug, where acknowledgement from the guest is required before
> > completing the unplug, whereas ->unplug is used for "hard" unplug
> > where qemu unilaterally removes the device, and the guest just has to
> > cope with its sudden absence.  For spapr we (correctly) use
> > ->unplug_request for CPU and memory hot unplug but we use ->unplug for  
> > PCI.
> > 
> > While I think it might be possible to support "hard" PCI unplug within
> > the PAPR model, that's not how it actually works now.  Although it's
> > called from ->unplug, the PCI unplug path will usually just mark the
> > device for removal, with completion of the unplug delayed until
> > userspace responds to the unplug notification. If the guest doesn't
> > respond as expected, that could delay the unplug completiong
> > arbitrarily long.
> > 
> > To reflect that, change the PCI unplug path to be called from
> > ->unplug_request.  
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  hw/ppc/spapr_pci.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> > index f2543ef..bda8938 100644
> > --- a/hw/ppc/spapr_pci.c
> > +++ b/hw/ppc/spapr_pci.c
> > @@ -1469,8 +1469,8 @@ out:
> >      }
> >  }
> >  
> > -static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
> > -                                       DeviceState *plugged_dev, Error **errp)
> > +static void spapr_pci_unplug_request(HotplugHandler *plug_handler,
> > +                                     DeviceState *plugged_dev, Error **errp)
> >  {
> >      sPAPRPHBState *phb = SPAPR_PCI_HOST_BRIDGE(DEVICE(plug_handler));
> >      PCIDevice *pdev = PCI_DEVICE(plugged_dev);
> > @@ -1485,6 +1485,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
> >      }
> >  
> >      g_assert(drc);
> > +    g_assert(drc->dev == plugged_dev);
> >  
> >      drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
> >      if (!drck->release_pending(drc)) {
> > @@ -1973,7 +1974,7 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data)
> >      dc->user_creatable = true;
> >      set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> >      hp->plug = spapr_phb_hot_plug_child;
> 
> Maybe you can rename spapr_phb_hot_plug_child() to spapr_pci_plug() for
> consistency ?

Good idea.  I've made that change.

> 
> Anyway,
> 
> Reviewed-by: Greg Kurz <groug@kaod.org>
> 
> > -    hp->unplug = spapr_phb_hot_unplug_child;
> > +    hp->unplug_request = spapr_pci_unplug_request;
> >  }
> >  
> >  static const TypeInfo spapr_phb_info = {
> 



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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-07-03  6:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  1:53 [Qemu-devel] [PATCH 0/5] spapr: DRC cleanups (part V) David Gibson
2017-06-20  1:53 ` [Qemu-devel] [PATCH 1/5] spapr: Leave DR-indicator management to the guest David Gibson
2017-06-20 16:05   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-06-20 16:12   ` [Qemu-devel] " Greg Kurz
2017-06-20  1:53 ` [Qemu-devel] [PATCH 2/5] spapr: Uniform DRC reset paths David Gibson
2017-06-20 16:32   ` Greg Kurz
2017-06-21  8:15     ` David Gibson
2017-06-20 19:12   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-06-20  1:53 ` [Qemu-devel] [PATCH 3/5] spapr: Add DRC release method David Gibson
2017-06-20 16:51   ` Greg Kurz
2017-06-20 19:24     ` Michael Roth
2017-06-21  8:18       ` David Gibson
2017-06-21  9:23       ` Greg Kurz
2017-06-20 19:14   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-06-20  1:53 ` [Qemu-devel] [PATCH 4/5] spapr: Remove unnecessary differences between hotplug and coldplug paths David Gibson
2017-06-20 19:16   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-06-21  9:38   ` [Qemu-devel] " Greg Kurz
2017-06-20  1:53 ` [Qemu-devel] [PATCH 5/5] spapr: Use unplug_request for PCI hot unplug David Gibson
2017-06-20 19:18   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-06-21  9:50   ` [Qemu-devel] " Greg Kurz
2017-07-03  6:35     ` David Gibson [this message]
2017-07-03  6:35 ` [Qemu-devel] [PATCH 0/5] spapr: DRC cleanups (part V) David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170703063515.GR13989@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=groug@kaod.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sursingh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).