[PATCH 21/26] dax/region: Prevent range mapping allocation on sparse regions

ira.weiny@intel.com posted 26 patches 1 year, 10 months ago
There is a newer version of this series
[PATCH 21/26] dax/region: Prevent range mapping allocation on sparse regions
Posted by Ira Weiny 1 year, 10 months ago
Sparse regions are not fully populated with memory and this complicates
range mapping of dax devices on those regions.  There is no use case for
range mapping on sparse regions.

Avoid the complication by prevent range mapping of dax devices on sparse
regions.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 drivers/dax/bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index bab19fc578d0..56dddaceeccb 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -1452,6 +1452,8 @@ static umode_t dev_dax_visible(struct kobject *kobj, struct attribute *a, int n)
 		return 0;
 	if (a == &dev_attr_mapping.attr && is_static(dax_region))
 		return 0;
+	if (a == &dev_attr_mapping.attr && is_sparse(dax_region))
+		return 0;
 	if ((a == &dev_attr_align.attr ||
 	     a == &dev_attr_size.attr) && is_static(dax_region))
 		return 0444;

-- 
2.44.0
Re: [PATCH 21/26] dax/region: Prevent range mapping allocation on sparse regions
Posted by Alison Schofield 1 year, 10 months ago
On Sun, Mar 24, 2024 at 04:18:24PM -0700, Ira Weiny wrote:

Perhaps lead w some words from prior patch to provide context:

"DAX regions mapping dynamic capacity partitions introduce a requirement
for the memory backing the region to come and go as required.  This
results in a DAX region with sparse areas of memory backing."

Or should this fold into: 
dax/region: Create extent resources on DAX region driver load

> Sparse regions are not fully populated with memory and this complicates
> range mapping of dax devices on those regions.  There is no use case for
> range mapping on sparse regions.
> 
> Avoid the complication by prevent range mapping of dax devices on sparse
> regions.

> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> ---
>  drivers/dax/bus.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index bab19fc578d0..56dddaceeccb 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1452,6 +1452,8 @@ static umode_t dev_dax_visible(struct kobject *kobj, struct attribute *a, int n)
>  		return 0;
>  	if (a == &dev_attr_mapping.attr && is_static(dax_region))
>  		return 0;
> +	if (a == &dev_attr_mapping.attr && is_sparse(dax_region))
> +		return 0;
>  	if ((a == &dev_attr_align.attr ||
>  	     a == &dev_attr_size.attr) && is_static(dax_region))
>  		return 0444;
> 
> -- 
> 2.44.0
>
Re: [PATCH 21/26] dax/region: Prevent range mapping allocation on sparse regions
Posted by Dave Jiang 1 year, 10 months ago

On 3/24/24 4:18 PM, Ira Weiny wrote:
> Sparse regions are not fully populated with memory and this complicates
> range mapping of dax devices on those regions.  There is no use case for
> range mapping on sparse regions.
> 
> Avoid the complication by prevent range mapping of dax devices on sparse
> regions.
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/dax/bus.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index bab19fc578d0..56dddaceeccb 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1452,6 +1452,8 @@ static umode_t dev_dax_visible(struct kobject *kobj, struct attribute *a, int n)
>  		return 0;
>  	if (a == &dev_attr_mapping.attr && is_static(dax_region))
>  		return 0;
> +	if (a == &dev_attr_mapping.attr && is_sparse(dax_region))
> +		return 0;
>  	if ((a == &dev_attr_align.attr ||
>  	     a == &dev_attr_size.attr) && is_static(dax_region))
>  		return 0444;
>