All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvdimm/region: always show the 'align' attribute
@ 2020-05-20 22:50 Vishal Verma
  2020-05-20 23:20 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Vishal Verma @ 2020-05-20 22:50 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Dan Williams, Vishal Verma

It is possible that a platform that is capable of 'namespace labels'
comes up without the labels properly initialized. In this case, the
region's 'align' attribute is hidden. Howerver, once the user does
initialize he labels, the 'align' attribute still stays hidden, which is
unexpected.

The sysfs_update_group() API is meant to address this, and could be
called during region probe, but it has entanglements with the device
'lockdep_mutex'. Therefore, simply make the 'align' attribute always
visible. It doesn't matter what it says for label-less namespaces, since
it is not possible to change their allocation anyway.

Cc: Dan Williams <dan.j.williams@intel.com>
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 drivers/nvdimm/region_devs.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index ccbb5b43b8b2..4502f9c4708d 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -679,18 +679,8 @@ static umode_t region_visible(struct kobject *kobj, struct attribute *a, int n)
 		return a->mode;
 	}
 
-	if (a == &dev_attr_align.attr) {
-		int i;
-
-		for (i = 0; i < nd_region->ndr_mappings; i++) {
-			struct nd_mapping *nd_mapping = &nd_region->mapping[i];
-			struct nvdimm *nvdimm = nd_mapping->nvdimm;
-
-			if (test_bit(NDD_LABELING, &nvdimm->flags))
-				return a->mode;
-		}
-		return 0;
-	}
+	if (a == &dev_attr_align.attr)
+		return a->mode;
 
 	if (a != &dev_attr_set_cookie.attr
 			&& a != &dev_attr_available_size.attr)
-- 
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvdimm/region: always show the 'align' attribute
  2020-05-20 22:50 [PATCH] nvdimm/region: always show the 'align' attribute Vishal Verma
@ 2020-05-20 23:20 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2020-05-20 23:20 UTC (permalink / raw)
  To: Vishal Verma; +Cc: linux-nvdimm

On Wed, May 20, 2020 at 3:50 PM Vishal Verma <vishal.l.verma@intel.com> wrote:
>
> It is possible that a platform that is capable of 'namespace labels'
> comes up without the labels properly initialized. In this case, the
> region's 'align' attribute is hidden. Howerver, once the user does
> initialize he labels, the 'align' attribute still stays hidden, which is
> unexpected.
>
> The sysfs_update_group() API is meant to address this, and could be
> called during region probe, but it has entanglements with the device
> 'lockdep_mutex'. Therefore, simply make the 'align' attribute always

Looks good, I would just say "device_lock" here. The "lockdep_mutex"
is just a stand-in to show "device_lock" problems since the mutex that
device_lock() acquires is marked like this:

    lockdep_set_novalidate_class(&dev->mutex);

...I can fix this up on applying.

> visible. It doesn't matter what it says for label-less namespaces, since
> it is not possible to change their allocation anyway.
>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  drivers/nvdimm/region_devs.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index ccbb5b43b8b2..4502f9c4708d 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -679,18 +679,8 @@ static umode_t region_visible(struct kobject *kobj, struct attribute *a, int n)
>                 return a->mode;
>         }
>
> -       if (a == &dev_attr_align.attr) {
> -               int i;
> -
> -               for (i = 0; i < nd_region->ndr_mappings; i++) {
> -                       struct nd_mapping *nd_mapping = &nd_region->mapping[i];
> -                       struct nvdimm *nvdimm = nd_mapping->nvdimm;
> -
> -                       if (test_bit(NDD_LABELING, &nvdimm->flags))
> -                               return a->mode;
> -               }
> -               return 0;
> -       }
> +       if (a == &dev_attr_align.attr)
> +               return a->mode;
>
>         if (a != &dev_attr_set_cookie.attr
>                         && a != &dev_attr_available_size.attr)
> --
> 2.26.2
>
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-20 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 22:50 [PATCH] nvdimm/region: always show the 'align' attribute Vishal Verma
2020-05-20 23:20 ` Dan Williams

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.