ndctl icon indicating copy to clipboard operation
ndctl copied to clipboard

ndctl align option doesnt fallback to default value

Open swdavenport opened this issue 7 years ago • 2 comments

Tested on ndctl v59.2

While trying our align option for ndctl, it was observed that, it takes only 2 values as valid input, 2M and 1G. While the default value of 2M is mentioned, the man page, 1G is not noted.

-a, --align Applications that want to establish dax memory mappings with page table entries greater than system base page size (4K on x86) need a persistent memory namespace that is sufficiently aligned. For "fsdax" and "devdax" mode this defaults to 2M. Note that "devdax" mode enforces all mappings to be aligned to this value, i.e. it fails unaligned mapping attempts. The "fsdax" alignment setting determines the starting alignment of filesystem extents and may limit the possible granularities, if a large mapping is not possible it will silently fall back to a smaller page size.

Also, the last line in the page says for "fsdax" mappings, if the align size is not a feasible one, it falls back to a smaller page size.

root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 16G Error: unsupported align: 16G

failed to reconfigure namespace: No such device or address root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 2G Error: unsupported align: 2G

failed to reconfigure namespace: No such device or address

root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 2M { "dev":"namespace1.0", "mode":"fsdax", "size":"50.00 GiB (53.69 GB)", "sector_size":512, "blockdev":"pmem1", "numa_node":0 } root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 1G { "dev":"namespace1.0", "mode":"fsdax", "size":"50.00 GiB (53.69 GB)", "sector_size":512, "blockdev":"pmem1", "numa_node":0 }

ndctl isn't silently falling back to a smaller page size.

swdavenport avatar May 16 '18 20:05 swdavenport

The fallback to a smaller page size is referring to the eventual dax mappings of files from the filesystem mounted on this device. We'll fix up the documentation and also disallow unsupported alignment sizes.

djbw avatar May 25 '18 20:05 djbw

FYI. Doc gap still present in v62:

root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 1G { "dev":"namespace1.0", "mode":"fsdax", "map":"mem", "size":"2.00 GiB (2.15 GB)", "sector_size":512, "blockdev":"pmem1", "numa_node":0 } root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 2G Error: unsupported align: 2G

failed to reconfigure namespace: No such device or address root# ndctl list [ { "dev":"namespace1.0", "mode":"fsdax", "map":"mem", "size":2147483648, "blockdev":"pmem1" }, { "dev":"namespace0.0", "mode":"fsdax", "map":"mem", "size":2147483648, "blockdev":"pmem0" } ] root# ndctl create-namespace -f -e namespace1.0 -m memory -M mem -a 16G Error: unsupported align: 16G

failed to reconfigure namespace: No such device or address

swdavenport avatar Oct 16 '18 22:10 swdavenport