All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Igor Mammedov <imammedo@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 1/5] pc-dimm: Drop @errp argument of pc_dimm_plug()
Date: Sun, 25 Oct 2020 22:31:48 +0100	[thread overview]
Message-ID: <20201025223148.2822fcf9@bahia.lan> (raw)
In-Reply-To: <20201023211919.77377cb9@redhat.com>

On Fri, 23 Oct 2020 21:19:19 +0200
Igor Mammedov <imammedo@redhat.com> wrote:

> On Mon, 19 Oct 2020 10:48:04 +0200
> Greg Kurz <groug@kaod.org> wrote:
> 
> > pc_dimm_plug() doesn't use it. It only aborts on error.
> > 
> > Drop @errp and adapt the callers accordingly.
> > 
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> 
> arguably the same should be done in spapr.
> 

As explained in another mail, we have to keep spapr_drc_attach()
at plug time and this can legitimately fail if an unplug operation
is pending for the device. We certainly prefer to report this as
an error rather than aborting.

> > ---
> >  hw/arm/virt.c            |    9 +--------
> >  hw/i386/pc.c             |    8 +-------
> >  hw/mem/pc-dimm.c         |    2 +-
> >  hw/ppc/spapr.c           |    5 +----
> >  include/hw/mem/pc-dimm.h |    2 +-
> >  5 files changed, 5 insertions(+), 21 deletions(-)
> > 
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index e465a988d683..27dbeb549ef1 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -2261,12 +2261,8 @@ static void virt_memory_plug(HotplugHandler *hotplug_dev,
> >      VirtMachineState *vms = VIRT_MACHINE(hotplug_dev);
> >      MachineState *ms = MACHINE(hotplug_dev);
> >      bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
> > -    Error *local_err = NULL;
> >  
> > -    pc_dimm_plug(PC_DIMM(dev), MACHINE(vms), &local_err);
> > -    if (local_err) {
> > -        goto out;
> > -    }
> > +    pc_dimm_plug(PC_DIMM(dev), MACHINE(vms));
> >  
> >      if (is_nvdimm) {
> >          nvdimm_plug(ms->nvdimms_state);
> > @@ -2274,9 +2270,6 @@ static void virt_memory_plug(HotplugHandler *hotplug_dev,
> >  
> >      hotplug_handler_plug(HOTPLUG_HANDLER(vms->acpi_dev),
> >                           dev, &error_abort);
> > -
> > -out:
> > -    error_propagate(errp, local_err);
> >  }
> >  
> >  static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index e87be5d29a01..38b1be78e707 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1265,24 +1265,18 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
> >  static void pc_memory_plug(HotplugHandler *hotplug_dev,
> >                             DeviceState *dev, Error **errp)
> >  {
> > -    Error *local_err = NULL;
> >      PCMachineState *pcms = PC_MACHINE(hotplug_dev);
> >      X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
> >      MachineState *ms = MACHINE(hotplug_dev);
> >      bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
> >  
> > -    pc_dimm_plug(PC_DIMM(dev), MACHINE(pcms), &local_err);
> > -    if (local_err) {
> > -        goto out;
> > -    }
> > +    pc_dimm_plug(PC_DIMM(dev), MACHINE(pcms));
> >  
> >      if (is_nvdimm) {
> >          nvdimm_plug(ms->nvdimms_state);
> >      }
> >  
> >      hotplug_handler_plug(x86ms->acpi_dev, dev, &error_abort);
> > -out:
> > -    error_propagate(errp, local_err);
> >  }
> >  
> >  static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
> > diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> > index c30351070bb8..2ffc986734df 100644
> > --- a/hw/mem/pc-dimm.c
> > +++ b/hw/mem/pc-dimm.c
> > @@ -64,7 +64,7 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
> >                             errp);
> >  }
> >  
> > -void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp)
> > +void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine)
> >  {
> >      PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
> >      MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm,
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index ee716a12af73..4edd31b86915 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -3438,10 +3438,7 @@ static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
> >  
> >      size = memory_device_get_region_size(MEMORY_DEVICE(dev), &error_abort);
> >  
> > -    pc_dimm_plug(dimm, MACHINE(ms), &local_err);
> > -    if (local_err) {
> > -        goto out;
> > -    }
> > +    pc_dimm_plug(dimm, MACHINE(ms));
> >  
> >      if (!is_nvdimm) {
> >          addr = object_property_get_uint(OBJECT(dimm),
> > diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
> > index aec9527fdd96..3d3db82641f8 100644
> > --- a/include/hw/mem/pc-dimm.h
> > +++ b/include/hw/mem/pc-dimm.h
> > @@ -72,6 +72,6 @@ struct PCDIMMDeviceClass {
> >  
> >  void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
> >                        const uint64_t *legacy_align, Error **errp);
> > -void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp);
> > +void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine);
> >  void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine);
> >  #endif
> > 
> > 
> > 
> 
> 



  reply	other threads:[~2020-10-25 21:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  8:47 [PATCH 0/5] spapr: Error handling fixes and cleanups (round 3) Greg Kurz
2020-10-19  8:48 ` [PATCH 1/5] pc-dimm: Drop @errp argument of pc_dimm_plug() Greg Kurz
2020-10-21 14:29   ` Vladimir Sementsov-Ogievskiy
2020-10-22  4:06   ` David Gibson
2020-10-23 19:19   ` Igor Mammedov
2020-10-25 21:31     ` Greg Kurz [this message]
2020-10-19  8:48 ` [PATCH 2/5] spapr: Use appropriate getter for PC_DIMM_ADDR_PROP Greg Kurz
2020-10-19  9:05   ` Philippe Mathieu-Daudé
2020-10-22  4:07   ` David Gibson
2020-10-19  8:48 ` [PATCH 3/5] spapr: Use appropriate getter for PC_DIMM_SLOT_PROP Greg Kurz
2020-10-19  9:08   ` Philippe Mathieu-Daudé
2020-10-22  4:08   ` David Gibson
2020-10-19  8:48 ` [PATCH 4/5] spapr: Pass &error_abort when getting some PC DIMM properties Greg Kurz
2020-10-23 19:15   ` Igor Mammedov
2020-10-25 15:24     ` Greg Kurz
2020-10-27 11:54       ` Igor Mammedov
2020-10-27 15:18         ` Greg Kurz
2020-10-28 15:22           ` Igor Mammedov
2020-10-30 13:25             ` Greg Kurz
2020-11-02  0:57               ` David Gibson
2020-10-19  8:49 ` [PATCH 5/5] spapr: Simplify error handling in spapr_memory_plug() Greg Kurz
2020-10-19  9:10   ` Philippe Mathieu-Daudé
2020-10-23 19:17   ` Igor Mammedov
2020-10-22  4:11 ` [PATCH 0/5] spapr: Error handling fixes and cleanups (round 3) David Gibson
2020-10-25 10:13   ` Greg Kurz
2020-10-25 21:33     ` Greg Kurz
2020-10-26  5:44       ` 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=20201025223148.2822fcf9@bahia.lan \
    --to=groug@kaod.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=vsementsov@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.