ndctl icon indicating copy to clipboard operation
ndctl copied to clipboard

namespace align with mode=memory is different

Open fyrchik opened this issue 8 years ago • 1 comments

Hello! I have a problem with creating namespaces in memory mode. I have tried to found some info myself. To my current understanding, align of namespace in memory mode must be equal to SECTION_SIZE (which is 128 MB on my kernel). Is it true?

Nevertheless in some cases I "can" create namespaces with such align (namespace0.2 below), but it can lead to node crash after I try to destroy them. After failed creation i can not create any more namespaces on this region until I delete this "not-fully-created" namespace. Here is the case (I use CentOS 7.4 on QEMU, NVDIMM is 1GB in size):

[root@kek ~]# uname -r
3.10.0-693.2.1.el7.x86_64
[root@kek ~]# ndctl create-namespace --mode memory --map mem --region region0 --size 64M
{
  "dev":"namespace0.0",
  "mode":"memory",
  "size":"62.00 MiB (65.01 MB)",
  "uuid":"bf875d51-5735-499d-95ed-3ee3f605dcca", 
  "blockdev":"pmem0",
  "numa_node":0 
} 
[root@kek ~]# ndctl create-namespace --mode memory --map mem --region region0 --size 64M
libndctl: ndctl_pfn_enable: pfn0.1: failed to enable
  Error: namespace0.1: failed to enable  

failed to create namespace: No such device or address
[root@kek ~]# ndctl destroy-namespace namespace0.1
destroyed 1 namespace                                                         
[root@kek ~]# ndctl create-namespace --mode memory --map mem --region region0 --size 64M
{ 
  "dev":"namespace0.2",    
  "mode":"memory",           
  "size":"62.00 MiB (65.01 MB)",
  "uuid":"a0a5b886-01a0-47ee-92e5-401d30f6693b",                               
  "blockdev":"pmem0.2",                                                                            
  "numa_node":0                                                                                        
} 
[root@kek ~]# tail -n4 /proc/iomem                                                
300000000-33ffdffff : Persistent Memory
  300000000-303ffffff : namespace0.0
  304000000-307ffffff : namespace0.2
400000000-43ffdffff : Persistent Memory
[root@kek ~]# ndctl destroy-namespace all -f

After the last line my node crashes. Unfortunately I have no resources to try to reproduce this on latest kernel. Can provide vmcore-dmesg.txt if needed.

The second problem is not so important, but annoying: For namespaces, which were created with mode=memory ndctl outputs not namespace UUID, but pfn UUID. I found this somewhat misleading, because I expect ndctl list to show the same uuid which I provided to ndctl create-namespace. Can you, please, explain, what is the motivation behind such decision? (i am not a kernel hacker in any way, just asking from user perspective)

fyrchik avatar Oct 18 '17 07:10 fyrchik

I'll take a look at recreating the create-namespace crash. As to the other question, the reason we use the pfn UUID instead of the raw namespace UUID is that it has a different data layout than the base namespace. In other words the UUID represents a unique state of data that can be accessed via a given block device (or character device in the device-dax case).

djbw avatar Nov 03 '17 13:11 djbw