* [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path
@ 2017-06-09 15:16 Stefan Hajnoczi
2017-06-09 15:34 ` Eduardo Habkost
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-06-09 15:16 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Michael S. Tsirkin,
Richard Henderson, Stefan Hajnoczi, Haozhong Zhang
Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
nvdimm is enabled before plugging") introduced a check to reject nvdimm
hotplug if -machine pc,nvdimm=on was not given.
This check executes after pc_dimm_memory_plug() has already completed
and does not reverse the effect of this function in the case of failure.
Perform the check before calling pc_dimm_memory_plug(). This fixes the
following abort:
$ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
-object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
(qemu) device_add nvdimm,memdev=mem1
nvdimm is not enabled: missing 'nvdimm' in '-M'
(qemu) device_add nvdimm,memdev=mem1
Core dumped
The backtrace is:
#0 0x00007fffdb5b191f in raise () at /lib64/libc.so.6
#1 0x00007fffdb5b351a in abort () at /lib64/libc.so.6
#2 0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
#3 0x00007fffdb5a9e52 in () at /lib64/libc.so.6
#4 0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
#5 0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
#6 0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
at hw/mem/pc-dimm.c:110
#7 0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
#8 0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
#9 0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
Cc: Haozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/i386/pc.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5b8c6fb..db41cca 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1692,6 +1692,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
MemoryRegion *mr = ddc->get_memory_region(dimm);
uint64_t align = TARGET_PAGE_SIZE;
+ bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
if (memory_region_get_alignment(mr) && pcmc->enforce_aligned_dimm) {
align = memory_region_get_alignment(mr);
@@ -1703,17 +1704,18 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
goto out;
}
+ if (is_nvdimm && !pcms->acpi_nvdimm_state.is_enabled) {
+ error_setg(&local_err,
+ "nvdimm is not enabled: missing 'nvdimm' in '-M'");
+ goto out;
+ }
+
pc_dimm_memory_plug(dev, &pcms->hotplug_memory, mr, align, &local_err);
if (local_err) {
goto out;
}
- if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
- if (!pcms->acpi_nvdimm_state.is_enabled) {
- error_setg(&local_err,
- "nvdimm is not enabled: missing 'nvdimm' in '-M'");
- goto out;
- }
+ if (is_nvdimm) {
nvdimm_plug(&pcms->acpi_nvdimm_state);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path
2017-06-09 15:16 [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path Stefan Hajnoczi
@ 2017-06-09 15:34 ` Eduardo Habkost
2017-06-12 0:48 ` Haozhong Zhang
2017-06-16 13:19 ` Stefan Hajnoczi
2 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2017-06-09 15:34 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-devel, Paolo Bonzini, Michael S. Tsirkin, Richard Henderson,
Haozhong Zhang
On Fri, Jun 09, 2017 at 04:16:15PM +0100, Stefan Hajnoczi wrote:
> Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
> nvdimm is enabled before plugging") introduced a check to reject nvdimm
> hotplug if -machine pc,nvdimm=on was not given.
>
> This check executes after pc_dimm_memory_plug() has already completed
> and does not reverse the effect of this function in the case of failure.
>
> Perform the check before calling pc_dimm_memory_plug(). This fixes the
> following abort:
>
> $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
> -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
> (qemu) device_add nvdimm,memdev=mem1
> nvdimm is not enabled: missing 'nvdimm' in '-M'
> (qemu) device_add nvdimm,memdev=mem1
> Core dumped
>
> The backtrace is:
>
> #0 0x00007fffdb5b191f in raise () at /lib64/libc.so.6
> #1 0x00007fffdb5b351a in abort () at /lib64/libc.so.6
> #2 0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
> #3 0x00007fffdb5a9e52 in () at /lib64/libc.so.6
> #4 0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
> #5 0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
> #6 0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
> at hw/mem/pc-dimm.c:110
> #7 0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
> #8 0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
> #9 0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
>
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
--
Eduardo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path
2017-06-09 15:16 [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path Stefan Hajnoczi
2017-06-09 15:34 ` Eduardo Habkost
@ 2017-06-12 0:48 ` Haozhong Zhang
2017-06-16 13:19 ` Stefan Hajnoczi
2 siblings, 0 replies; 6+ messages in thread
From: Haozhong Zhang @ 2017-06-12 0:48 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Michael S. Tsirkin,
Richard Henderson
On 06/09/17 16:16 +0100, Stefan Hajnoczi wrote:
> Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
> nvdimm is enabled before plugging") introduced a check to reject nvdimm
> hotplug if -machine pc,nvdimm=on was not given.
>
> This check executes after pc_dimm_memory_plug() has already completed
> and does not reverse the effect of this function in the case of failure.
>
> Perform the check before calling pc_dimm_memory_plug(). This fixes the
> following abort:
>
> $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
> -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
> (qemu) device_add nvdimm,memdev=mem1
> nvdimm is not enabled: missing 'nvdimm' in '-M'
> (qemu) device_add nvdimm,memdev=mem1
> Core dumped
>
> The backtrace is:
>
> #0 0x00007fffdb5b191f in raise () at /lib64/libc.so.6
> #1 0x00007fffdb5b351a in abort () at /lib64/libc.so.6
> #2 0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
> #3 0x00007fffdb5a9e52 in () at /lib64/libc.so.6
> #4 0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
> #5 0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
> #6 0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
> at hw/mem/pc-dimm.c:110
> #7 0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
> #8 0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
> #9 0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
>
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Haozhong Zhang <haozhong.zhang@intel.com>
> ---
> hw/i386/pc.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 5b8c6fb..db41cca 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1692,6 +1692,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
> MemoryRegion *mr = ddc->get_memory_region(dimm);
> uint64_t align = TARGET_PAGE_SIZE;
> + bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
>
> if (memory_region_get_alignment(mr) && pcmc->enforce_aligned_dimm) {
> align = memory_region_get_alignment(mr);
> @@ -1703,17 +1704,18 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> goto out;
> }
>
> + if (is_nvdimm && !pcms->acpi_nvdimm_state.is_enabled) {
> + error_setg(&local_err,
> + "nvdimm is not enabled: missing 'nvdimm' in '-M'");
> + goto out;
> + }
> +
> pc_dimm_memory_plug(dev, &pcms->hotplug_memory, mr, align, &local_err);
> if (local_err) {
> goto out;
> }
>
> - if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
> - if (!pcms->acpi_nvdimm_state.is_enabled) {
> - error_setg(&local_err,
> - "nvdimm is not enabled: missing 'nvdimm' in '-M'");
> - goto out;
> - }
> + if (is_nvdimm) {
> nvdimm_plug(&pcms->acpi_nvdimm_state);
> }
>
> --
> 2.9.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path
2017-06-09 15:16 [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path Stefan Hajnoczi
2017-06-09 15:34 ` Eduardo Habkost
2017-06-12 0:48 ` Haozhong Zhang
@ 2017-06-16 13:19 ` Stefan Hajnoczi
2017-06-16 14:03 ` Michael S. Tsirkin
2 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-06-16 13:19 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Haozhong Zhang, Eduardo Habkost, Paolo Bonzini,
Richard Henderson, stefanha
[-- Attachment #1: Type: text/plain, Size: 3729 bytes --]
On Fri, Jun 09, 2017 at 04:16:15PM +0100, Stefan Hajnoczi wrote:
> Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
> nvdimm is enabled before plugging") introduced a check to reject nvdimm
> hotplug if -machine pc,nvdimm=on was not given.
>
> This check executes after pc_dimm_memory_plug() has already completed
> and does not reverse the effect of this function in the case of failure.
>
> Perform the check before calling pc_dimm_memory_plug(). This fixes the
> following abort:
>
> $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
> -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
> (qemu) device_add nvdimm,memdev=mem1
> nvdimm is not enabled: missing 'nvdimm' in '-M'
> (qemu) device_add nvdimm,memdev=mem1
> Core dumped
>
> The backtrace is:
>
> #0 0x00007fffdb5b191f in raise () at /lib64/libc.so.6
> #1 0x00007fffdb5b351a in abort () at /lib64/libc.so.6
> #2 0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
> #3 0x00007fffdb5a9e52 in () at /lib64/libc.so.6
> #4 0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
> #5 0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
> #6 0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
> at hw/mem/pc-dimm.c:110
> #7 0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
> #8 0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
> #9 0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
>
> Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> hw/i386/pc.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
Michael: Do you want to take this through your tree?
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 5b8c6fb..db41cca 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1692,6 +1692,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
> MemoryRegion *mr = ddc->get_memory_region(dimm);
> uint64_t align = TARGET_PAGE_SIZE;
> + bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
>
> if (memory_region_get_alignment(mr) && pcmc->enforce_aligned_dimm) {
> align = memory_region_get_alignment(mr);
> @@ -1703,17 +1704,18 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> goto out;
> }
>
> + if (is_nvdimm && !pcms->acpi_nvdimm_state.is_enabled) {
> + error_setg(&local_err,
> + "nvdimm is not enabled: missing 'nvdimm' in '-M'");
> + goto out;
> + }
> +
> pc_dimm_memory_plug(dev, &pcms->hotplug_memory, mr, align, &local_err);
> if (local_err) {
> goto out;
> }
>
> - if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
> - if (!pcms->acpi_nvdimm_state.is_enabled) {
> - error_setg(&local_err,
> - "nvdimm is not enabled: missing 'nvdimm' in '-M'");
> - goto out;
> - }
> + if (is_nvdimm) {
> nvdimm_plug(&pcms->acpi_nvdimm_state);
> }
>
> --
> 2.9.4
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path
2017-06-16 13:19 ` Stefan Hajnoczi
@ 2017-06-16 14:03 ` Michael S. Tsirkin
2017-06-19 12:00 ` Stefan Hajnoczi
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2017-06-16 14:03 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-devel, Haozhong Zhang, Eduardo Habkost, Paolo Bonzini,
Richard Henderson, stefanha
On Fri, Jun 16, 2017 at 02:19:56PM +0100, Stefan Hajnoczi wrote:
> On Fri, Jun 09, 2017 at 04:16:15PM +0100, Stefan Hajnoczi wrote:
> > Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
> > nvdimm is enabled before plugging") introduced a check to reject nvdimm
> > hotplug if -machine pc,nvdimm=on was not given.
> >
> > This check executes after pc_dimm_memory_plug() has already completed
> > and does not reverse the effect of this function in the case of failure.
> >
> > Perform the check before calling pc_dimm_memory_plug(). This fixes the
> > following abort:
> >
> > $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
> > -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
> > (qemu) device_add nvdimm,memdev=mem1
> > nvdimm is not enabled: missing 'nvdimm' in '-M'
> > (qemu) device_add nvdimm,memdev=mem1
> > Core dumped
> >
> > The backtrace is:
> >
> > #0 0x00007fffdb5b191f in raise () at /lib64/libc.so.6
> > #1 0x00007fffdb5b351a in abort () at /lib64/libc.so.6
> > #2 0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
> > #3 0x00007fffdb5a9e52 in () at /lib64/libc.so.6
> > #4 0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
> > #5 0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
> > #6 0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
> > at hw/mem/pc-dimm.c:110
> > #7 0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
> > #8 0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
> > #9 0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
> >
> > Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> > hw/i386/pc.c | 14 ++++++++------
> > 1 file changed, 8 insertions(+), 6 deletions(-)
>
> Michael: Do you want to take this through your tree?
Yes - it will be in the next pull.
> >
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index 5b8c6fb..db41cca 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1692,6 +1692,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> > PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
> > MemoryRegion *mr = ddc->get_memory_region(dimm);
> > uint64_t align = TARGET_PAGE_SIZE;
> > + bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
> >
> > if (memory_region_get_alignment(mr) && pcmc->enforce_aligned_dimm) {
> > align = memory_region_get_alignment(mr);
> > @@ -1703,17 +1704,18 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> > goto out;
> > }
> >
> > + if (is_nvdimm && !pcms->acpi_nvdimm_state.is_enabled) {
> > + error_setg(&local_err,
> > + "nvdimm is not enabled: missing 'nvdimm' in '-M'");
> > + goto out;
> > + }
> > +
> > pc_dimm_memory_plug(dev, &pcms->hotplug_memory, mr, align, &local_err);
> > if (local_err) {
> > goto out;
> > }
> >
> > - if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
> > - if (!pcms->acpi_nvdimm_state.is_enabled) {
> > - error_setg(&local_err,
> > - "nvdimm is not enabled: missing 'nvdimm' in '-M'");
> > - goto out;
> > - }
> > + if (is_nvdimm) {
> > nvdimm_plug(&pcms->acpi_nvdimm_state);
> > }
> >
> > --
> > 2.9.4
> >
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path
2017-06-16 14:03 ` Michael S. Tsirkin
@ 2017-06-19 12:00 ` Stefan Hajnoczi
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-06-19 12:00 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Stefan Hajnoczi, qemu-devel, Haozhong Zhang, Eduardo Habkost,
Paolo Bonzini, Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 2657 bytes --]
On Fri, Jun 16, 2017 at 05:03:48PM +0300, Michael S. Tsirkin wrote:
> On Fri, Jun 16, 2017 at 02:19:56PM +0100, Stefan Hajnoczi wrote:
> > On Fri, Jun 09, 2017 at 04:16:15PM +0100, Stefan Hajnoczi wrote:
> > > Commit e987c37aee1752177906847630d32477da57e705 ("hw/i386: check if
> > > nvdimm is enabled before plugging") introduced a check to reject nvdimm
> > > hotplug if -machine pc,nvdimm=on was not given.
> > >
> > > This check executes after pc_dimm_memory_plug() has already completed
> > > and does not reverse the effect of this function in the case of failure.
> > >
> > > Perform the check before calling pc_dimm_memory_plug(). This fixes the
> > > following abort:
> > >
> > > $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
> > > -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
> > > (qemu) device_add nvdimm,memdev=mem1
> > > nvdimm is not enabled: missing 'nvdimm' in '-M'
> > > (qemu) device_add nvdimm,memdev=mem1
> > > Core dumped
> > >
> > > The backtrace is:
> > >
> > > #0 0x00007fffdb5b191f in raise () at /lib64/libc.so.6
> > > #1 0x00007fffdb5b351a in abort () at /lib64/libc.so.6
> > > #2 0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
> > > #3 0x00007fffdb5a9e52 in () at /lib64/libc.so.6
> > > #4 0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
> > > #5 0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
> > > #6 0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
> > > at hw/mem/pc-dimm.c:110
> > > #7 0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
> > > #8 0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
> > > #9 0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
> > >
> > > Cc: Haozhong Zhang <haozhong.zhang@intel.com>
> > > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > > ---
> > > hw/i386/pc.c | 14 ++++++++------
> > > 1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > Michael: Do you want to take this through your tree?
>
> Yes - it will be in the next pull.
Thank you!
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-06-19 12:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 15:16 [Qemu-devel] [PATCH] hw/i386: fix nvdimm check error path Stefan Hajnoczi
2017-06-09 15:34 ` Eduardo Habkost
2017-06-12 0:48 ` Haozhong Zhang
2017-06-16 13:19 ` Stefan Hajnoczi
2017-06-16 14:03 ` Michael S. Tsirkin
2017-06-19 12:00 ` Stefan Hajnoczi
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).