All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Hoemann <jerry.hoemann@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [RFC v6 2/8] nvdimm: Add wrapper for IOCTL pass thru
Date: Sun, 13 Mar 2016 13:15:43 -0600	[thread overview]
Message-ID: <20160313191543.GA68634@tevye.fc.hp.com> (raw)
In-Reply-To: <CAPcyv4gZOLDC1qEj8rchfc5TjyfGVC_X7hYypBZsc-xYLatmsA@mail.gmail.com>

On Fri, Mar 11, 2016 at 03:48:55PM -0800, Dan Williams wrote:
> On Fri, Mar 11, 2016 at 3:29 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> > On Fri, Mar 11, 2016 at 02:04:04PM -0800, Dan Williams wrote:
> >> On Fri, Mar 11, 2016 at 1:16 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> >> > +
> >> > +
> >> > +struct nd_cmd_pkg {
> >> > +       __u32   ncp_type;
> >>
> >> I think 'family' is more clear, to signify the class of commands that
> >> the 'command' parameter references.
> >
> >
> > Oh, family of commands for a DSM.  I was thinking you wanted
> > family of DSM for a given nvdimm type which didn't seem quite
> > right.
> >
> > I'll change.
> >
> >
> >>                                        Also let's drop the ncp_ prefix,
> >> it's non-idiomatic with the rest of the definitions in this file.
> >
> >
> > I like field names with prefixes that refer back to the structure they're
> > defined in.  It makes reading code easier.  (e.g. how many times is
> > "size" defined in a struct?)
> 
> True, I do appreciate that aspect.
> 
> > would you be okay with a prefix "nd_"?  it doesn't quite tie as closely
> > to the struct, but it should make them unique w/in the kernel.
> 
> That sounds like a reasonable compromise.

Will do.

> 
> >>
> >> > +       __u32   ncp_rev;
> >>
> >> Why do we need a separate revision field?  A revision change
> >> effectively selects a different 'family' of commands, so I don't think
> >> we need to reflect that ACPI-specific aspect of the commands at this
> >> level.
> >
> >  To be clear, if/when a DSM specification is extended in the future, with
> >  a new command added (all other commands remaining) and the revision to
> >  the DSM is incremented, you want to have a new family defined/used
> >  by the ioctl interface?
> >
> >  I should be able to do this.
> 
> Yes, to date we've handled extending and changing command sets within
> the same revision.
> 
> >> > +       __u64   ncp_command;
> >> > +       __u32   ncp_size_in;                    /* size of input payload */
> >> > +       __u32   ncp_size_out;                   /* size of user buffer   */
> >>
> >> What's "user" in this context?  How about "/* size of output payload */"
> >
> > Yes, a confusing name.
> >
> > This is total space (including input portion) that the user
> > space caller has set aside for the output of the DSM call.
> >
> > The kernel when copying out to user space will not exceed
> > the size given.
> >
> > Need to convey that both of these are INPUT parameter the caller
> > is passing.
> >
> >
> >>
> >> > +       __u32   ncp_reserved2[9];               /* reserved must be zero */
> >> > +       __u32   ncp_pot_size;                   /* potential output size */
> >>
> >> It's not 'potential'' it's the 'actual' output size written by the
> >> kernel/firmware, right?
> >
> >
> > No, it is potential.
> >
> > Going though multiple version of the spec, I would see dsm calls
> > where the amount of the data the dsm returned was not something that
> > the caller could know apriori.
> >
> > So, the interface returns the amount of data that will fit in
> > the space provided and tell the user app in ncp_pot_size the
> > amount of data it wants to return.  If what the dsm call wants to
> > return fits in the space provided, it is what is written.  If what
> > the DSM would want to return is greater, it is the greater.
> 
> The case where firmware output overflows the provided buffer the
> implementation considers that a fatal error.  All the variable output
> commands indicate (explicitly or implicitly) a maximum output payload
> size, so an overflow means the driver and the firmware are
> incompatible.

Not wrong, just a different calling paradigm.

In addition to allowing user applications to query/size buffers
for the call, I have also found the information on how much data
firmware wants to return a useful diagnostic in diagnosing
firmware problems.

Also note, The upper limit on the amount of data the interface returns is
still in place.  I am not allowing for arbitrarily large returns.



> 
> > This allows for idempotent calls to be redone with appropriately
> > sized buffer.
> 
> I'd prefer we keep the status quo of just failing or otherwise
> refusing to support commands that exhibit this behavior.

I don't know what the final spec will look like.  It might be
an issue, it might not.  I would just prefer to have a flexible
kernel interface in place that will handle such situations so
we don't have to revisit it in the future.

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2016-03-13 19:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1457730736.git.jerry.hoemann@hpe.com>
2016-03-11 21:16 ` [RFC v6 1/8] ACPI / util: Fix acpi_evaluate_dsm() argument type Jerry Hoemann
2016-03-11 21:16 ` [RFC v6 2/8] nvdimm: Add wrapper for IOCTL pass thru Jerry Hoemann
2016-03-11 22:04   ` Dan Williams
2016-03-11 23:29     ` Jerry Hoemann
2016-03-11 23:48       ` Dan Williams
2016-03-13 19:15         ` Jerry Hoemann [this message]
2016-03-13 19:43           ` Dan Williams
2016-03-12 15:49       ` Vishal Verma
2016-03-12 17:50         ` Dan Williams
2016-03-14  3:15           ` Vishal Verma
2016-03-11 21:16 ` [RFC v6 3/8] nvdimm: Increase max envelope size for IOCTL Jerry Hoemann
2016-03-11 21:16 ` [RFC v6 4/8] nvdimm: Add UUIDs Jerry Hoemann
2016-03-11 21:16 ` [RFC v6 5/8] nvdimm: data structure changes for dsm calls Jerry Hoemann
2016-03-11 21:16 ` [RFC v6 6/8] libnvdimm: advertise 'call_dsm' support Jerry Hoemann
2016-03-11 21:16 ` [RFC v6 7/8] nvdimm: Add IOCTL pass thru functions Jerry Hoemann
2016-03-11 21:16 ` [RFC v6 8/8] tools/testing/nvdimm: 'call_dsm' support Jerry Hoemann

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=20160313191543.GA68634@tevye.fc.hp.com \
    --to=jerry.hoemann@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /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 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.