All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Oliver O'Halloran <oohall@gmail.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH] nvdimm: Export supported alignments via sysfs
Date: Thu, 27 Apr 2017 08:59:50 -0700	[thread overview]
Message-ID: <CAPcyv4id9q+6mKtqqJYzGdVN74Q5=-Rzirizs+U0RiJ-oF2Kyw@mail.gmail.com> (raw)
In-Reply-To: <20170427091552.17694-1-oohall@gmail.com>

On Thu, Apr 27, 2017 at 2:15 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
> Adds two new sysfs attributes for pfn (and dax) devices:
> supported_alignements and default_alignment. These advertise to
> userspace what alignments this kernel supports, and provides a nominal
> default alignment to use.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
> I'm not sure it makes sense to provide these for pfn devices. In the dax
> case we have hard restrictions because of how fault handling works, but
> I'm not convinced this makes sense for the pfn case since it's going to
> be used with fs-dax.

We still want this for fs-dax so we can make sure that the namespace
is aligned to allow for opportunistic large mappings. We have pmd
support for fs-dax currently shipping, and looking to expand that to
pud support.

> ---
>  drivers/nvdimm/pfn_devs.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 6c033c9a2f06..5157e7d89f0b 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -260,6 +260,30 @@ static ssize_t size_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(size);
>
> +static ssize_t supported_alignments_show(struct device *dev,
> +               struct device_attribute *attr, char *buf)
> +{
> +       /* Fun fact: These aren't always constants! */
> +       unsigned long supported_alignments[] = {
> +               PAGE_SIZE,
> +               HPAGE_PMD_SIZE,
> +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
> +               HPAGE_PUD_SIZE,
> +#endif
> +               0,
> +       };
> +
> +       return nd_sector_size_show(0, supported_alignments, buf);
> +}
> +DEVICE_ATTR_RO(supported_alignments);
> +
> +static ssize_t default_alignment_show(struct device *dev,
> +               struct device_attribute *attr, char *buf)
> +{
> +       return sprintf(buf, "%ld\n", HPAGE_PMD_SIZE);
> +}
> +DEVICE_ATTR_RO(default_alignment);
> +
>  static struct attribute *nd_pfn_attributes[] = {
>         &dev_attr_mode.attr,
>         &dev_attr_namespace.attr,
> @@ -267,6 +291,8 @@ static struct attribute *nd_pfn_attributes[] = {
>         &dev_attr_align.attr,
>         &dev_attr_resource.attr,
>         &dev_attr_size.attr,
> +       &dev_attr_supported_alignments.attr,
> +       &dev_attr_default_alignment.attr,
>         NULL,

So, we don't need DEVICE_ATTR_RO(default_alignment), that can be
reflected by setting nd_pfn->align to HPAGE_PMD_SIZE by default and
passing nd_pfn->align to nd_sector_size_show(). Should probably rename
nd_sector_size_show() to nd_size_select_show().

The other concern is that the current DEVICE_ATTR_RW(align) can be
made redundant by this new interface if you make it writable. I wonder
if we can avoid breaking old ndctl versions by making the current
align setting the first one in the output? Worse comes to worse we can
live with two attributes 'align' and 'aligns', but I'd like to see if
can add this to the existing attribute.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-04-27 15:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27  9:15 [PATCH] nvdimm: Export supported alignments via sysfs Oliver O'Halloran
2017-04-27 15:59 ` Dan Williams [this message]
2017-04-27 16:18   ` Dan Williams
2017-04-28  5:59     ` Oliver O'Halloran
2017-04-28  7:31   ` Oliver O'Halloran
2017-05-02 21:57     ` Dan Williams
2017-05-03  3:25       ` Oliver O'Halloran
2017-05-03  4:17         ` Dan Williams
2017-05-03  7:08           ` Oliver O'Halloran
2017-05-03 15:38             ` Dan Williams
2017-05-12 23:01               ` 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='CAPcyv4id9q+6mKtqqJYzGdVN74Q5=-Rzirizs+U0RiJ-oF2Kyw@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=oohall@gmail.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 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.