From: Igor Mammedov <imammedo@redhat.com>
To: Tang Chen <tangchen@cn.fujitsu.com>
Cc: zhugh.fnst@cn.fujitsu.com, mst@redhat.com, hutao@cn.fujitsu.com,
qemu-devel@nongnu.org, isimatu.yasuaki@jp.fujitsu.com,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RESEND PATCH v3 6/8] acpi: Add hardware implementation for memory hot unplug.
Date: Tue, 16 Sep 2014 13:34:48 +0200 [thread overview]
Message-ID: <20140916133448.45f72dea@nial.usersys.redhat.com> (raw)
In-Reply-To: <54180CF2.3080405@cn.fujitsu.com>
On Tue, 16 Sep 2014 18:12:02 +0800
Tang Chen <tangchen@cn.fujitsu.com> wrote:
> Hi Igor,
>
> On 09/04/2014 10:20 PM, Igor Mammedov wrote:
>
> > ......
> > +
> > + acpi_handle_ost_event(mdev);
> > _OST is optional and OSPM doesn't have to call it at all,
> > it was already discussed on list and using _OST for device removal
> > was evaluated as not usable.
> > We use _OST here as supplementary status information for management tools
> > and no more /i.e. as LEDs on real hardware/.
> >
> > See "Figure 6-37 Device Ejection Flow Example Using _OST." in ACPI 5.1 spec
> > and note below it.
>
> OK, I agree we should not make memory hotplug process depend on _OST.
>
> But we do need to handle one problem: When guest OS failed to remove
> device,
> we should not clear QEmu data of that device.
>
> As you and ACPI spec said, Platform (which is QEmu here) should reply _OST
> rised by guest OS except things such as LEDs on real hardware. But _OST is
> the only way I can find to get status from guest OS.
>
> So, let's do it in the following way:
> 1. Make device hotplug process independent from _OST for the
> compatibility reason.
>
> 2. For OSPMs that support _OST, QEmu use _OST to catch error from guest OS.
> May be report an error message only, and stop QEmu from remove
> related data.
> (Please see/review patch-set:
> https://www.mail-archive.com/qemu-devel%40nongnu.org/msg253025.html)
>
> 3. For OSPMs that do not support _OST, do not handle guest OS error for now.
>
> How do you think ?
I'd keep _OST handling in ACPI write handler only for notification purposes
only. This way management tools/end user will see guest OS error if supported
, otherwise we do not care.
Make '_OST unplug handler' reset removing bit in case of error, so that guest
won't see DIMM stuck in continuous removing state when following hotplug events
happen.
>
> Thanks.
>
> >
> >
> >> break;
> >> - case 0x14:
> >> + case 0x14: /* set is_* fields */
> >> mdev = &mem_st->devs[mem_st->selector];
> >> +
> >> if (data & 2) { /* clear insert event */
> >> mdev->is_inserting = false;
> >> trace_mhp_acpi_clear_insert_evt(mem_st->selector);
> >> + } else if (data & 4) { /* request removal of device */
> >> + mdev->is_enabled = false;
> > device tear-down should be initiated here, when OSPM calls _EJ0 method
> > and when we return from this function it should be destroyed.
> >
> >> }
> >> +
> >> + break;
> >> + default:
> >> break;
> >> }
> >> -
> >> }
> >> static const MemoryRegionOps acpi_memory_hotplug_ops = {
> >> .read = acpi_memory_hotplug_read,
> >> @@ -198,6 +250,7 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> >> void acpi_memory_unplug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> >> DeviceState *dev, Error **errp)
> >> {
> >> + MemStatus *mdev;
> >> Error *local_err = NULL;
> >> int slot = object_property_get_int(OBJECT(dev), "slot", &local_err);
> >>
> >> @@ -215,6 +268,9 @@ void acpi_memory_unplug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> >> return;
> >> }
> >>
> >> + mdev = &mem_st->devs[slot];
> >> + mdev->is_removing = true;
> >> +
> >> /* do ACPI magic */
> >> ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
> >> acpi_update_sci(ar, irq);
> >> diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
> >> index 1f678b4..e105e45 100644
> >> --- a/include/hw/acpi/acpi.h
> >> +++ b/include/hw/acpi/acpi.h
> >> @@ -91,6 +91,20 @@
> >> /* PM2_CNT */
> >> #define ACPI_BITMASK_ARB_DISABLE 0x0001
> >>
> >> +/* OST_EVENT */
> >> +#define ACPI_NOTIFY_EJECT_REQUEST 0x03
> >> +#define ACPI_OSPM_EJECT 0x103
> >> +
> >> +/* OST_STATUS */
> >> +#define ACPI_SUCCESS 0x0
> >> +#define ACPI_FAILURE 0x1
> >> +#define ACPI_UNRECOGNIZED_NOTIFY 0x2
> >> +#define ACPI_EJECT_NOT_SUPPORTED 0x80
> >> +#define ACPI_EJECT_DEVICE_IN_USE 0x81
> >> +#define ACPI_EJECT_DEVICE_BUSY 0x82
> >> +#define ACPI_EJECT_DEPENDENCY_BUSY 0x83
> >> +#define ACPI_EJECT_IN_PROGRESS 0x84
> >> +
> >> /* structs */
> >> typedef struct ACPIPMTimer ACPIPMTimer;
> >> typedef struct ACPIPM1EVT ACPIPM1EVT;
> >> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
> >> index fc6b868..fe41268 100644
> >> --- a/include/hw/acpi/memory_hotplug.h
> >> +++ b/include/hw/acpi/memory_hotplug.h
> >> @@ -11,6 +11,7 @@ typedef struct MemStatus {
> >> DeviceState *dimm;
> >> bool is_enabled;
> >> bool is_inserting;
> >> + bool is_removing;
> >> uint32_t ost_event;
> >> uint32_t ost_status;
> >> } MemStatus;
> > .
> >
>
next prev parent reply other threads:[~2014-09-16 11:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 8:08 [Qemu-devel] [RESEND PATCH v3 0/8] QEmu memory hot unplug support Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 1/8] acpi, piix4: Add memory hot unplug support for piix4 Tang Chen
2014-09-04 12:15 ` Igor Mammedov
2014-09-16 3:17 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 2/8] acpi, ich9: Add memory hot unplug support for ich9 Tang Chen
2014-09-04 12:25 ` Igor Mammedov
2014-09-16 3:18 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 3/8] pc: Add memory hot unplug support for pc machine Tang Chen
2014-09-04 12:44 ` Igor Mammedov
2014-09-04 13:16 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 4/8] qdev: Add memory hot unplug support for bus-less devices Tang Chen
2014-09-04 13:22 ` Igor Mammedov
2014-09-16 8:42 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 5/8] pc-dimm: Add pc_dimm_unrealize() for memory hot unplug support Tang Chen
2014-09-04 13:28 ` Igor Mammedov
2014-09-12 5:30 ` zhanghailiang
2014-09-12 13:17 ` Igor Mammedov
2014-09-24 7:02 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 6/8] acpi: Add hardware implementation for memory hot unplug Tang Chen
2014-09-04 14:20 ` Igor Mammedov
2014-09-16 10:12 ` Tang Chen
2014-09-16 11:34 ` Igor Mammedov [this message]
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 7/8] pc, acpi bios: Add memory hot unplug interface Tang Chen
2014-09-04 13:53 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 8/8] monitor: Add memory hot unplug support for device_del command Tang Chen
2014-09-04 14:02 ` Igor Mammedov
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=20140916133448.45f72dea@nial.usersys.redhat.com \
--to=imammedo@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tangchen@cn.fujitsu.com \
--cc=zhugh.fnst@cn.fujitsu.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).