All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH v3 1/6] libnvdimm/namespace: Make namespace size validation arch dependent
Date: Mon, 13 Jan 2020 20:38:33 +0530	[thread overview]
Message-ID: <87lfqbl7gu.fsf@linux.ibm.com> (raw)
In-Reply-To: <CAPcyv4jKC=TBYh7pnF__iHNpcunifcRKhz4eQ3t86uCd4ZNNwg@mail.gmail.com>

Dan Williams <dan.j.williams@intel.com> writes:

> On Fri, Jan 10, 2020 at 8:33 PM Aneesh Kumar K.V
> <aneesh.kumar@linux.ibm.com> wrote:
>>
>> On 1/11/20 2:08 AM, Jeff Moyer wrote:
>> > Hi, Aneesh,
>
>> "namespace0.2" not having a 2MB aligned size which cause namespace 0.1
>> start addr to be not aligned. Hence both the namespace are marked disabled.
>>
>
> 2 observations:
>
> - It's ok if the namespace start address is not subsection aligned as
> long as the mapped portion for data access is subsection aligned, at
> least on x86.
>
> - "sector" mode namespaces are not mapped by devm_memremap_pages() so
> there should be no restriction there. If powerpc can't map them that's
> a separate concern.

Does that mean the `supported_size_align` attribute should be a property
of pfn and dax seed device? Considering we don't want to apply this
restrictions for blk, raw namespace, and btt mode namespace should we
make the attribute a seed device property rather than a namespace
property?


>
> So, cross arch compatible namespaces is a goal, but not regressing
> existing namespaces takes precedence. I'd be happy if newly created
> namespaces tried to account for all the arch quirks, but if libnvdimm
> can enable a namespace it should try.

Ok. So that means we apply the alignment rules when creating new
namespaces irrespective of its type/mode. But when initializing via scan
label we only apply them for devdax and fsdax namespace?

Something like

static bool nvdimm_valid_namespace(struct device *dev,
		struct nd_namespace_common *ndns, resource_size_t size)
{
	struct nd_region *nd_region = to_nd_region(ndns->dev.parent);
	unsigned long align_size = arch_namespace_align_size();
	struct resource *res;
	u32 remainder;

	/*
	 * Don't validate the start and size for blk namespace type
	 */
	if (is_namespace_blk(&ndns->dev))
		return true;

	/*
	 * For btt and raw namespace we use ioremap. Assume both can work
	 * with PAGE_SIZE alignment.
	 */
	if (is_nd_btt(dev) || is_namespace_io(dev))
		return true;

	div_u64_rem(size, align_size * nd_region->ndr_mappings, &remainder);
	if (remainder)
		return false;

	if (is_namespace_pmem(&ndns->dev)) {
		struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(&ndns->dev);

		res = &nspm->nsio.res;
	} else
		/* cannot reach */
		return false;

	div_u64_rem(res->start, align_size * nd_region->ndr_mappings, &remainder);
	if (remainder)
		return false;

	return true;
}

-aneesh
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

      reply	other threads:[~2020-01-13 15:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08  6:52 [PATCH v3 1/6] libnvdimm/namespace: Make namespace size validation arch dependent Aneesh Kumar K.V
2020-01-08  6:52 ` [PATCH v3 2/6] libnvdimm/namespace: Validate namespace start addr and size Aneesh Kumar K.V
2020-01-08  6:52 ` [PATCH v3 3/6] libnvdimm/namespace: Validate namespace size when creating new namespace Aneesh Kumar K.V
2020-01-08  6:52 ` [PATCH v3 4/6] libnvdimm/namespace: Add debug check while initializing namespace resource size Aneesh Kumar K.V
2020-01-08  6:52 ` [PATCH v3 5/6] libnvdimm/namespace: Align DPA based on arch restrictions Aneesh Kumar K.V
2020-01-08  6:52 ` [PATCH v3 6/6] libnvdimm/namespace: Expose arch specific supported size align value Aneesh Kumar K.V
2020-01-10 20:38 ` [PATCH v3 1/6] libnvdimm/namespace: Make namespace size validation arch dependent Jeff Moyer
2020-01-10 21:03   ` Dan Williams
2020-01-11  4:29     ` Aneesh Kumar K.V
2020-01-11  4:33   ` Aneesh Kumar K.V
2020-01-11  4:55     ` Dan Williams
2020-01-13 15:08       ` Aneesh Kumar K.V [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=87lfqbl7gu.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.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.