From: Vishal Verma <vishal@kernel.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: acpi_nfit_query_poison() broken on non-ARS systems
Date: Fri, 29 Apr 2016 18:18:54 -0600 [thread overview]
Message-ID: <1461975534.11211.12.camel@kernel.org> (raw)
In-Reply-To: <CAPcyv4iYZoAENTKZ4w5OyWoAb0q9qWqYqoG0F4Cfjtc6jAp4Xg@mail.gmail.com>
On Fri, 2016-04-29 at 17:15 -0700, Dan Williams wrote:
> On Fri, Apr 29, 2016 at 5:15 PM, Vishal Verma <vishal@kernel.org>
> wrote:
> >
> > On Fri, 2016-04-29 at 17:04 -0700, Dan Williams wrote:
> > >
> > > On Fri, Apr 29, 2016 at 5:03 PM, Vishal Verma <vishal@kernel.org>
> > > wrote:
> > > >
> > > >
> > > > On Fri, 2016-04-29 at 19:36 -0400, Linda Knippers wrote:
> > > >
> > > > [snip]
> > > > >
> > > > >
> > > > >
> > > > > >
> > > > > >
> > > > > > static int acpi_nfit_query_poison(struct acpi_nfit_desc
> > > > > > *acpi_desc,
> > > > > > struct nfit_spa *nfit_spa)
> > > > > > {
> > > > > > struct acpi_nfit_system_address *spa = nfit_spa-
> > > > > > >spa;
> > > > > > int rc;
> > > > > >
> > > > > > if (!nfit_spa->max_ars) {
> > > > > On a platform that doesn't support ARS, max_ars will always
> > > > > be
> > > > > zero
> > > > > so you'll keep executing this code when it seems like you're
> > > > > trying
> > > > > to avoid that.
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > struct nd_cmd_ars_cap ars_cap;
> > > > > >
> > > > > > memset(&ars_cap, 0, sizeof(ars_cap));
> > > > > > rc = ars_get_cap(acpi_desc, &ars_cap,
> > > > > > nfit_spa);
> > > > > > if (rc < 0)
> > > > > > return rc;
> > > > > The call succeeds so this return isn't taken, but then the
> > > > > code
> > > > > assumes
> > > > > everything is good. It should check ars_cap.status so see if
> > > > > the
> > > > > function
> > > > > is supported or if there was an error and return something
> > > > > appropriate.
> > > > > In previous version of the code, that's what
> > > > > acpi_nfit_find_poison()
> > > > > did.
> > > > > Instead, this function continues, using data that's not right
> > > > > and
> > > > > making
> > > > > more calls that also aren't supported.
> > > > Good point - I think we should add a check here and make sure
> > > > ARS
> > > > is
> > > > supported using the status field. I can work on a patch. Thanks
> > > > for
> > > > the
> > > > report!
> > > ...but we do, or are supposed to, fail on any non-zero status:
> > >
> > > /* Command failed */
> > > if (ars_cap->status & 0xffff)
> > > return -EIO;
> > This doesn't check the extended status, does it..
> > I think we'd also want something like:
> >
> > /* ARS not supported */>
> > if (ars_cap->status & 0xffff0000 == 0)
> > return -EOPNOTSUPP;
> >
> > From ACPI 6.1:
> > Extended Status (Len 2) (Off 2)
> > Bit[0] – If set to 1, indicates Volatile Memory scrub is supported
> > Bit[1] – If set to 1, indicates Persistent Memory Scrub is
> > supported
> > Bits[15:2] – Reserved
> See xlat_status():
>
> /* No supported scan types for this range */
> flags = ND_ARS_PERSISTENT | ND_ARS_VOLATILE;
> if ((ars_cap->status >> 16 & flags) == 0)
> return -ENOTTY;\
Ah missed that - thanks. Yep in that case something is weird :)
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2016-04-30 0:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 23:36 acpi_nfit_query_poison() broken on non-ARS systems Linda Knippers
2016-04-30 0:03 ` Vishal Verma
2016-04-30 0:04 ` Dan Williams
2016-04-30 0:15 ` Vishal Verma
2016-04-30 0:15 ` Dan Williams
2016-04-30 0:18 ` Vishal Verma [this message]
2016-05-01 17:27 ` Linda Knippers
2016-04-30 0:12 ` Dan Williams
2016-05-01 17:42 ` Linda Knippers
2016-05-01 19:44 ` Linda Knippers
2016-05-02 0:33 ` Dan Williams
2016-05-02 15:05 ` Linda Knippers
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=1461975534.11211.12.camel@kernel.org \
--to=vishal@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox