All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
@ 2017-01-13 11:56 Haozhong Zhang
  2017-01-13 12:20 ` Xiao Guangrong
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Haozhong Zhang @ 2017-01-13 11:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S . Tsirkin, Stefan Hajnoczi, imammedo, Xiao Guangrong,
	Haozhong Zhang

The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
is disabled. QEMU should refuse to plug any NVDIMM device in this case
and report the misconfiguration.

Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
Message-Id: 20170111093630.2088-1-stefanha@redhat.com
---
 hw/i386/pc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 25e8586..3907609 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
     }
 
     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;
+        }
         nvdimm_plug(&pcms->acpi_nvdimm_state);
     }
 
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-13 11:56 [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging Haozhong Zhang
@ 2017-01-13 12:20 ` Xiao Guangrong
  2017-01-13 13:17 ` Stefan Hajnoczi
  2017-01-23 10:35 ` Stefan Hajnoczi
  2 siblings, 0 replies; 10+ messages in thread
From: Xiao Guangrong @ 2017-01-13 12:20 UTC (permalink / raw)
  To: Haozhong Zhang, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S . Tsirkin, Stefan Hajnoczi, imammedo



On 01/13/2017 07:56 PM, Haozhong Zhang wrote:
> The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
> is disabled. QEMU should refuse to plug any NVDIMM device in this case
> and report the misconfiguration.

Thanks for your fix.

Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-13 11:56 [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging Haozhong Zhang
  2017-01-13 12:20 ` Xiao Guangrong
@ 2017-01-13 13:17 ` Stefan Hajnoczi
  2017-01-13 13:37   ` Haozhong Zhang
  2017-01-13 18:02   ` Eduardo Habkost
  2017-01-23 10:35 ` Stefan Hajnoczi
  2 siblings, 2 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2017-01-13 13:17 UTC (permalink / raw)
  To: Haozhong Zhang
  Cc: qemu-devel, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S . Tsirkin, imammedo, Xiao Guangrong

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

On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
> The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
> is disabled. QEMU should refuse to plug any NVDIMM device in this case
> and report the misconfiguration.
> 
> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
> Message-Id: 20170111093630.2088-1-stefanha@redhat.com
> ---
>  hw/i386/pc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 25e8586..3907609 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
>      }
>  
>      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;
> +        }

A warning is definitely useful to notify users of a possible
configuration error.

I wonder what happens when you plug an NVDIMM into a motherboard where
the firmware lacks support.  Does it:
 * Refuse to boot?
 * Treat the DIMM as regular RAM?
 * Boot but the DIMM will not be used by firmware and kernel?

QEMU should act the same way as real hardware.

Stefan

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-13 13:17 ` Stefan Hajnoczi
@ 2017-01-13 13:37   ` Haozhong Zhang
  2017-01-13 18:02   ` Eduardo Habkost
  1 sibling, 0 replies; 10+ messages in thread
From: Haozhong Zhang @ 2017-01-13 13:37 UTC (permalink / raw)
  To: Stefan Hajnoczi, Xiao Guangrong
  Cc: qemu-devel, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S . Tsirkin, imammedo

On 01/13/17 13:17 +0000, Stefan Hajnoczi wrote:
>On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
>> The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
>> is disabled. QEMU should refuse to plug any NVDIMM device in this case
>> and report the misconfiguration.
>>
>> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
>> Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
>> Message-Id: 20170111093630.2088-1-stefanha@redhat.com
>> ---
>>  hw/i386/pc.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 25e8586..3907609 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
>>      }
>>
>>      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;
>> +        }
>
>A warning is definitely useful to notify users of a possible
>configuration error.

If NVDIMM is plugged at boot time, QEMU with this patch will stop and report a
message like
    qemu-system-x86_64: -device nvdimm,...: nvdimm is not enabled: missing 'nvdimm' in '-M'

If NVDIMM is plugged via 'device_add' command, QEMU with this patch will report a warning message
    nvdimm is not enabled: missing 'nvdimm' in '-M'
and continue to run w/o plugging this device.

>
>I wonder what happens when you plug an NVDIMM into a motherboard where
>the firmware lacks support.  Does it:
> * Refuse to boot?
> * Treat the DIMM as regular RAM?
> * Boot but the DIMM will not be used by firmware and kernel?

Good question. Guangrong, any idea?

Thanks,
Haozhong

>
>QEMU should act the same way as real hardware.
>
>Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-13 13:17 ` Stefan Hajnoczi
  2017-01-13 13:37   ` Haozhong Zhang
@ 2017-01-13 18:02   ` Eduardo Habkost
  2017-01-16  5:55     ` Xiao Guangrong
  1 sibling, 1 reply; 10+ messages in thread
From: Eduardo Habkost @ 2017-01-13 18:02 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Haozhong Zhang, qemu-devel, Paolo Bonzini, Richard Henderson,
	Michael S . Tsirkin, imammedo, Xiao Guangrong

On Fri, Jan 13, 2017 at 01:17:27PM +0000, Stefan Hajnoczi wrote:
> On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
> > The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
> > is disabled. QEMU should refuse to plug any NVDIMM device in this case
> > and report the misconfiguration.
> > 
> > Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
> > Message-Id: 20170111093630.2088-1-stefanha@redhat.com
> > ---
> >  hw/i386/pc.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index 25e8586..3907609 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> >      }
> >  
> >      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;
> > +        }
> 
> A warning is definitely useful to notify users of a possible
> configuration error.
> 
> I wonder what happens when you plug an NVDIMM into a motherboard where
> the firmware lacks support.  Does it:
>  * Refuse to boot?
>  * Treat the DIMM as regular RAM?
>  * Boot but the DIMM will not be used by firmware and kernel?
> 
> QEMU should act the same way as real hardware.

If real hardware behavior is not useful in any way (e.g. first
and third options above), is there a good reason for QEMU to not
implement an additional safety mechanism preventing NVDIMM from
being connected to a machine that doesn't support it?

-- 
Eduardo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-13 18:02   ` Eduardo Habkost
@ 2017-01-16  5:55     ` Xiao Guangrong
  2017-01-16 11:00       ` Stefan Hajnoczi
  0 siblings, 1 reply; 10+ messages in thread
From: Xiao Guangrong @ 2017-01-16  5:55 UTC (permalink / raw)
  To: Eduardo Habkost, Stefan Hajnoczi
  Cc: Haozhong Zhang, Michael S . Tsirkin, qemu-devel, Paolo Bonzini,
	imammedo, Richard Henderson



On 01/14/2017 02:02 AM, Eduardo Habkost wrote:
> On Fri, Jan 13, 2017 at 01:17:27PM +0000, Stefan Hajnoczi wrote:
>> On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
>>> The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
>>> is disabled. QEMU should refuse to plug any NVDIMM device in this case
>>> and report the misconfiguration.
>>>
>>> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
>>> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
>>> Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
>>> Message-Id: 20170111093630.2088-1-stefanha@redhat.com
>>> ---
>>>  hw/i386/pc.c | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>>> index 25e8586..3907609 100644
>>> --- a/hw/i386/pc.c
>>> +++ b/hw/i386/pc.c
>>> @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
>>>      }
>>>
>>>      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;
>>> +        }
>>
>> A warning is definitely useful to notify users of a possible
>> configuration error.
>>
>> I wonder what happens when you plug an NVDIMM into a motherboard where
>> the firmware lacks support.  Does it:
>>  * Refuse to boot?
>>  * Treat the DIMM as regular RAM?
>>  * Boot but the DIMM will not be used by firmware and kernel?
>>
>> QEMU should act the same way as real hardware.
>
> If real hardware behavior is not useful in any way (e.g. first
> and third options above), is there a good reason for QEMU to not
> implement an additional safety mechanism preventing NVDIMM from
> being connected to a machine that doesn't support it?
>

Yes. i agree with Eduardo.

For the real hardware the behavior may be different between vendors, we
are asking our HW people to check what will happen on Intel's hardware
under this case.

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-16  5:55     ` Xiao Guangrong
@ 2017-01-16 11:00       ` Stefan Hajnoczi
  2017-01-20  0:55         ` Haozhong Zhang
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 11:00 UTC (permalink / raw)
  To: Xiao Guangrong
  Cc: Eduardo Habkost, Haozhong Zhang, Michael S . Tsirkin, qemu-devel,
	Paolo Bonzini, imammedo, Richard Henderson

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

On Mon, Jan 16, 2017 at 01:55:34PM +0800, Xiao Guangrong wrote:
> 
> 
> On 01/14/2017 02:02 AM, Eduardo Habkost wrote:
> > On Fri, Jan 13, 2017 at 01:17:27PM +0000, Stefan Hajnoczi wrote:
> > > On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
> > > > The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
> > > > is disabled. QEMU should refuse to plug any NVDIMM device in this case
> > > > and report the misconfiguration.
> > > > 
> > > > Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> > > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > > > Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
> > > > Message-Id: 20170111093630.2088-1-stefanha@redhat.com
> > > > ---
> > > >  hw/i386/pc.c | 5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > > 
> > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > > > index 25e8586..3907609 100644
> > > > --- a/hw/i386/pc.c
> > > > +++ b/hw/i386/pc.c
> > > > @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> > > >      }
> > > > 
> > > >      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;
> > > > +        }
> > > 
> > > A warning is definitely useful to notify users of a possible
> > > configuration error.
> > > 
> > > I wonder what happens when you plug an NVDIMM into a motherboard where
> > > the firmware lacks support.  Does it:
> > >  * Refuse to boot?
> > >  * Treat the DIMM as regular RAM?
> > >  * Boot but the DIMM will not be used by firmware and kernel?
> > > 
> > > QEMU should act the same way as real hardware.
> > 
> > If real hardware behavior is not useful in any way (e.g. first
> > and third options above), is there a good reason for QEMU to not
> > implement an additional safety mechanism preventing NVDIMM from
> > being connected to a machine that doesn't support it?
> > 
> 
> Yes. i agree with Eduardo.
> 
> For the real hardware the behavior may be different between vendors, we
> are asking our HW people to check what will happen on Intel's hardware
> under this case.

Let's find out what real hardware/firmware does.  I guess it's the Intel
MRC component that handles memory initialization.

Stefan

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-16 11:00       ` Stefan Hajnoczi
@ 2017-01-20  0:55         ` Haozhong Zhang
  2017-01-20 21:03           ` Eduardo Habkost
  0 siblings, 1 reply; 10+ messages in thread
From: Haozhong Zhang @ 2017-01-20  0:55 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Xiao Guangrong, Eduardo Habkost, Michael S . Tsirkin, qemu-devel,
	Paolo Bonzini, imammedo, Richard Henderson

On 01/16/17 11:00 +0000, Stefan Hajnoczi wrote:
>On Mon, Jan 16, 2017 at 01:55:34PM +0800, Xiao Guangrong wrote:
>> On 01/14/2017 02:02 AM, Eduardo Habkost wrote:
>> > On Fri, Jan 13, 2017 at 01:17:27PM +0000, Stefan Hajnoczi wrote:
>> > > On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
>> > > > The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
>> > > > is disabled. QEMU should refuse to plug any NVDIMM device in this case
>> > > > and report the misconfiguration.
>> > > >
>> > > > Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
>> > > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
>> > > > Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
>> > > > Message-Id: 20170111093630.2088-1-stefanha@redhat.com
>> > > > ---
>> > > >  hw/i386/pc.c | 5 +++++
>> > > >  1 file changed, 5 insertions(+)
>> > > >
>> > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> > > > index 25e8586..3907609 100644
>> > > > --- a/hw/i386/pc.c
>> > > > +++ b/hw/i386/pc.c
>> > > > @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
>> > > >      }
>> > > >
>> > > >      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;
>> > > > +        }
>> > >
>> > > A warning is definitely useful to notify users of a possible
>> > > configuration error.
>> > >
>> > > I wonder what happens when you plug an NVDIMM into a motherboard where
>> > > the firmware lacks support.  Does it:
>> > >  * Refuse to boot?
>> > >  * Treat the DIMM as regular RAM?
>> > >  * Boot but the DIMM will not be used by firmware and kernel?
>> > >
>> > > QEMU should act the same way as real hardware.
>> >
>> > If real hardware behavior is not useful in any way (e.g. first
>> > and third options above), is there a good reason for QEMU to not
>> > implement an additional safety mechanism preventing NVDIMM from
>> > being connected to a machine that doesn't support it?
>> >
>>
>> Yes. i agree with Eduardo.
>>
>> For the real hardware the behavior may be different between vendors, we
>> are asking our HW people to check what will happen on Intel's hardware
>> under this case.
>
>Let's find out what real hardware/firmware does.  I guess it's the Intel
>MRC component that handles memory initialization.
>

The behavior of NVDIMM on unsupported platform (HW/FW) is vendor
specific. For some vendors, it's undefined and the platform may do
anything (e.g. the three points Stefan listed above). Thus, I think
QEMU is free to choose the implementation. Aborting QEMU
(i.e. refusing to boot) is the easiest one.

Haozhong

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-20  0:55         ` Haozhong Zhang
@ 2017-01-20 21:03           ` Eduardo Habkost
  0 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-01-20 21:03 UTC (permalink / raw)
  To: Stefan Hajnoczi, Xiao Guangrong, Michael S . Tsirkin, qemu-devel,
	Paolo Bonzini, imammedo, Richard Henderson

On Fri, Jan 20, 2017 at 08:55:58AM +0800, Haozhong Zhang wrote:
> On 01/16/17 11:00 +0000, Stefan Hajnoczi wrote:
> > On Mon, Jan 16, 2017 at 01:55:34PM +0800, Xiao Guangrong wrote:
> > > On 01/14/2017 02:02 AM, Eduardo Habkost wrote:
> > > > On Fri, Jan 13, 2017 at 01:17:27PM +0000, Stefan Hajnoczi wrote:
> > > > > On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
> > > > > > The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
> > > > > > is disabled. QEMU should refuse to plug any NVDIMM device in this case
> > > > > > and report the misconfiguration.
> > > > > >
> > > > > > Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> > > > > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > > > > > Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
> > > > > > Message-Id: 20170111093630.2088-1-stefanha@redhat.com
> > > > > > ---
> > > > > >  hw/i386/pc.c | 5 +++++
> > > > > >  1 file changed, 5 insertions(+)
> > > > > >
> > > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > > > > > index 25e8586..3907609 100644
> > > > > > --- a/hw/i386/pc.c
> > > > > > +++ b/hw/i386/pc.c
> > > > > > @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> > > > > >      }
> > > > > >
> > > > > >      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;
> > > > > > +        }
> > > > >
> > > > > A warning is definitely useful to notify users of a possible
> > > > > configuration error.
> > > > >
> > > > > I wonder what happens when you plug an NVDIMM into a motherboard where
> > > > > the firmware lacks support.  Does it:
> > > > >  * Refuse to boot?
> > > > >  * Treat the DIMM as regular RAM?
> > > > >  * Boot but the DIMM will not be used by firmware and kernel?
> > > > >
> > > > > QEMU should act the same way as real hardware.
> > > >
> > > > If real hardware behavior is not useful in any way (e.g. first
> > > > and third options above), is there a good reason for QEMU to not
> > > > implement an additional safety mechanism preventing NVDIMM from
> > > > being connected to a machine that doesn't support it?
> > > >
> > > 
> > > Yes. i agree with Eduardo.
> > > 
> > > For the real hardware the behavior may be different between vendors, we
> > > are asking our HW people to check what will happen on Intel's hardware
> > > under this case.
> > 
> > Let's find out what real hardware/firmware does.  I guess it's the Intel
> > MRC component that handles memory initialization.
> > 
> 
> The behavior of NVDIMM on unsupported platform (HW/FW) is vendor
> specific. For some vendors, it's undefined and the platform may do
> anything (e.g. the three points Stefan listed above). Thus, I think
> QEMU is free to choose the implementation. Aborting QEMU
> (i.e. refusing to boot) is the easiest one.

I agree.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging
  2017-01-13 11:56 [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging Haozhong Zhang
  2017-01-13 12:20 ` Xiao Guangrong
  2017-01-13 13:17 ` Stefan Hajnoczi
@ 2017-01-23 10:35 ` Stefan Hajnoczi
  2 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2017-01-23 10:35 UTC (permalink / raw)
  To: Haozhong Zhang
  Cc: qemu-devel, Xiao Guangrong, Eduardo Habkost, Michael S . Tsirkin,
	Stefan Hajnoczi, imammedo, Paolo Bonzini, Richard Henderson

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

On Fri, Jan 13, 2017 at 07:56:51PM +0800, Haozhong Zhang wrote:
> The missing of 'nvdimm' in the machine type option '-M' means NVDIMM
> is disabled. QEMU should refuse to plug any NVDIMM device in this case
> and report the misconfiguration.
> 
> Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain
> Message-Id: 20170111093630.2088-1-stefanha@redhat.com
> ---
>  hw/i386/pc.c | 5 +++++
>  1 file changed, 5 insertions(+)

Michael: Please add Haozhong's comment to the commit description when
merging:

"The behavior of NVDIMM on unsupported platform (HW/FW) is vendor
specific. For some vendors, it's undefined and the platform may do
anything. Thus, I think QEMU is free to choose the implementation.
Aborting QEMU (i.e. refusing to boot) is the easiest one."

This way we have a record that the behavior is okay according to the
spec and why we chose this option.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-23 10:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 11:56 [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging Haozhong Zhang
2017-01-13 12:20 ` Xiao Guangrong
2017-01-13 13:17 ` Stefan Hajnoczi
2017-01-13 13:37   ` Haozhong Zhang
2017-01-13 18:02   ` Eduardo Habkost
2017-01-16  5:55     ` Xiao Guangrong
2017-01-16 11:00       ` Stefan Hajnoczi
2017-01-20  0:55         ` Haozhong Zhang
2017-01-20 21:03           ` Eduardo Habkost
2017-01-23 10:35 ` Stefan Hajnoczi

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.