mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Saldivar, Maurice A." <maurice.a.saldivar@hpe.com>
To: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"vishal.l.verma@intel.com" <vishal.l.verma@intel.com>
Subject: Re: [PATCH 2/2] libnvdimm, namespace: fix btt claim class crash
Date: Tue, 19 Sep 2017 22:06:21 +0000	[thread overview]
Message-ID: <1505858348.3864.8.camel@hpe.com> (raw)
In-Reply-To: <150585069444.18066.1329567407748978657.stgit@dwillia2-desk3.amr.corp.intel.com>

I applied this and the kernel patch and was successfully able to
configure an NVDIMM-N into sector mode. I do have a question about
specific behavior I observed. Before I was able to configure an NVDIMM
into any mode from any mode. With these patchs if I go to sector mode
and try going to memory or dax mode it fails with: 

# ndctl create-namespace -f -e namespace0.0 -m memory
  Error: namespace0.0: sector_size: 4096 not supported
failed to reconfigure namespace: Invalid argument
 
but if I go sector->raw-><mode> I can get into other modes fine. Was
this the intended behavior? 

Sincerely, 
Maurice  

On Tue, 2017-09-19 at 12:51 -0700, Dan Williams wrote:
> Maurice reports:
> 
>     BUG: unable to handle kernel NULL pointer dereference at
> 0000000000000028
>     IP: holder_class_store+0x253/0x2b0 [libnvdimm]
> 
> ...while trying to reconfigure an NVDIMM-N namespace into 'sector' /
> 'btt' mode. The crash points to this line:
> 
>     (gdb) li *(holder_class_store+0x253)
>     0x7773 is in holder_class_store
> (drivers/nvdimm/namespace_devs.c:1420).
>     1415            for (i = 0; i < nd_region->ndr_mappings; i++) {
>     1416                    struct nd_mapping *nd_mapping =
> &nd_region->mapping[i];
>     1417                    struct nvdimm_drvdata *ndd =
> to_ndd(nd_mapping);
>     1418                    struct nd_namespace_index *nsindex;
>     1419
>     1420                    nsindex = to_namespace_index(ndd, ndd-
> >ns_current);
> 
> ...where we are failing because ndd is NULL due to NVDIMM-N dimms not
> supporting labels.
> 
> Long story short, default to the BTTv1 format in the label-less /
> NVDIMM-N case.
> 
> Fixes: 14e494542636 ("libnvdimm, btt: BTT updates for UEFI 2.7
> format")
> Cc: <stable@vger.kernel.org>
> Cc: Vishal Verma <vishal.l.verma@intel.com>
> Reported-by: Maurice A. Saldivar <maurice.a.saldivar@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/nvdimm/namespace_devs.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/nvdimm/namespace_devs.c
> b/drivers/nvdimm/namespace_devs.c
> index 1427a386a033..3e4d1e7998da 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -1417,6 +1417,15 @@ static int btt_claim_class(struct device *dev)
>  		struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
>  		struct nd_namespace_index *nsindex;
>  
> +		/*
> +		 * If any of the DIMMs do not support labels the
> only
> +		 * possible BTT format is v1.
> +		 */
> +		if (!ndd) {
> +			loop_bitmask = 0;
> +			break;
> +		}
> +
>  		nsindex = to_namespace_index(ndd, ndd->ns_current);
>  		if (nsindex == NULL)
>  			loop_bitmask |= 1;
> 

  reply	other threads:[~2017-09-19 22:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 19:51 [PATCH 1/2] tools/testing/nvdimm: disable labels for nfit_test.1 Dan Williams
2017-09-19 19:51 ` [PATCH 2/2] libnvdimm, namespace: fix btt claim class crash Dan Williams
2017-09-19 22:06   ` Saldivar, Maurice A. [this message]
2017-09-19 22:10     ` Dan Williams

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=1505858348.3864.8.camel@hpe.com \
    --to=maurice.a.saldivar@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=stable@vger.kernel.org \
    --cc=vishal.l.verma@intel.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

all inboxes | Powered by JetHome®