Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Cc: "Ramotowski, Maciej" <maciej.ramotowski@intel.com>
Subject: Re: [ndctl PATCH] ndctl, create-namespace: fix minimum alignment detection
Date: Tue, 6 Mar 2018 00:38:16 +0000	[thread overview]
Message-ID: <1520296694.24924.69.camel@intel.com> (raw)
In-Reply-To: <152011374766.14937.7017387737157056826.stgit@dwillia2-desk3.amr.corp.intel.com>


On Sat, 2018-03-03 at 13:49 -0800, Dan Williams wrote:
> Commit 0c31ce0a2875 "ndctl, create-namespace: fix --align=
> default..."
> tried to make casual testing with nfit_test easier by auto-detecting
> the
> alignment. However, this auto-detection always falls back to 4K
> alignment on kernels that do not export the region 'resource'
> attribute.
> Those kernels, like v4.9.4, may also be missing this fix: commit
> cd755677d944 "libnvdimm, pfn: fix memmap reservation size versus 4K
> alignment".
> 
> Given the chance to fail to initialize a namespace in the 4K case on
> older kernels, be more conservative about falling back to 4K
> alignment.
> 
> Link: https://github.com/pmem/ndctl/issues/34
> Reported-by: Maciej Ramotowski <maciej.ramotowski@intel.com>
> Fixes: 0c31ce0a2875 ("ndctl, create-namespace: fix --align=
> default...")
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  ndctl/namespace.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 

Looks good, queued for v60.

> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index ceb9e7a9b8af..aef356abbee1 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -462,7 +462,7 @@ static int validate_namespace_options(struct
> ndctl_region *region,
>  		struct ndctl_namespace *ndns, struct
> parsed_parameters *p)
>  {
>  	const char *region_name = ndctl_region_get_devname(region);
> -	unsigned long long size_align = SZ_4K, units = 1;
> +	unsigned long long size_align = SZ_4K, units = 1, resource;
>  	unsigned int ways;
>  	int rc = 0;
>  
> @@ -563,8 +563,9 @@ static int validate_namespace_options(struct
> ndctl_region *region,
>  		 * the nfit_test use case where it is backed by
> vmalloc
>  		 * memory.
>  		 */
> -		if (param.align_default &&
> (ndctl_region_get_resource(region)
> -					& (SZ_2M - 1))) {
> +		resource = ndctl_region_get_resource(region);
> +		if (param.align_default && resource < ULLONG_MAX
> +				&& (resource & (SZ_2M - 1))) {
>  			debug("%s: falling back to a 4K
> alignment\n",
>  					region_name);
>  			p->align = SZ_4K;
> 
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

      reply	other threads:[~2018-03-06  0:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03 21:49 [ndctl PATCH] ndctl, create-namespace: fix minimum alignment detection Dan Williams
2018-03-06  0:38 ` Verma, Vishal L [this message]

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=1520296694.24924.69.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=maciej.ramotowski@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