linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* Re: Picking 0th namespace if it is idle
       [not found] <87a7f45qik.fsf@linux.ibm.com>
@ 2019-05-30  8:20 ` Aneesh Kumar K.V
  2019-07-23 15:00   ` Aneesh Kumar K.V
  2019-07-23 18:59   ` Dan Williams
  0 siblings, 2 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2019-05-30  8:20 UTC (permalink / raw)
  To: Dan Williams, vishal.l.verma; +Cc: linux-nvdimm

aneesh.kumar@linux.ibm.com (Aneesh Kumar K.V) writes:

> Hi Dan,
>
> With the patch series to mark the namespace disabled if we have mismatch
> in pfn superblock, we can endup with namespace0 marked idle/disabled.
>
> I am wondering why do do the below in ndctl.
>
>
> static struct ndctl_namespace *region_get_namespace(struct ndctl_region *region)
> {
> 	struct ndctl_namespace *ndns;
>
> 	/* prefer the 0th namespace if it is idle */
> 	ndctl_namespace_foreach(region, ndns)
> 		if (ndctl_namespace_get_id(ndns) == 0
> 				&& !is_namespace_active(ndns))
> 			return ndns;
> 	return ndctl_region_get_namespace_seed(region);
> }
>
> I have a kernel patch that will create a namespace_seed even if we fail
> to ename a pfn backing device. Something like below
>  
> @@ -747,12 +752,23 @@ static void nd_region_notify_driver_action(struct nvdimm_bus *nvdimm_bus,
>  		}
>  	}
>  	if (dev->parent && is_nd_region(dev->parent) && probe) {
>  		nd_region = to_nd_region(dev->parent);
>  		nvdimm_bus_lock(dev);
>  		if (nd_region->ns_seed == dev)
>  			nd_region_create_ns_seed(nd_region);
>  		nvdimm_bus_unlock(dev);
>  	}
> +
> +	if (dev->parent && is_nd_region(dev->parent) && !probe && (ret == -EOPNOTSUPP)) {
> +		nd_region = to_nd_region(dev->parent);
> +		nvdimm_bus_lock(dev);
> +		if (nd_region->ns_seed == dev)
> +			nd_region_create_ns_seed(nd_region);
> +		nvdimm_bus_unlock(dev);
> +	}
> +
>
> With that we can end up with something like the below after boot.
> :/sys/bus/nd/devices/region0$ sudo ndctl list -Ni        
> [                                                                          
>   {                                                                                                                                                    
>     "dev":"namespace0.1",                                                  
>     "mode":"fsdax",                                                        
>     "map":"mem",                                                           
>     "size":0,                                                              
>     "uuid":"00000000-0000-0000-0000-000000000000",                                                                                                     
>     "state":"disabled"                                                     
>   },                                                                       
>   {                                                                        
>     "dev":"namespace0.0",                                                  
>     "mode":"fsdax",                  
>     "map":"mem",                                                           
>     "size":2147483648,               
>     "uuid":"094e703b-4bf8-4078-ad42-50bebc03e538",                                                                                                     
>     "state":"disabled"                                                                                                                                 
>   }                                                                        
> ]                                             
>
> namespace0.0 is the one we failed to initialize due to PAGE_SIZE
> mismatch. 
>
> We do have namespace_seed pointing to namespacece0.1 correct. But a ndtl
> create-namespace will pick namespace0.0 even if we have seed file
> pointing to namespacec0.1.
>
>
> I am trying to resolve the issues related to creation of new namespaces
> when we have some namespace marked disabled due to pfn_sb setting
> mismatch.
>
> -aneesh

With that ndctl namespace0.0 selection commented out, we do get pick the
right idle namespace.

#ndctl list -Ni
[                         
  {                
    "dev":"namespace0.1",
    "mode":"fsdax",                                                        
    "map":"mem",      
    "size":0,
    "uuid":"00000000-0000-0000-0000-000000000000",
    "state":"disabled"   
  },               
  {             
    "dev":"namespace0.0",
    "mode":"fsdax",                                                        
    "map":"mem",  
    "size":2147483648,   
    "uuid":"0c31ae4b-b053-43c7-82ff-88574e2585b0",
    "state":"disabled"
  }  
]   

after ndctl create-namespace -s 2G -r region0                   


# ndctl list -Ni                                           
[                     
  {                    
    "dev":"namespace0.2",
    "mode":"fsdax",       
    "map":"mem",   
    "size":0,   
    "uuid":"00000000-0000-0000-0000-000000000000",
    "state":"disabled"
  },
  {
    "dev":"namespace0.1",
    "mode":"fsdax",
    "map":"dev",
    "size":2130706432,
    "uuid":"60970059-9412-4eeb-9e7a-b314585a4da3",
    "align":65536,
    "blockdev":"pmem0.1",
    "supported_alignments":[
      65536
    ]
  },
  {
    "dev":"namespace0.0",
    "mode":"fsdax",
    "map":"mem",
    "size":2147483648,
    "uuid":"0c31ae4b-b053-43c7-82ff-88574e2585b0",
    "state":"disabled"
  }
]

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: Picking 0th namespace if it is idle
  2019-05-30  8:20 ` Picking 0th namespace if it is idle Aneesh Kumar K.V
@ 2019-07-23 15:00   ` Aneesh Kumar K.V
  2019-07-23 18:59   ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2019-07-23 15:00 UTC (permalink / raw)
  To: Dan Williams, vishal.l.verma; +Cc: linux-nvdimm

Hi Dan,

Can you help with this question?

-aneesh

Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> writes:

> aneesh.kumar@linux.ibm.com (Aneesh Kumar K.V) writes:
>
>> Hi Dan,
>>
>> With the patch series to mark the namespace disabled if we have mismatch
>> in pfn superblock, we can endup with namespace0 marked idle/disabled.
>>
>> I am wondering why do do the below in ndctl.
>>
>>
>> static struct ndctl_namespace *region_get_namespace(struct ndctl_region *region)
>> {
>> 	struct ndctl_namespace *ndns;
>>
>> 	/* prefer the 0th namespace if it is idle */
>> 	ndctl_namespace_foreach(region, ndns)
>> 		if (ndctl_namespace_get_id(ndns) == 0
>> 				&& !is_namespace_active(ndns))
>> 			return ndns;
>> 	return ndctl_region_get_namespace_seed(region);
>> }
>>
>> I have a kernel patch that will create a namespace_seed even if we fail
>> to ename a pfn backing device. Something like below
>>  
>> @@ -747,12 +752,23 @@ static void nd_region_notify_driver_action(struct nvdimm_bus *nvdimm_bus,
>>  		}
>>  	}
>>  	if (dev->parent && is_nd_region(dev->parent) && probe) {
>>  		nd_region = to_nd_region(dev->parent);
>>  		nvdimm_bus_lock(dev);
>>  		if (nd_region->ns_seed == dev)
>>  			nd_region_create_ns_seed(nd_region);
>>  		nvdimm_bus_unlock(dev);
>>  	}
>> +
>> +	if (dev->parent && is_nd_region(dev->parent) && !probe && (ret == -EOPNOTSUPP)) {
>> +		nd_region = to_nd_region(dev->parent);
>> +		nvdimm_bus_lock(dev);
>> +		if (nd_region->ns_seed == dev)
>> +			nd_region_create_ns_seed(nd_region);
>> +		nvdimm_bus_unlock(dev);
>> +	}
>> +
>>
>> With that we can end up with something like the below after boot.
>> :/sys/bus/nd/devices/region0$ sudo ndctl list -Ni        
>> [                                                                          
>>   {                                                                                                                                                    
>>     "dev":"namespace0.1",                                                  
>>     "mode":"fsdax",                                                        
>>     "map":"mem",                                                           
>>     "size":0,                                                              
>>     "uuid":"00000000-0000-0000-0000-000000000000",                                                                                                     
>>     "state":"disabled"                                                     
>>   },                                                                       
>>   {                                                                        
>>     "dev":"namespace0.0",                                                  
>>     "mode":"fsdax",                  
>>     "map":"mem",                                                           
>>     "size":2147483648,               
>>     "uuid":"094e703b-4bf8-4078-ad42-50bebc03e538",                                                                                                     
>>     "state":"disabled"                                                                                                                                 
>>   }                                                                        
>> ]                                             
>>
>> namespace0.0 is the one we failed to initialize due to PAGE_SIZE
>> mismatch. 
>>
>> We do have namespace_seed pointing to namespacece0.1 correct. But a ndtl
>> create-namespace will pick namespace0.0 even if we have seed file
>> pointing to namespacec0.1.
>>
>>
>> I am trying to resolve the issues related to creation of new namespaces
>> when we have some namespace marked disabled due to pfn_sb setting
>> mismatch.
>>
>> -aneesh
>
> With that ndctl namespace0.0 selection commented out, we do get pick the
> right idle namespace.
>
> #ndctl list -Ni
> [                         
>   {                
>     "dev":"namespace0.1",
>     "mode":"fsdax",                                                        
>     "map":"mem",      
>     "size":0,
>     "uuid":"00000000-0000-0000-0000-000000000000",
>     "state":"disabled"   
>   },               
>   {             
>     "dev":"namespace0.0",
>     "mode":"fsdax",                                                        
>     "map":"mem",  
>     "size":2147483648,   
>     "uuid":"0c31ae4b-b053-43c7-82ff-88574e2585b0",
>     "state":"disabled"
>   }  
> ]   
>
> after ndctl create-namespace -s 2G -r region0                   
>
>
> # ndctl list -Ni                                           
> [                     
>   {                    
>     "dev":"namespace0.2",
>     "mode":"fsdax",       
>     "map":"mem",   
>     "size":0,   
>     "uuid":"00000000-0000-0000-0000-000000000000",
>     "state":"disabled"
>   },
>   {
>     "dev":"namespace0.1",
>     "mode":"fsdax",
>     "map":"dev",
>     "size":2130706432,
>     "uuid":"60970059-9412-4eeb-9e7a-b314585a4da3",
>     "align":65536,
>     "blockdev":"pmem0.1",
>     "supported_alignments":[
>       65536
>     ]
>   },
>   {
>     "dev":"namespace0.0",
>     "mode":"fsdax",
>     "map":"mem",
>     "size":2147483648,
>     "uuid":"0c31ae4b-b053-43c7-82ff-88574e2585b0",
>     "state":"disabled"
>   }
> ]

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: Picking 0th namespace if it is idle
  2019-05-30  8:20 ` Picking 0th namespace if it is idle Aneesh Kumar K.V
  2019-07-23 15:00   ` Aneesh Kumar K.V
@ 2019-07-23 18:59   ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2019-07-23 18:59 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: linux-nvdimm

On Thu, May 30, 2019 at 1:20 AM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> aneesh.kumar@linux.ibm.com (Aneesh Kumar K.V) writes:
>
> > Hi Dan,
> >
> > With the patch series to mark the namespace disabled if we have mismatch
> > in pfn superblock, we can endup with namespace0 marked idle/disabled.
> >
> > I am wondering why do do the below in ndctl.
> >
> >
> > static struct ndctl_namespace *region_get_namespace(struct ndctl_region *region)
> > {
> >       struct ndctl_namespace *ndns;
> >
> >       /* prefer the 0th namespace if it is idle */
> >       ndctl_namespace_foreach(region, ndns)
> >               if (ndctl_namespace_get_id(ndns) == 0
> >                               && !is_namespace_active(ndns))
> >                       return ndns;
> >       return ndctl_region_get_namespace_seed(region);

Without this change if you create 2 namespaces, destroy those two
namespaces and then create another namespace that newest namespace
might end up being namespace0.1 instead of namespace0.0. This ends up
confusing end users that don't understand why they end up with
/dev/pmem0.1 and then at reboot it changes back to /dev/pmem0. So it's
purely a cosmetic detail.

I think we could teach ndctl about how to detect this case as separate
from a typically idle namespace state. Effectively pfn-device bind
failures due to missing page size support is a new error state that
ndctl needs to be made aware of independent of the typical idle state.
However, all I think is needed here is to fallback to
ndctl_region_get_namespace_seed() if ndctl_namespace_get_size() is
non-zero.

> > }
> >
> > I have a kernel patch that will create a namespace_seed even if we fail
> > to ename a pfn backing device. Something like below
> >
> > @@ -747,12 +752,23 @@ static void nd_region_notify_driver_action(struct nvdimm_bus *nvdimm_bus,
> >               }
> >       }
> >       if (dev->parent && is_nd_region(dev->parent) && probe) {
> >               nd_region = to_nd_region(dev->parent);
> >               nvdimm_bus_lock(dev);
> >               if (nd_region->ns_seed == dev)
> >                       nd_region_create_ns_seed(nd_region);
> >               nvdimm_bus_unlock(dev);
> >       }
> > +
> > +     if (dev->parent && is_nd_region(dev->parent) && !probe && (ret == -EOPNOTSUPP)) {
> > +             nd_region = to_nd_region(dev->parent);
> > +             nvdimm_bus_lock(dev);
> > +             if (nd_region->ns_seed == dev)
> > +                     nd_region_create_ns_seed(nd_region);
> > +             nvdimm_bus_unlock(dev);
> > +     }
> > +
> >
> > With that we can end up with something like the below after boot.
> > :/sys/bus/nd/devices/region0$ sudo ndctl list -Ni
> > [
> >   {
> >     "dev":"namespace0.1",
> >     "mode":"fsdax",
> >     "map":"mem",
> >     "size":0,
> >     "uuid":"00000000-0000-0000-0000-000000000000",
> >     "state":"disabled"
> >   },
> >   {
> >     "dev":"namespace0.0",
> >     "mode":"fsdax",
> >     "map":"mem",
> >     "size":2147483648,
> >     "uuid":"094e703b-4bf8-4078-ad42-50bebc03e538",
> >     "state":"disabled"
> >   }
> > ]
> >
> > namespace0.0 is the one we failed to initialize due to PAGE_SIZE
> > mismatch.
> >
> > We do have namespace_seed pointing to namespacece0.1 correct. But a ndtl
> > create-namespace will pick namespace0.0 even if we have seed file
> > pointing to namespacec0.1.
> >
> >
> > I am trying to resolve the issues related to creation of new namespaces
> > when we have some namespace marked disabled due to pfn_sb setting
> > mismatch.
> >
> > -aneesh
>
> With that ndctl namespace0.0 selection commented out, we do get pick the
> right idle namespace.
>
> #ndctl list -Ni
> [
>   {
>     "dev":"namespace0.1",
>     "mode":"fsdax",
>     "map":"mem",
>     "size":0,
>     "uuid":"00000000-0000-0000-0000-000000000000",
>     "state":"disabled"
>   },
>   {
>     "dev":"namespace0.0",
>     "mode":"fsdax",
>     "map":"mem",
>     "size":2147483648,

Yes, this being non-zero means the namespace is not idle.

Maybe with --force we can ignore the size checking and just reclaim
the 0th namespace for a new namespace.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2019-07-23 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87a7f45qik.fsf@linux.ibm.com>
2019-05-30  8:20 ` Picking 0th namespace if it is idle Aneesh Kumar K.V
2019-07-23 15:00   ` Aneesh Kumar K.V
2019-07-23 18:59   ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).