qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Igor Mammedov <imammedo@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Xiao Guangrong <xiaoguangrong.eric@gmail.com>
Subject: Re: [PATCH] spapr_nvdimm.c: make 'label-size' mandatory
Date: Tue, 14 Apr 2020 08:04:29 -0300	[thread overview]
Message-ID: <84c6f5c7-de31-84ef-e873-58b10af14bc0@gmail.com> (raw)
In-Reply-To: <20200414020117.GB48061@umbus.fritz.box>



On 4/13/20 11:01 PM, David Gibson wrote:
> CCing Xiao, Michael and Igor for generic NVDIMM perspective.
> 
> On Mon, Apr 13, 2020 at 05:36:28PM -0300, Daniel Henrique Barboza wrote:
>> The pseries machine does not support NVDIMM modules without label.
>> Attempting to do so, even if the overall block size is aligned with
>> 256MB, will seg fault the guest kernel during NVDIMM probe. This
>> can be avoided by forcing 'label-size' to always be present for
>> sPAPR NVDIMMs.
>>
>> The verification was put before the alignment check because the
>> presence of label-size affects the alignment calculation, so
>> it's not optimal to warn the user about an alignment error,
>> then about the lack of label-size, then about a new alignment
>> error when the user sets a label-size.
>>
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> 
> So, this would get the job done, but it seems a bit inelegant compared
> to having the device default to working settings.  I'm looking at how
> this interacts with the generic constraints on label-size.
> 
> The generic nvdimm code has a MIN_NAMESPACE_LABEL_SIZE of 128 kiB, and
> values of label-size less than that are rejected.  Except that if
> label-size is not set at all, it is left as 0.
> 
> Is that intended behaviour?  Do x86 (or whatever) NVDIMMs have a label
> of at least 128kiB, unless they have no label at all?  Or could we
> make the default label-size 128kiB generically?

My limited understanding on how NVDIMM works in x86 is that x86 NVDIMMs can
work with and without label, but the label has a minimum size of 128kiB.

The current NVDIMM init code always adds NVDIMM_LABEL_SIZE_PROP regardless
of user settings, as you can see in hw/mem/nvdimm.c, nvdimm_init(). I found
this out in my first attempt in this patch when doing


object_property_find(OBJECT(nvdimm), NVDIMM_LABEL_SIZE_PROP,
                      &error_abort) == 0) == NULL


inside spapr_nvdimm.c and finding out that this property is always present. This
means that the way to distinguish between label and label-less NVDIMMs is to
check label_size != 0, as we can see being done in hw/acpi/nvdimm.c. What I did
then was to use this same approach in spapr_nvdimm.c.




Thanks,


DHB



  reply	other threads:[~2020-04-14 11:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 20:36 [PATCH] spapr_nvdimm.c: make 'label-size' mandatory Daniel Henrique Barboza
2020-04-14  2:01 ` David Gibson
2020-04-14 11:04   ` Daniel Henrique Barboza [this message]
2020-04-24  1:45     ` David Gibson
2020-04-24  1:36 ` 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=84c6f5c7-de31-84ef-e873-58b10af14bc0@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=xiaoguangrong.eric@gmail.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).