qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] spapr_nvdimm.c: make 'label-size' mandatory


From: David Gibson
Subject: Re: [PATCH] spapr_nvdimm.c: make 'label-size' mandatory
Date: Fri, 24 Apr 2020 11:45:32 +1000

On Tue, Apr 14, 2020 at 08:04:29AM -0300, Daniel Henrique Barboza wrote:
> 
> 
> 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 <address@hidden>
> > 
> > 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.

Ok.  Kinda weird, but ok.

But.. the thing that bothers me about this is that the guest is
crashing in generic code.  If the generic code can handle a label-less
nvdimm on x86, why is it dying on power.

After a bit of poking, I think the answer is that x86 is explicitly
treating label_size==0 as "label not supported" and returning explicit
errors for the get_label_size/read_label/write_label low level
operations, which the generic code is handling.  ppc, I think, is
instead just returning bogus/meaningless values which the generic code
is choking on.

So, I really think we should have the spapr_scm driver on the guest
side check for the zero sized label case and return similar errors,
for robustness.

But, I don't care enough to do it myself.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]