Coder Social home page Coder Social logo

pmem / ndctl Goto Github PK

View Code? Open in Web Editor NEW
261.0 38.0 135.0 3.57 MB

A "device memory" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics.

License: Other

Shell 8.37% C 88.10% Roff 1.73% Meson 1.81%
linux-kernel nvdimm cxl dax

ndctl's Introduction

ndctl

Utility library for managing the libnvdimm (non-volatile memory device) sub-system in the Linux kernel

Packaging status

Build

meson setup build;
meson compile -C build;

Optionally, to install:

meson install -C build

There are a number of packages required for the build steps that may not be installed by default. For information about the required packages, see the "BuildRequires:" lines in ndctl.spec.in.

https://github.com/pmem/ndctl/blob/main/ndctl.spec.in

Documentation

See the latest documentation for the NVDIMM kernel sub-system here:

https://www.kernel.org/doc/html/latest/driver-api/nvdimm/index.html

A getting started guide is also available on the kernel.org nvdimm wiki:

https://nvdimm.wiki.kernel.org/start

Unit Tests

The unit tests run by meson test require the nfit_test.ko module to be loaded. To build and install nfit_test.ko:

  1. Obtain the kernel source. For example,
    git clone -b libnvdimm-for-next git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git

  2. Skip to step 3 if the kernel version is >= v4.8. Otherwise, for kernel versions < v4.8, configure the kernel to make some memory available to CMA (contiguous memory allocator). This will be used to emulate DAX.

    CONFIG_DMA_CMA=y
    CONFIG_CMA_SIZE_MBYTES=200
    

    or
    cma=200M on the kernel command line.

  3. Compile the libnvdimm sub-system as a module, make sure "zone device" memory is enabled, and enable the btt, pfn, and dax features of the sub-system:

    CONFIG_X86_PMEM_LEGACY=m
    CONFIG_ZONE_DEVICE=y
    CONFIG_LIBNVDIMM=m
    CONFIG_BLK_DEV_PMEM=m
    CONFIG_BTT=y
    CONFIG_NVDIMM_PFN=y
    CONFIG_NVDIMM_DAX=y
    CONFIG_DEV_DAX_PMEM=m
    CONFIG_ENCRYPTED_KEYS=y
    CONFIG_NVDIMM_SECURITY_TEST=y
    CONFIG_STRICT_DEVMEM=y
    CONFIG_IO_STRICT_DEVMEM=y
    
  4. Build and install the unit test enabled libnvdimm modules in the following order. The unit test modules need to be in place prior to the depmod that runs during the final modules_install

    make M=tools/testing/nvdimm
    sudo make M=tools/testing/nvdimm modules_install
    sudo make modules_install
    
  5. CXL test

    The unit tests will also run CXL tests by default. In order to make these work, we need to install the cxl_test.ko as well.

    Obtain the CXL kernel source(optional). For example, git clone -b pending git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git

    Enable CXL-related kernel configuration options.

    CONFIG_CXL_BUS=m
    CONFIG_CXL_PCI=m
    CONFIG_CXL_ACPI=m
    CONFIG_CXL_PMEM=m
    CONFIG_CXL_MEM=m
    CONFIG_CXL_PORT=m
    CONFIG_CXL_REGION=y
    CONFIG_CXL_REGION_INVALIDATION_TEST=y
    CONFIG_DEV_DAX_CXL=m
    
  6. Install cxl_test and related mock modules.

    make M=tools/testing/cxl
    sudo make M=tools/testing/cxl modules_install
    sudo make modules_install
    
  7. Now run meson test -C build in the ndctl source directory, or ndctl test, if ndctl was built with -Dtest=enabled as a configuration option to meson.

  8. To run the 'destructive' set of tests that may clobber existing pmem configurations and data, configure meson with the destructive option after the meson setup step:

    meson configure -Dtest=enabled -Ddestructive=enabled build;
    

Troubleshooting

The unit tests will validate that the environment is set up correctly before they try to run. If the platform is misconfigured, i.e. the unit test modules are not available, or the test versions of the modules are superseded by the "in-tree/production" version of the modules meson test will skip tests and report a message like the following in build/meson-logs/testlog.txt

SKIP: libndctl
==============
test/init: nfit_test_init: nfit.ko: appears to be production version: /lib/modules/4.8.8-200.fc24.x86_64/kernel/drivers/acpi/nfit/nfit.ko.xz
__ndctl_test_skip: explicit skip test_libndctl:2684
nfit_test unavailable skipping tests

If the unit test modules are indeed available in the modules 'extra' directory the default depmod policy can be overridden by adding a file to /etc/depmod.d with the following contents:

override nfit * extra
override device_dax * extra
override dax_pmem * extra
override dax_pmem_core * extra
override dax_pmem_compat * extra
override libnvdimm * extra
override nd_btt * extra
override nd_e820 * extra
override nd_pmem * extra

The nfit_test module emulates pmem with memory allocated via vmalloc(). One of the side effects is that this breaks 'physically contiguous' assumptions in the driver. Use the '--align=4K option to 'ndctl create-namespace' to avoid these corner case scenarios.

ndctl's People

Contributors

ahkok avatar alisonschofield avatar amotin avatar bgbhpe avatar davejiang avatar dcui avatar djbw avatar hramrach avatar jeffmoyer avatar jpemartins avatar lplewa avatar minwooim avatar mmizuma avatar nwmoulin avatar oohal avatar pbalcer avatar qifuli avatar redhairerintel avatar robertcelliott avatar santoshs avatar shivaprasadgbhat avatar stellarhopper avatar tiwai avatar toshikani avatar vaibhav92 avatar weiny2 avatar yangx-jy avatar yizhanglinux avatar zhijianli88 avatar zhiqiangliu26 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ndctl's Issues

Clearing devdax poison addresses

When you use ndctl to inject/clear a devdax block, block = 0 refers the start of the dax device.
For instance:
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region22/dax22.0/resource
and not
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region22/namespace22.0/resource

There are 2 issues that occur as a result of this.

  1. Minor: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region22/badblocks, block 0 refers to the start of the namespace. You cannot just plug in the block # from the badblock list to ndctl. You have to do some math.

  2. How do you clear a poison in the "metadata" region. The area between the start of the region namespace and dax?

Make fails on Ubuntu

I believe I have all of the required libraries and packages installed.

Autogen and Configure steps run smoothly, but when I ran make, there is an error relating to the uuid. I am not too familiar with this and could use some guidance.

root@NVDIMM:# git clone https://github.com/pmem/ndctl.git
Cloning into 'ndctl'...
remote: Counting objects: 2546, done.
remote: Total 2546 (delta 0), reused 0 (delta 0), pack-reused 2546
Receiving objects: 100% (2546/2546), 722.16 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1751/1751), done.
Checking connectivity... done.
root@NVDIMM:
# cd ndctl/
root@NVDIMM:/ndctl# ls
autogen.sh ccan contrib daxctl git-version licenses Makefile.am make-git-snapshot.sh ndctl.spec.in README.md sles test.h
builtin.h configure.ac COPYING Documentation git-version-gen m4 Makefile.am.in ndctl nfit.h rpmbuild.sh test util
root@NVDIMM:
/ndctl# uname -a
Linux NVDIMM 4.8.0-41-generic #44-Ubuntu SMP Fri Mar 3 15:27:17 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
root@NVDIMM:/ndctl# ./autogen.sh
Activated pre-commit hook.
GIT_VERSION = 56
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: linking file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt
obsolete.m4'
configure.ac:22: installing 'build-aux/compile'
configure.ac:27: installing 'build-aux/config.guess'
configure.ac:27: installing 'build-aux/config.sub'
configure.ac:10: installing 'build-aux/install-sh'
configure.ac:10: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'


Initialized build system. For a common configuration please run:

./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib

root@NVDIMM:~/ndctl# ./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define EXTENSIONS... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for a sed that does not truncate output... (cached) /bin/sed
checking for asciidoc... /usr/bin/asciidoc
checking for xmlto... /usr/bin/xmlto
checking for typeof syntax and keyword spelling... typeof
checking whether byte ordering is bigendian... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for KMOD... yes
checking for UDEV... yes
checking for UUID... yes
checking for JSON... yes
checking for BASH_COMPLETION... yes
checking for ARS support... yes
checking for CLEAR ERR support... yes
checking for device DAX support... yes
checking for SMART support... yes
checking for linux/version.h... yes
checking for __secure_getenv... no
checking for secure_getenv... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating daxctl/lib/Makefile
config.status: creating ndctl/lib/Makefile
config.status: creating ndctl/Makefile
config.status: creating daxctl/Makefile
config.status: creating test/Makefile
config.status: creating Documentation/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing gen-libndctl.h commands

    ndctl 56
    =====

    prefix:                 /usr
    sysconfdir:             /etc
    libdir:                 /usr/lib
    includedir:             ${prefix}/include

    compiler:               gcc
    cflags:                 -g -O0
    ldflags:

    logging:                yes
    debug:                  no

root@NVDIMM:~/ndctl# make
GEN version.m4
make --no-print-directory all-recursive
GEN version.m4
Making all in .
GEN version.m4
CC ccan/str/str.o
CC ccan/str/debug.o
CC ccan/list/list.o
AR libccan.a
ar: u' modifier ignored since D' is the default (see U') CC util/parse-options.o CC util/usage.o CC util/size.o CC util/main.o CC util/help.o CC util/strbuf.o CC util/wrapper.o CC util/filter.o AR libutil.a ar: u' modifier ignored since D' is the default (see U')
GEN rhel/ndctl.spec
GEN sles/ndctl.spec
Making all in daxctl/lib
CC ../../util/sysfs.lo
CC ../../util/log.lo
CC libdaxctl.lo
CCLD libdaxctl.la
GEN libdaxctl.pc
Making all in ndctl/lib
make --no-print-directory all-am
CC libndctl.lo
CC libndctl-ars.lo
CC libndctl-smart.lo
CC libndctl-hpe1.lo
CCLD libndctl.la
GEN libndctl.pc
Making all in ndctl
CC ndctl.o
CC builtin-create-nfit.o
CC builtin-xaction-namespace.o
CC builtin-xable-region.o
CC builtin-dimm.o
CC ../util/log.o
CC builtin-list.o
CC builtin-test.o
CC ../util/json.o
CC util/json-smart.o
CCLD ndctl
Making all in daxctl
CC daxctl.o
CC list.o
CC ../util/json.o
CCLD daxctl
/usr/bin/ld: ../util/json.o: undefined reference to symbol 'uuid_unparse@@UUID_1.0'
//lib/x86_64-linux-gnu/libuuid.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:458: recipe for target 'daxctl' failed
make[2]: *** [daxctl] Error 1
Makefile:736: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
Makefile:523: recipe for target 'all' failed
make: *** [all] Error 2

ndctl prints wrong badblock_count

# ndctl list -BiRND
{
  "provider":"e820",
  "dev":"ndbus0",
  "regions":[
    {
      "dev":"region1",
      "size":2147483648,
      "available_size":0,
      "type":"pmem",
      "namespaces":[
        {
          "dev":"namespace1.0",
          "mode":"dax",
          "size":2111832064,
          "uuid":"a7cbcca2-d244-42e6-989c-e2569f8af45e",
          "badblock_count":21968
        }
      ]
    },
    {
      "dev":"region0",
      "size":2147483648,
      "available_size":0,
      "type":"pmem",
      "namespaces":[
        {
          "dev":"namespace0.0",
          "mode":"dax",
          "size":2111832064,
          "uuid":"13cb4b70-04e0-4fb6-b8ad-87aac3a8ea8e",
          "badblock_count":21968
        }
      ]
    },
    {
      "dev":"region2",
      "size":2147483648,
      "available_size":0,
      "type":"pmem",
      "namespaces":[
        {
          "dev":"namespace2.0",
          "mode":"dax",
          "size":2111832064,
          "uuid":"2b60fb85-0223-4073-a597-d334040236d0",
          "badblock_count":21968
        }
      ]
    }
  ]
}
# cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-4.11.3-200.fc25.x86_64 root=/dev/mapper/fedora-root ro nokaslr memmap=2G!4G memmap=2G!6G memmap=2G!8G LANG=en_US.UTF-8
# ndctl --version
57

ndctl list -X returns different output than specified in documentation

repro:
ndctl list -X

{
"dev":"namespace0.0",
"mode":"dax",
"size":1054867456,
"uuid":"033c78b2-39f4-428d-85d1-88941905f848",
"daxregion":{
"id":0,
"devices":[
{
"chardev":"dax0.0",
"size":1035993088
}
]
},
"numa_node":0
}

There is no alignment or size specified in daxregion (listed in documentation), and sizes differ.
ndctl version: 58.2

fix init-labels operation count

# ndctl init-labels all
nmem5: regions active, abort label write
nmem4: regions active, abort label write
nmem3: regions active, abort label write
nmem2: regions active, abort label write
nmem1: regions active, abort label write
nmem0: regions active, abort label write
initialized 1016 nmems

Make check on OpenSuse 4.12.0-rc4-2-default

OS:OpenSuse 4.12.0-rc4-2-default

I configure kernel as "Unit Tests", and nfit_test loaded, but still failed when make check? Is anything wrong in my environment?

dmesg.txt
lsmod.txt
test-suite.txt

config.txt

SKIP: dsm-fail

test/init: nfit_test_init: libnvdimm.ko: expected taint: O got:
__ndctl_test_skip: explicit skip test_dsm_fail:177
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x1c6c270 released
attempted: 1 skipped: 1
SKIP dsm-fail (exit status: 77)

SKIP: dpa-alloc

test/init: nfit_test_init: libnvdimm.ko: expected taint: O got:
__ndctl_test_skip: explicit skip test_dpa_alloc:304
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x961270 released
attempted: 1 skipped: 1
SKIP dpa-alloc (exit status: 77)

SKIP: parent-uuid

test/init: nfit_test_init: libnvdimm.ko: expected taint: O got:
__ndctl_test_skip: explicit skip test_parent_uuid:234
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x6e2270 released
attempted: 1 skipped: 1
SKIP parent-uuid (exit status: 77)

SKIP: multi-pmem

test/init: nfit_test_init: libnvdimm.ko: expected taint: O got:
__ndctl_test_skip: explicit skip test_multi_pmem:271
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x2501270 released
attempted: 1 skipped: 1
SKIP multi-pmem (exit status: 77)

FAIL: create.sh

  • DEV=
  • NDCTL=../ndctl/ndctl
  • BUS='-b nfit_test.0'
  • json2var='s/[{}",]//g; s/:/=/g'
  • SECTOR_SIZE=4096
  • rc=77
  • set -e
  • check_min_kver 4.5
  • local ver=4.5
    ++ uname -r
  • : 4.12.0-rc4-2-default+
  • '[' -n 4.5 ']'
    ++ echo -e '4.5\n4.12.0-rc4-2-default+'
    ++ sort -V
    ++ head -1
  • [[ 4.5 == \4.\5 ]]
  • set -e
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • ../ndctl/ndctl enable-region -b nfit_test.0 all
    libndctl: ndctl_region_enable: region1: failed to enable
    libndctl: ndctl_region_enable: region3: failed to enable
    libndctl: ndctl_region_enable: region5: failed to enable
    libndctl: ndctl_region_enable: region2: failed to enable
    libndctl: ndctl_region_enable: region4: failed to enable
    libndctl: ndctl_region_enable: region6: failed to enable
    enabled 0 regions
  • rc=1
  • dev=x
    ++ ../ndctl/ndctl create-namespace -b nfit_test.0 -t pmem -m raw
    failed to create namespace: no suitable capacity found
  • json=
    ++ err 52
    ++ echo 'test/create: failed at line 52'
    test/create: failed at line 52
    ++ exit 1
    FAIL create.sh (exit status: 1)

FAIL: clear.sh

  • DEV=
  • NDCTL=../ndctl/ndctl
  • BUS='-b nfit_test.0'
  • BUS1='-b nfit_test.1'
  • json2var='s/[{}",]//g; s/:/=/g'
  • rc=77
  • set -e
  • check_min_kver 4.6
  • local ver=4.6
    ++ uname -r
  • : 4.12.0-rc4-2-default+
  • '[' -n 4.6 ']'
    ++ echo -e '4.6\n4.12.0-rc4-2-default+'
    ++ sort -V
    ++ head -1
  • [[ 4.6 == \4.\6 ]]
  • set -e
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • ../ndctl/ndctl enable-region -b nfit_test.0 all
    libndctl: ndctl_region_enable: region1: failed to enable
    libndctl: ndctl_region_enable: region3: failed to enable
    libndctl: ndctl_region_enable: region5: failed to enable
    libndctl: ndctl_region_enable: region2: failed to enable
    libndctl: ndctl_region_enable: region4: failed to enable
    libndctl: ndctl_region_enable: region6: failed to enable
    enabled 0 regions
  • rc=1
  • dev=x
    ++ ../ndctl/ndctl create-namespace -b nfit_test.0 -t pmem -m raw
    failed to create namespace: no suitable capacity found
  • json=
    ++ err 52
    ++ echo 'test/clear: failed at line 52'
    test/clear: failed at line 52
    ++ exit 1
    FAIL clear.sh (exit status: 1)

SKIP: dax-errors.sh

  • DEV=
  • NDCTL=../ndctl/ndctl
  • BUS='-b nfit_test.0'
  • BUS1='-b nfit_test.1'
  • MNT=test_dax_mnt
  • FILE=image
  • json2var='s/[{}",]//g; s/:/=/g'
  • rc=77
  • check_min_kver 4.7
  • local ver=4.7
    ++ uname -r
  • : 4.12.0-rc4-2-default+
  • '[' -n 4.7 ']'
    ++ echo -e '4.7\n4.12.0-rc4-2-default+'
    ++ sort -V
    ++ head -1
  • [[ 4.7 == \4.\7 ]]
  • set -e
  • mkdir -p test_dax_mnt
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • ../ndctl/ndctl enable-region -b nfit_test.0 all
    libndctl: ndctl_region_enable: region1: failed to enable
    libndctl: ndctl_region_enable: region3: failed to enable
    libndctl: ndctl_region_enable: region5: failed to enable
    libndctl: ndctl_region_enable: region2: failed to enable
    libndctl: ndctl_region_enable: region4: failed to enable
    libndctl: ndctl_region_enable: region6: failed to enable
    enabled 0 regions
  • rc=1
  • dev=x
    ++ ../ndctl/ndctl create-namespace -b nfit_test.0 -t pmem -m raw
    failed to create namespace: no suitable capacity found
  • json=
    ++ err 62
    ++ rc=1
    ++ echo 'test/dax-errors: failed at line 62'
    test/dax-errors: failed at line 62
    ++ rm -f image
    ++ rm -f test_dax_mnt/image
    ++ '[' -n '' ']'
    ++ rc=77
    ++ rmdir test_dax_mnt
    ++ exit 77
    SKIP dax-errors.sh (exit status: 77)

FAIL: daxdev-errors.sh

  • DEV=
  • NDCTL=../ndctl/ndctl
  • DAXCTL=../daxctl/daxctl
  • BUS='-b nfit_test.0'
  • BUS1='-b nfit_test.1'
  • json2var='s/[{}",]//g; s/:/=/g'
  • rc=77
  • check_min_kver 4.12
  • local ver=4.12
    ++ uname -r
  • : 4.12.0-rc4-2-default+
  • '[' -n 4.12 ']'
    ++ echo -e '4.12\n4.12.0-rc4-2-default+'
    ++ sort -V
    ++ head -1
  • [[ 4.12 == \4.\1\2 ]]
  • set -e
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • ../ndctl/ndctl enable-region -b nfit_test.0 all
    libndctl: ndctl_region_enable: region1: failed to enable
    libndctl: ndctl_region_enable: region3: failed to enable
    libndctl: ndctl_region_enable: region5: failed to enable
    libndctl: ndctl_region_enable: region2: failed to enable
    libndctl: ndctl_region_enable: region4: failed to enable
    libndctl: ndctl_region_enable: region6: failed to enable
    enabled 0 regions
  • query='. | sort_by(.available_size) | reverse | .[0].dev'
    ++ ../ndctl/ndctl list -b nfit_test.0 -t pmem -Ri
    ++ jq -r '. | sort_by(.available_size) | reverse | .[0].dev'
    ./daxdev-errors.sh: line 49: jq: command not found
  • region=
    ++ err 49
    ++ rc=1
    ++ echo 'test/daxdev-errors: failed at line 49'
    test/daxdev-errors: failed at line 49
    ++ exit 1
    FAIL daxdev-errors.sh (exit status: 1)

SKIP: btt-check.sh

kernel 4.12.0-rc4-2-default+ may not support badblocks clearing on pmem via btt
SKIP btt-check.sh (exit status: 77)

SKIP: label-compat.sh

  • NDCTL=../ndctl/ndctl
  • BUS='-b nfit_test.0'
  • BUS1='-b nfit_test.1'
  • rc=77
  • set -e
  • check_min_kver 4.11
  • local ver=4.11
    ++ uname -r
  • : 4.12.0-rc4-2-default+
  • '[' -n 4.11 ']'
    ++ echo -e '4.11\n4.12.0-rc4-2-default+'
    ++ sort -V
    ++ head -1
  • [[ 4.11 == \4.\1\1 ]]
  • set -e
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • query='. | sort_by(.available_size) | reverse | .[0].dev'
    ++ ../ndctl/ndctl list -b nfit_test.0 -t pmem -Ri
    ++ jq -r '. | sort_by(.available_size) | reverse | .[0].dev'
    ./label-compat.sh: line 47: jq: command not found
  • region=
    ++ err 47
    ++ echo 'test/label-compat.sh: failed at line 47'
    test/label-compat.sh: failed at line 47
    ++ exit 77
    SKIP label-compat.sh (exit status: 77)

FAIL: blk-exhaust.sh

  • NDCTL=../ndctl/ndctl
  • BUS='-b nfit_test.0'
  • BUS1='-b nfit_test.1'
  • rc=77
  • set -e
  • check_min_kver 4.11
  • local ver=4.11
    ++ uname -r
  • : 4.12.0-rc4-2-default+
  • '[' -n 4.11 ']'
    ++ echo -e '4.11\n4.12.0-rc4-2-default+'
    ++ sort -V
    ++ head -1
  • [[ 4.11 == \4.\1\1 ]]
  • set -e
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • ../ndctl/ndctl enable-region -b nfit_test.0 all
    libndctl: ndctl_region_enable: region1: failed to enable
    libndctl: ndctl_region_enable: region3: failed to enable
    libndctl: ndctl_region_enable: region5: failed to enable
    libndctl: ndctl_region_enable: region2: failed to enable
    libndctl: ndctl_region_enable: region4: failed to enable
    libndctl: ndctl_region_enable: region6: failed to enable
    enabled 0 regions
  • rc=1
  • ../ndctl/ndctl create-namespace -b nfit_test.0 -t pmem
    failed to create namespace: no suitable capacity found
    ++ err 49
    ++ echo 'test/label-compat.sh: failed at line 49'
    test/label-compat.sh: failed at line 49
    ++ exit 1
    FAIL blk-exhaust.sh (exit status: 1)

Install libnvdimm fail

Hi,

  1. I download kernel with the command
    git clone -b libnvdimm-for-next git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git

  2. Copy my .config into libnvdimm directory, and reconfigure .config manually to match the following setting
    CONFIG_ZONE_DEVICE=y
    CONFIG_LIBNVDIMM=m
    CONFIG_BLK_DEV_PMEM=m
    CONFIG_ND_BLK=m
    CONFIG_BTT=y
    CONFIG_NVDIMM_PFN=y
    CONFIG_NVDIMM_DAX=y

  3. make M=tools/testing/nvdimm, and get the following message:

CC [M] tools/testing/nvdimm/config_check.o
In file included from ./include/asm-generic/bug.h:4:0,
from ./arch/x86/include/asm/bug.h:81,
from ./include/linux/bug.h:4,
from tools/testing/nvdimm/config_check.c:1:
tools/testing/nvdimm/config_check.c: In function ‘check’:
./include/linux/compiler.h:529:38: error: call to ‘__compiletime_assert_9’ declared with attribute error: BUILD_BUG_ON failed: !IS_MODULE(CONFIG_LIBNVDIMM)
_compiletime_assert(condition, msg, _compiletime_assert, LINE)
^
./include/linux/compiler.h:512:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix();
^~~~~~
./include/linux/compiler.h:529:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, _compiletime_assert, LINE)
^~~~~~~~~~~~~~~~~~~
./include/linux/bug.h:54:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
./include/linux/bug.h:78:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
tools/testing/nvdimm/config_check.c:9:2: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(!IS_MODULE(CONFIG_LIBNVDIMM));
^~~~~~~~~~~~
scripts/Makefile.build:302: recipe for target 'tools/testing/nvdimm/config_check.o' failed
make[1]: *** [tools/testing/nvdimm/config_check.o] Error 1
Makefile:1512: recipe for target '_module_tools/testing/nvdimm' failed
make: *** [_module_tools/testing/nvdimm] Error 2

It seems that the setting CONFIG_LIBNVDIMM is not be "m". But i pretty sure it is be "m" in .config.
Is anything wrong in the process?

"make check" can not be executed due to link error of libuuid and libkmod

Hello,

I tried to build ndctl, and I executed "make check",
but I met link error of libuuid like followings.

/usr/bin/ld: multi-pmem.o: undefined reference to symbol 'uuid_unparse@@UUID_1.0' 
//lib/x86_64-linux-gnu/libuuid.so.1: error adding symbols: DSO missing from command line

Not only libuuid, but also libkmod has similar problem.
If possible, please fix them.

Environment: Ubuntu 14.04LTS

I confirmed that the newest libraries are installed.

$ sudo apt-get install libuuid1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libuuid1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

$ sudo apt-get install uuid-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
uuid-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 391 not upgraded.

sudo apt-get install libkmod-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libkmod-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

sudo apt-get install libkmod2   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libkmod2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Here is the log what I did.

$ ./autogen.sh 

----------------------------------------------------------------
Initialized build system. For a common configuration please run:
----------------------------------------------------------------

./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib

$ ./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
  :
(snip)
  :
config.status: executing libtool commands
config.status: executing gen-libndctl.h commands

        ndctl 55
        =====

        prefix:                 /usr
        sysconfdir:             /etc
        libdir:                 /usr/lib
        includedir:             ${prefix}/include

        compiler:               gcc -std=gnu99
        cflags:                 -g -O0
        ldflags:                

        logging:                yes
        debug:                  no

$ make
  GEN      version.m4
make --no-print-directory all-recursive
  GEN      version.m4
Making all in .
  GEN      version.m4
  CC       util/filter.o
  AR       libutil.a
Making all in daxctl/lib
  GEN      libdaxctl.pc
Making all in ndctl/lib
make --no-print-directory all-am
  CC       libndctl.lo
  CC       libndctl-ars.lo
  CC       libndctl-smart.lo
  CC       libndctl-hpe1.lo
  CCLD     libndctl.la
  GEN      libndctl.pc
Making all in ndctl
  CC       ndctl.o
  CC       builtin-xaction-namespace.o
  CC       builtin-xable-region.o
  CC       builtin-dimm.o
  CC       builtin-list.o
  CC       util/json.o
  CC       util/json-smart.o
  CCLD     ndctl
Making all in Documentation
  GEN      ndctl.xml
   :
   :

$ make check
  GEN      version.m4
make --no-print-directory check-recursive
  GEN      version.m4
Making check in .
  GEN      version.m4
Making check in daxctl/lib
make[2]: Nothing to be done for `check'.
Making check in ndctl/lib
make --no-print-directory check-am
make[3]: Nothing to be done for `check-am'.
Making check in ndctl
make[2]: Nothing to be done for `check'.
Making check in Documentation
make[2]: Nothing to be done for `check'.
Making check in test
make --no-print-directory libndctl dsm-fail dpa-alloc parent-uuid multi-pmem dax-errors 
  CC       libndctl.o
  CC       core.o
  CCLD     libndctl
  CC       dsm-fail.o
  CC       ../util/sysfs.o
  CCLD     dsm-fail
  CC       dpa-alloc.o
  CCLD     dpa-alloc
  CC       parent-uuid.o
  CCLD     parent-uuid
  CC       multi-pmem.o
  CC       ../ndctl/builtin-xaction-namespace.o
  CCLD     multi-pmem
/usr/bin/ld: multi-pmem.o: undefined reference to symbol 'uuid_unparse@@UUID_1.0' 
//lib/x86_64-linux-gnu/libuuid.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[3]: *** [multi-pmem] Error 1
make[2]: *** [check-am] Error 2
make[1]: *** [check-recursive] Error 1
make: *** [check] Error 2

If I add "-luuid -lkmod" at CFLAGS of ./configure like followings, then link error does not occur.

$ ./configure CFLAGS='-g -O0 -luuid -lkmod' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
 :
 :
 make check
  GEN      version.m4
make --no-print-directory check-recursive
  GEN      version.m4
Making check in .
  GEN      version.m4
Making check in daxctl/lib
make[2]: Nothing to be done for `check'.
Making check in ndctl/lib
make --no-print-directory check-am
make[3]: Nothing to be done for `check-am'.
Making check in ndctl
make[2]: Nothing to be done for `check'.
Making check in Documentation
make[2]: Nothing to be done for `check'.
Making check in test
make --no-print-directory libndctl dsm-fail dpa-alloc parent-uuid multi-pmem dax-errors 
  CC       libndctl.o
  CCLD     libndctl
  CC       dsm-fail.o
  CCLD     dsm-fail
  CC       dpa-alloc.o
  CCLD     dpa-alloc
  CC       parent-uuid.o
  CCLD     parent-uuid
  CC       multi-pmem.o
  CC       ../ndctl/builtin-xaction-namespace.o
  CCLD     multi-pmem
  CC       dax-errors.o
  CCLD     dax-errors
make --no-print-directory check-TESTS
SKIP: libndctl
SKIP: dsm-fail
SKIP: dpa-alloc
SKIP: parent-uuid
SKIP: multi-pmem
SKIP: create.sh
SKIP: clear.sh
SKIP: dax-errors.sh
make[5]: Nothing to be done for `all'.
============================================================================
Testsuite summary for ndctl 55
============================================================================
# TOTAL: 8
# PASS:  0
# SKIP:  8
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

I confirmed this error does not occur on CentOS7.

Thanks,

'ndctl check-namespace all' should skip destroyed namespaces

OS Version: Fedora 28 (4.17.2-200.fc28.x86_64)
NDCTL Version: 61.4.g08a96c6

After creating several namespaces using different modes within a region, then destroying all but one of them, I then ran 'ndctl check-namespace all' which resulted in the following error:

# ndctl check-namespace all
libndctl: ndctl_namespace_enable: namespace0.2: failed to enable
namespace0.2: namespace_check: namespace0.2: failed to enable in raw mode: No such device or address (-6)
error checking namespaces: No such device or address

The 'destroyed' namespace (namespace0.2) still appears in ndctl check-namespace <tab> and ndctli list -Ni. Forcibly destroying it doesn't remove it. Destroyed "label-less" namespaces is discussed in Issue #41 which describes why namespace0.2 is still shown. I understand the reason. We need a solid approach to completely destroy 'label-less' namespaces and/or skip them when using ndctl commands that support the 'all' option to avoid errors such as the one shown above. There's no need to operate on such namespaces.

Here's the entire config including DIMMs, Regions, and Namespaces for completeness:

# ndctl list -iNuRD
{
  "dimms":[
    {
      "dev":"nmem0",
      "id":"8089-a2-1809-00000107",
      "handle":"0x1",
      "phys_id":"0x1d"
    }
  ],
  "regions":[
    {
      "dev":"region0",
      "size":"125.00 GiB (134.22 GB)",
      "available_size":"105.00 GiB (112.74 GB)",
      "type":"pmem",
      "numa_node":0,
      "iset_id":"0x97e6da9010198a22",
      "mappings":[
        {
          "dimm":"nmem0",
          "offset":"0x10000000",
          "length":"0x1f40000000",
          "position":0
        }
      ],
      "persistence_domain":"memory_controller",
      "namespaces":[
        {
          "dev":"namespace0.2",
          "mode":"raw",
          "size":0,
          "uuid":"00000000-0000-0000-0000-000000000000",
          "sector_size":512,
          "state":"disabled",
          "numa_node":0
        },
        {
          "dev":"namespace0.0",
          "mode":"sector",
          "size":"19.98 GiB (21.45 GB)",
          "uuid":"8bbdac85-20d6-42a1-be50-4f9b3b92aec2",
          "raw_uuid":"0375339a-ef93-4a79-bcd9-9b33a1b63292",
          "sector_size":4096,
          "blockdev":"pmem0s",
          "name":"prod_web_db1",
          "numa_node":0
        }
      ]
    }
  ]
}

ndctl list -RM cannot show the badblocks

the version of ndctl:60.3+

As i inject an error using cscript( a tool provided by intel),the ndctl list -RM command cannot show the badblocks afterwards. It seems like random case,I used to find it work well.

Notes:After I do read instruction in OS,CPU will triggere MCE as expected.Then, ndctl list -RM can show the badblock info.

cannot destroy namespace - namespace is always mapped (as raw)

I am trying to destroy all namespaces using the following commands

[root@116BG-11 ~]# ndctl destroy-namespace namespace0.0 -f
destroyed 1 namespace
[root@116BG-11 ~]# ndctl destroy-namespace namespace1.0 -f
destroyed 1 namespace

Prior to reboot the namespaces do not exist (empty result on ndctl list --namspaces)

the only problem is that post reboot i see the namespace still exist as "raw" mapping :-(
why is that ? what am i missing ?

[root@116BG-11 ~]# ndctl list --namespaces
[
{
"dev":"namespace1.0",
"mode":"raw",
"size":17179869184,
"blockdev":"pmem1"
},
{
"dev":"namespace0.0",
"mode":"raw",
"size":17179869184,
"blockdev":"pmem0"
}
]

I have the following configuration:
root@116BG-11 ~]# ndctl list -BiRN
{
"provider":"ACPI.NFIT",
"dev":"ndbus0",
"regions":[
{
"dev":"region1",
"size":17179869184,
"available_size":0,
"type":"pmem",
"namespaces":[
{
"dev":"namespace1.0",
"mode":"dax",
"size":16909336576,
"uuid":"78cfc2a0-06cd-4f07-a5e5-b9c5679fc1bd"
}
]
},
{
"dev":"region0",
"size":17179869184,
"available_size":0,
"type":"pmem",
"namespaces":[
{
"dev":"namespace0.0",
"mode":"dax",
"size":16909336576,
"uuid":"982f8580-9d9d-42e7-81a0-b098fe07b8e9"
}
]
}
]
}

available_size=0 and namespace size=0 -- unable to manipulate namespaces

We somehow got into a state below... This is where available size is suddenly zero. Pretty much everything we tried is not working. What could be wrong and how do we debug/fix?

Things tried
destroy-namespace + create-namespace
disable-region + init-labels + enable-region + destroy-namespace
reconfig -- create-namespace with -e -f

{
"dev":"region12",
"size":3163243413504,
"available_size":0,
"type":"pmem",
"numa_node":0,
"iset_id":-803247374216399120,
"persistence_domain":"memory_controller",
"namespaces":[
{
"dev":"namespace12.0",
"mode":"raw",
"size":0,
"uuid":"00000000-0000-0000-0000-000000000000",
"sector_size":512,
"state":"disabled",
"numa_node":0
}
]
},
{
"dev":"region13",
"size":3163243413504,
"available_size":0,
"type":"pmem",
"numa_node":1,
"iset_id":8826574528721778416,
"persistence_domain":"memory_controller",
"namespaces":[
{
"dev":"namespace13.0",
"mode":"raw",
"size":0,
"uuid":"00000000-0000-0000-0000-000000000000",
"sector_size":512,
"state":"disabled",
"numa_node":1
}
]
},

"regions":[
{
"dev":"region12",
"size":3163243413504,
"available_size":0,
"type":"pmem",
"numa_node":0,
"iset_id":-803247374216399120,
"mappings":[
{
"dimm":"nmem3",
"offset":268435456,
"length":527207235584,
"position":5
},
{
"dimm":"nmem5",
"offset":268435456,
"length":527207235584,
"position":1
},
{
"dimm":"nmem4",
"offset":268435456,
"length":527207235584,
"position":3
},
{
"dimm":"nmem0",
"offset":268435456,
"length":527207235584,
"position":2
},
{
"dimm":"nmem2",
"offset":268435456,
"length":527207235584,
"position":4
},
{
"dimm":"nmem1",
"offset":268435456,
"length":527207235584,
"position":0
}
],
"persistence_domain":"memory_controller"
},
{
"dev":"region13",
"size":3163243413504,
"available_size":0,
"type":"pmem",
"numa_node":1,
"iset_id":8826574528721778416,
"mappings":[
{
"dimm":"nmem9",
"offset":268435456,
"length":527207235584,
"position":5
},
{
"dimm":"nmem11",
"offset":268435456,
"length":527207235584,
"position":1
},
{
"dimm":"nmem10",
"offset":268435456,
"length":527207235584,
"position":3
},
{
"dimm":"nmem6",
"offset":268435456,
"length":527207235584,
"position":2
},
{
"dimm":"nmem8",
"offset":268435456,
"length":527207235584,
"position":4
},
{
"dimm":"nmem7",
"offset":268435456,
"length":527207235584,
"position":0
}
],
"persistence_domain":"memory_controller"
}
]

Skip sector-mode test in make check

My linux kernel is 4.14.0-rc1-mytest. I have an issue as following.

~/ndctl$ sudo make check
GEN version.m4
make --no-print-directory check-recursive
GEN version.m4
Making check in .
GEN version.m4
Making check in daxctl/lib
make[2]: Nothing to be done for 'check'.
Making check in ndctl/lib
make --no-print-directory check-am
make[3]: Nothing to be done for 'check-am'.
Making check in ndctl
make[2]: Nothing to be done for 'check'.
Making check in daxctl
make[2]: Nothing to be done for 'check'.
Making check in Documentation/ndctl
make[2]: Nothing to be done for 'check'.
Making check in Documentation/daxctl
make[2]: Nothing to be done for 'check'.
Making check in test
make --no-print-directory libndctl dsm-fail dpa-alloc parent-uuid multi-pmem dax-errors daxdev-errors
make[3]: 'libndctl' is up to date.
make[3]: 'dsm-fail' is up to date.
make[3]: 'dpa-alloc' is up to date.
make[3]: 'parent-uuid' is up to date.
make[3]: 'multi-pmem' is up to date.
make[3]: 'dax-errors' is up to date.
make[3]: 'daxdev-errors' is up to date.
make --no-print-directory check-TESTS
PASS: libndctl
PASS: dsm-fail
PASS: dpa-alloc
PASS: parent-uuid
PASS: multi-pmem
PASS: create.sh
PASS: clear.sh
PASS: dax-errors.sh
PASS: daxdev-errors.sh
PASS: multi-dax.sh
PASS: btt-check.sh
PASS: label-compat.sh
PASS: blk-exhaust.sh
SKIP: sector-mode.sh

Testsuite summary for ndctl 58.2

TOTAL: 14

PASS: 13

SKIP: 1

XFAIL: 0

FAIL: 0

XPASS: 0

ERROR: 0

test/test-suite.log

ndctl 58.2: test/test-suite.log

TOTAL: 14

PASS: 13

SKIP: 1

XFAIL: 0

FAIL: 0

XPASS: 0

ERROR: 0

.. contents:: :depth: 2

SKIP: sector-mode.sh

  • NDCTL=../ndctl/ndctl
  • BUS='-b nfit_test.0'
  • BUS1='-b nfit_test.1'
  • TEST=./sector-mode.sh
  • rc=77
  • set -e
  • trap 'err $LINENO' ERR
  • modprobe nfit_test
  • ../ndctl/ndctl disable-region -b nfit_test.0 all
    disabled 6 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.0 all
    zeroed 4 nmems
  • ../ndctl/ndctl enable-region -b nfit_test.0 all
    enabled 6 regions
  • ../ndctl/ndctl disable-region -b nfit_test.1 all
    disabled 2 regions
  • ../ndctl/ndctl zero-labels -b nfit_test.1 all
    zeroed 2 nmems
  • echo 'DIMMs on -b nfit_test.1 support labels, skip...'
    DIMMs on -b nfit_test.1 support labels, skip...
  • ../ndctl/ndctl enable-region -b nfit_test.1 all
    enabled 2 regions
  • false
    ++ err 38
    ++ echo './sector-mode.sh: failed at line 38'
    ./sector-mode.sh: failed at line 38
    ++ exit 77
    SKIP sector-mode.sh (exit status: 77)

Is anything i miss or un-install in my system?

failed make check

Hi pmem community for ndctl

I am playing with kernel 4.4.0 with the necessary DAX configuration enabled following the guide on https://nvdimm.wiki.kernel.org/.

I sucessfully mounted pmem dax.

df -h |fgrep /mnt/mem
/dev/pmem0 16G 44M 15G 1% /mnt/mem

then I tred make/make check in ndctl home.

I got the following error and I don't understand if it is because of configuration or because of anything else.

by executing lsmod |grep nfit_test I got the following

nfit_test 24576 4
nfit 32768 1 nfit_test
nfit_test_iomap 16384 1 nfit_test
libnvdimm 98304 5 nfit,nd_e820,nd_pmem,nfit_test,nd_btt

However, here is my make check result in test-suit.log

FAIL: test/libndctl
===================

libkmod: DEBUG ../libkmod/libkmod.c:392 kmod_pool_get_module: get module name='nfit_test' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:400 kmod_pool_add_module: add 0x7e9020 key='nfit_test'
check_set_config_data: dimm: 0 read2 data miscompare: 0
check_set_config_data: dimm: 0x1 read2 data miscompare: 0
check_set_config_data: dimm: 0x100 read2 data miscompare: 0
check_set_config_data: dimm: 0x101 read2 data miscompare: 0
libndctl: ndctl_region_enable: region7: failed to enable
libndctl: ndctl_region_enable: region6: failed to enable
libndctl: ndctl_region_enable: region5: failed to enable
libndctl: ndctl_region_enable: region4: failed to enable
libndctl: ndctl_region_enable: region3: failed to enable
libndctl: ndctl_btt_enable: btt1.0: failed to enable
btt1.0: expected btt enable success, region1 read-write
namespace1.0: failed to create btt
namespace1.0: failed to configure namespace
ndctl-test0 failed: -6
libkmod: ERROR ../libkmod/libkmod-module.c:769 kmod_module_remove_module: could not remove 'nfit_test': Resource temporarily unavailable
libndctl: ndctl_unref: context 0x7e32e0 released
zhuguoliang think kver is 263168

FAIL: test/dpa-alloc
====================

libndctl: ndctl_region_enable: region3: failed to enable
failed to find a usable BLK region
libndctl: ndctl_unref: context 0xf7c2e0 released
zhuguoliang think kver is 263168

FAIL: test/parent-uuid
======================

failed to create block namespace
libkmod: ERROR ../libkmod/libkmod-module.c:769 kmod_module_remove_module: could not remove 'nfit_test': Resource temporarily unavailable
libndctl: ndctl_unref: context 0x1f8b2e0 released
zhuguoliang think kver is 263168

FAIL: test/create.sh

ndctl check-namespace on a non-sector device doesnt exit gracefully

Tested on ndctl 59.2

Given a non-sector mode namespace:
root# ndctl list -n namespace12.0
{
"dev":"namespace12.0",
"mode":"memory",
"size":132118478848,
"uuid":"892241da-97ec-4042-b8e3-990884c4a61b",
"sector_size":512,
"blockdev":"pmem12",
"numa_node":1
}

root# ndctl check-namespace namespace12.0 -f
namespace12.0: namespace_check: Unable to recover any BTT info blocks
error checking namespaces: No such device or address

The man page says that the command only supports "sector" mode device,
so one would think that "ndctl" should not even attempt to check
namespace12.0
as it is not "sector" mode. however, it appears that "ndctl" didn't
'screen' for "sector" mode, 'dmesg' below show the work invoked in kernel
which could have been avoided.

root# dmesg
[ 3608.495949] nvdimm_bus_remove: nd_bus ndbus0: nd_pmem.remove(pfn12.1) = 0
[ 3619.105941] namespace_store: nd pfn12.1: namespace_store: result: 2 wrote:

[ 3619.106037] nd_pfn_release: nd pfn12.1: nd_pfn_release
[ 3619.106707] pmem12: detected capacity change from 0 to 134217728000
[ 3619.106711] nvdimm_bus_probe: nd_bus ndbus0: nd_pmem.probe(namespace12.0)
= 0
[ 3619.110546] nvdimm_bus_remove: nd_bus ndbus0:
nd_pmem.remove(namespace12.0) = 0
[ 3619.118021] nd_pfn_probe: nd_pmem namespace12.0: nd_pfn_probe: pfn:
pfn12.1
[ 3619.118024] nvdimm_bus_probe: nd_bus ndbus0: nd_pmem.probe(namespace12.0)
= -6
[ 3643.586137] pmem12: detected capacity change from 0 to 132118478848
[ 3643.586175] nvdimm_bus_probe: nd_bus ndbus0: nd_pmem.probe(pfn12.1) = 0

ndctl list -D enhancements

Can we get the following in ndctl list -D.

Basically trying to get all the information via ndctl vs going to several different locations for basic DIMM information.

Since ndctl support upgrading firmware, it would be nice to know what the current firmware version is.

  • FW Version

Basic information from NFIT or from SMBIOS Type 17 tables if they exist.

  • Serial Number
  • Manufacturer

Platform Identification, from SMBIOS Type 17 tables if they exist

  • Part Number
  • Bank Locator
  • Serial number
  • Size (physical capacity) of the DIMM.

ndctl "destroy-namespace -f all " does not operate correctly

Tested with ndctl v60.1

ndctl destroy-namespace command does not monitor success/failure for issued
commands and reports incorrect status. The following two scenarios
illustrate the behavior:

  1. Issuing a forced destroy all namespace command reports the same number
    consistently everytime:

root# ndctl destroy-namespace -f all
destroyed 15 namespaces
root# ndctl destroy-namespace -f all
destroyed 15 namespaces

The reported count of 15 namespaces is inclusive of the default "raw" mode
namespaces that are present for each region with a size of 0 and reporting
state disabled e.g.
{
"dev":"namespace12.1",
"mode":"raw",
"size":0,
"uuid":"00000000-0000-0000-0000-000000000000",
"sector_size":-1,
"state":"disabled",
"numa_node":1
},

These are not destroy-able and persist on. The destroy-namespace all command
should omit such namespaces and only attempt to destroy the ones that are
user created and of a non-zero size.

  1. One of the namespaces does not get destroyed despite the force flag. This
    appears to be due to the namespace having been mounted to a mount point. The
    command should return a coherent message stating that only X namespaces could
    be destroyed due to one namespace being in use or something to that effect.

root# ndctl destroy-namespace -f all
destroyed 15 namespaces
root# ndctl list
{
"dev":"namespace12.0",
"mode":"memory",
"size":132118478848,
"uuid":"6bc4959e-e428-4a73-9480-6eac69df78c3",
"sector_size":512,
"blockdev":"pmem12",
"numa_node":1
}
root# lsblk | grep pmem12
pmem12 259:2 0 123G 0 disk /olt-storage

install failed and abnormal info printed

I git clone and try to install at a small host.
I follow the build step from README:

root@vm-lkp-nex04-8G-6 /tmp/ndctl# ./autogen.sh
----------------------------------------------------------------
Initialized build system. For a common configuration please run:
----------------------------------------------------------------

./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib

root@vm-lkp-nex04-8G-6 /tmp/ndctl# ./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for a sed that does not truncate output... (cached) /bin/sed
checking for asciidoc... missing
configure: error: asciidoc needed to build documentation
root@vm-lkp-nex04-8G-6 /tmp/ndctl# make`
make: *** No targets specified and no makefile found.  Stop.
root@vm-lkp-nex04-8G-6 /tmp/ndctl# make check
make: *** No rule to make target 'check'.  Stop.
root@vm-lkp-nex04-8G-6 /tmp/ndctl# make install
make: *** No rule to make target 'install'.  Stop.

I am confused about it.
Could you help me and tell me how to fix it?

ndctl failed to create start cmd

if (!(*ars_cap->firmware_status >> ARS_EXT_STATUS_SHIFT & type)) {

cmd = ndctl_bus_cmd_new_ars_cap(bus, base+offset, blocks*512);
if (!cmd) {
fprintf(stderr, "%s: bus: %s failed to create cmd\n", func, ndctl_bus_get_provider(bus));
return -ENOTTY;
}
rc = ndctl_cmd_submit(cmd);
if (rc) {
fprintf(stderr, "%s: bus: %s failed to submit cmd: %d\n", func, ndctl_bus_get_provider(bus), rc);
ndctl_cmd_unref(cmd);
return rc;
}

i found the *ars_cap->firmware_status always be 0 after function(ndctl_cmd_submit) return

start_cmd = ndctl_bus_cmd_new_ars_start(cmd, 2);
if (!start_cmd) {
fprintf(stderr, "%s: bus: %s failed to create start cmd\n", func, ndctl_bus_get_provider(bus));
return -ENOTTY;
}

FAIL:multi-pmem

when I run command “make check”, I get the following message:
image
How do I fix it?

ars timeout

ndctl it fails to show the badblocks after ARS(ndctl start-scrub;ndctl wait-scrub).
In dmesg,it records:"nift ACPI0012:00: range 1 ars timeout,aborting"...it seems like ARS fails..

ndctl not show the dimm information

My machine has two 8G NVDIMMs and OS is SUSE with kernel v4.4.21.
I try to use the ndctl to manage them, but something goes wrong.
The information below is provided by this tool.

linux-4o54:/home/viking # ndctl list -BiRN
{
  "provider":"e820",
  "dev":"ndbus0",
  "regions":[
    {
      "dev":"region0",
      "size":17179869184,
      "available_size":0,
      "type":"pmem",
      "namespaces":[
        {
          "dev":"namespace0.0",
          "mode":"memory",
          "size":17179869184,
          "blockdev":"pmem0"
        }
      ]
    }
  ]
}

Howerver, when I try to use ndctl list --dimms to show the dimm information, the ndctl shows nothing for me.

Additionally, I want to reconfigure namespace, so I try to destroy the current one.
After I execute the "destroy" command, I can still enable the "destroyed" namespace.

linux-4o54:/home/viking # ndctl list --namespaces
{
  "dev":"namespace0.0",
  "mode":"memory",
  "size":17179869184,
  "blockdev":"pmem0"
}
linux-4o54:/home/viking # ndctl disable-namespace namespace0.0 
disabled 1 namespace
linux-4o54:/home/viking # ndctl destroy-namespace all
destroyed 1 namespace
linux-4o54:/home/viking # ndctl list --namespaces
linux-4o54:/home/viking # ndctl list --regions
{
  "dev":"region0",
  "size":17179869184,
  "available_size":0,
  "type":"pmem"
}
linux-4o54:/home/viking # ndctl enable-namespace namespace0.0 
enabled 1 namespace

Finally, as we can see above, we only have one region, so does it means that the NVDIMMs only support "PMEM" type?

ndctl doesn't show the size for btt namespaces

As reported in email:

My system has 4 8G NVDIMMs and I have them configured in different ways, as you can
see from the ndctl output:

$ ndctl list
[
{
"dev":"namespace3.0",
"mode":"raw",
"size":8589934592,
"blockdev":"pmem3"
},
{
"dev":"namespace2.0",
"mode":"memory",
"size":8587837440,
"uuid":"2567d762-68ae-486b-a6eb-2d3ab1b9dca9",
"blockdev":"pmem2"
},
{
"dev":"namespace1.0",
"mode":"sector",
"uuid":"44fb474e-7db8-4438-ad95-05ecb9f2075e",
"sector_size":4096,
"blockdev":"pmem1s"
},
{
"dev":"namespace0.0",
"mode":"memory",
"size":8453619712,
"uuid":"933ed54b-5b64-47f1-8409-c88f7c846522",
"blockdev":"pmem0"
}
]

The two memory namespaces have different sizes because one is --map=dev and the other is --map=mem.
It would be nice if the map option was displayed but my question is about the size value for the
btt device, or lack of one.

All the namespaces show a size except for the btt. The btt only shows a sector size. There
is no size value exposed by the btt sysfs information, which is probably why it's not in ndctl.
Vishal now has a patch in flight to expose the size for btt devices.

man page commands in Header & Footer are truncated

I've noticed the man page for commands that are longer than 20 characters, including the section (1), are being truncated in the header and footer.

# ndctl --version 61.4.g08a96c6
# uname -r 4.17.2-200.fc28.x86_64

For example:

# man ndctl-enable-region
NDCTL-ENABLE-REGIO(1)	ndctl Manual	NDCTL-ENABLE-REGIO(1)
[...]
ndctl 61.4.g08a96c6	06/29/2018	NDCTL-ENABLE-REGIO(1)
# man ndctl-enable-namespace
NDCTL-ENABLE-NAMES(1)	ndctl Manual	NDCTL-ENABLE-NAMES(1)
[...]
ndctl 61.4.g08a96c6	06/29/2018	NDCTL-ENABLE-NAMES(1)

The expectation is to see the complete command in the header/footer to avoid confusion.

Make check fail on Ubuntu 16.04.2

My OS is ubuntu 16.04.2, and also upgraded kernel to 4.11.2.
When i run make check, it shows SKIP: 5 and FAIL:3. Detail of test_suit.log as following:
Is anything wrong in my environment?

**# ====================================
ndctl 56+: test/test-suite.log

TOTAL: 8

PASS: 0

SKIP: 5

XFAIL: 0

FAIL: 3

XPASS: 0

ERROR: 0

.. contents:: :depth: 2

SKIP: libndctl

libkmod: DEBUG ../libkmod/libkmod.c:402 kmod_pool_get_module: get module name='nfit' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:410 kmod_pool_add_module: add 0xa70c20 key='nfit'
libkmod: DEBUG ../libkmod/libkmod-module.c:744 kmod_module_get_path: name='nfit' path='(null)'
libkmod: DEBUG ../libkmod/libkmod.c:582 kmod_search_moddep: file=/lib/modules/4.11.2-mytest/modules.dep.bin modname=nfit
libkmod: DEBUG ../libkmod/libkmod-module.c:202 kmod_module_parse_depline: 0 dependencies for nfit
test/init: nfit_test_init: nfit.ko: appears to be production version: /lib/modules/4.11.2-mytest/kernel/drivers/acpi/nfit/nfit.ko
__ndctl_test_skip: explicit skip test_libndctl:2684
nfit_test unavailable skipping tests
libdaxctl: daxctl_unref: context 0xa6a390 released
libndctl: ndctl_unref: context 0xa6a3e0 released
attempted: 1 skipped: 1
SKIP libndctl (exit status: 77)

SKIP: dsm-fail

libkmod: DEBUG ../libkmod/libkmod.c:402 kmod_pool_get_module: get module name='nfit' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:410 kmod_pool_add_module: add 0xe94c20 key='nfit'
libkmod: DEBUG ../libkmod/libkmod-module.c:744 kmod_module_get_path: name='nfit' path='(null)'
libkmod: DEBUG ../libkmod/libkmod.c:582 kmod_search_moddep: file=/lib/modules/4.11.2-mytest/modules.dep.bin modname=nfit
libkmod: DEBUG ../libkmod/libkmod-module.c:202 kmod_module_parse_depline: 0 dependencies for nfit
test/init: nfit_test_init: nfit.ko: appears to be production version: /lib/modules/4.11.2-mytest/kernel/drivers/acpi/nfit/nfit.ko
__ndctl_test_skip: explicit skip test_dsm_fail:177
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0xe8e3e0 released
attempted: 1 skipped: 1
SKIP dsm-fail (exit status: 77)

SKIP: dpa-alloc

libkmod: DEBUG ../libkmod/libkmod.c:402 kmod_pool_get_module: get module name='nfit' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:410 kmod_pool_add_module: add 0x1354c20 key='nfit'
libkmod: DEBUG ../libkmod/libkmod-module.c:744 kmod_module_get_path: name='nfit' path='(null)'
libkmod: DEBUG ../libkmod/libkmod.c:582 kmod_search_moddep: file=/lib/modules/4.11.2-mytest/modules.dep.bin modname=nfit
libkmod: DEBUG ../libkmod/libkmod-module.c:202 kmod_module_parse_depline: 0 dependencies for nfit
test/init: nfit_test_init: nfit.ko: appears to be production version: /lib/modules/4.11.2-mytest/kernel/drivers/acpi/nfit/nfit.ko
__ndctl_test_skip: explicit skip test_dpa_alloc:304
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x134e3e0 released
attempted: 1 skipped: 1
SKIP dpa-alloc (exit status: 77)

SKIP: parent-uuid

libkmod: DEBUG ../libkmod/libkmod.c:402 kmod_pool_get_module: get module name='nfit' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:410 kmod_pool_add_module: add 0x128dc20 key='nfit'
libkmod: DEBUG ../libkmod/libkmod-module.c:744 kmod_module_get_path: name='nfit' path='(null)'
libkmod: DEBUG ../libkmod/libkmod.c:582 kmod_search_moddep: file=/lib/modules/4.11.2-mytest/modules.dep.bin modname=nfit
libkmod: DEBUG ../libkmod/libkmod-module.c:202 kmod_module_parse_depline: 0 dependencies for nfit
test/init: nfit_test_init: nfit.ko: appears to be production version: /lib/modules/4.11.2-mytest/kernel/drivers/acpi/nfit/nfit.ko
__ndctl_test_skip: explicit skip test_parent_uuid:234
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x12873e0 released
attempted: 1 skipped: 1
SKIP parent-uuid (exit status: 77)

SKIP: multi-pmem

libkmod: DEBUG ../libkmod/libkmod.c:402 kmod_pool_get_module: get module name='nfit' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:410 kmod_pool_add_module: add 0x192ac20 key='nfit'
libkmod: DEBUG ../libkmod/libkmod-module.c:744 kmod_module_get_path: name='nfit' path='(null)'
libkmod: DEBUG ../libkmod/libkmod.c:582 kmod_search_moddep: file=/lib/modules/4.11.2-mytest/modules.dep.bin modname=nfit
libkmod: DEBUG ../libkmod/libkmod-module.c:202 kmod_module_parse_depline: 0 dependencies for nfit
test/init: nfit_test_init: nfit.ko: appears to be production version: /lib/modules/4.11.2-mytest/kernel/drivers/acpi/nfit/nfit.ko
__ndctl_test_skip: explicit skip test_multi_pmem:259
nfit_test unavailable skipping tests
libndctl: ndctl_unref: context 0x19243e0 released
attempted: 1 skipped: 1
SKIP multi-pmem (exit status: 77)

FAIL: create.sh

../build-aux/test-driver: line 107: ./create.sh: Permission denied
FAIL create.sh (exit status: 126)

FAIL: clear.sh

../build-aux/test-driver: line 107: ./clear.sh: Permission denied
FAIL clear.sh (exit status: 126)

FAIL: dax-errors.sh

../build-aux/test-driver: line 107: ./dax-errors.sh: Permission denied
FAIL dax-errors.sh (exit status: 126)**

Failed to create namespace with DAX mode

I would like to experiment Device DAX, I emulate two persistent memory devices with 16G each one in my system using OS: RH 7.4.
When I use ndctl tool to configure dax mode :
#ndctl create-namespace -m dax -e namespace0.0 -f
I get this error :

libndctl: ndctl_dax_enable: dax0.0: failed to enable
  Error: namespace0.0: failed to enable

failed to reconfigure namespace

Can you please confirm to me if this is the correct step : to configure dax mode and to experiment Device DAX in my system ?

Thanks !

fail to create devdax namespace

I tried to create devdax mode namespace,However it fails.Steps are as below:

[root@localhost z00392707]# ndctl list -R
{
"dev":"region2",
"size":270582939648,
"available_size":270582939648,
"type":"pmem",
"iset_id":4001977599667278416
}
[root@localhost z00392707]# ndctl create-namespace --verbose -r region2 --mode=devdax
libndctl: ndctl_dax_enable: dax2.0: failed to enable
Error: namespace2.0: failed to enable

failed to create namespace: No such device or address

@djbw could u help me with it?

@djbw addtionally the version of ndctl:
[root@localhost z00392707]# ndctl --version
59.1+

Can ctrl-c be destructive to ndctl reconfiguration?

I have an 'fsdax' mode namespace, start to reconfigure it to 'raw' mode, then quickly followed by a few ctrl-c's to interrupt the process. Consequently the namespace became 'disabled', and cannot be re-enabled.
Question: can ctrl-c be destructive to the namespace? if yes, why? if no, how to recover?
thanks!

configure failed on ubuntu

when running ./configure CFLAGS='-g -O2' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 I get the following error:
...
configure: creating ./config.status
config.status: error: cannot find input file: `Documentation/daxctl/Makefile.in'

autogen-out.txt
configure-out.txt

Namespace reconfigure fails on Ubuntu 16.04

I've compiled ndctl (latest) for Ubuntu 16.04 and tried to run it in a qemu-kvm virtual machine configured with virtual nvdimms like so:
root@vm:~/ndctl# ./ndctl/ndctl create-namespace --reconfig=namespace0.0 --mode=memory --map=mem --force --verbose
And got the following result:

setup_namespace:322: pfn0.0: set_align failed: -6
failed to reconfigure namespace
libndctl: ndctl_unref: context 0x19e2340 released

The original pmem device goes away after that.

Ubuntu is based on kernel 4.4, maybe it's missing some features required by the latest ndctl.

ndctl doesn't catch attempts at parallel namespace operations

to test how ndctl handles conflicts when multiple commands are issues to
the same device, 4 sequential reconfigure commands were issued to the same
pmem device on a AEP hardware.

this resulted in error messages from the ndctl, and the device in question
was moved to disabled state. when the device was enabled back, it was in a
mode neither it was earlier or the new one for which reconfigure command was
issued.

root# ndctl create-namespace -f -e namespace15.0 -m memory &
ndctl create-namespace -f -e namespace15.0 -m memory &ndctl create-namespace
-f -e namespace15.0 -m memory &ndctl create-namespace -f -e namespace15.0 -m
memory &
[1] 3820
[2] 3821
[3] 3822
[4] 3823

failed to reconfigure namespace: No such device or address
libndctl: ndctl_namespace_enable: libndctl: ndctl_namespace_enable:
namespace15.0: failed to enable
namespace15.0: failed to enable
libndctl: ndctl_pfn_enable: pfn15.0: failed to enable
Error: namespace15.0: failed to enable

failed to reconfigure namespace: No such device or address
failed to reconfigure namespace: No such device or address
failed to reconfigure namespace: No such device or address

Per NVDIMM namespace specification, namespace reconfiguration must be
serialized, by driver. It looks like the ndctl <-> driver communication
should somehow catch the above scenario, and report failure as due to "device
busy"

two ndctl issues in emulated mode

The issues are confirmed in Linux 4.17, ndctl version 60+ .

  1. reconfigure create fails to create smaller size namespace, 1G or 2G;
  2. "ndctl destroy" does not destroy, one could "ndctl enable" a 'destroy'ed namespace.
    Not sure how serious the issues are, after all they only exists in emulated mode, not on real hardware,
    but they cause confusions as the man page doesn't describe behavior deltas.

Details here.

ndctl list -r region0 -Nu <== start out with this 4GiB emulated region

{
"dev":"namespace0.0",
"mode":"fsdax",
"size":"4.00 GiB (4.29 GB)",
"sector_size":512,
"blockdev":"pmem0",
"numa_node":0
}

ndctl create-namespace -e namespace0.0 -f -s 1G <=== fails to reconfig to smaller size

[ 801.103894] nd_pmem namespace0.0: unable to guarantee persistence of writes
[ 801.508475] pmem0: detected capacity change from 0 to 4294967296
[ 801.827661] nd_pmem pfn0.1: unable to guarantee persistence of writes
[ 802.256473] pmem0: detected capacity change from 0 to 4225761280
{
"dev":"namespace0.0",
"mode":"fsdax",
"size":"3.94 GiB (4.23 GB)",
"uuid":"8ab76639-bfc5-4ba5-b7be-8f7755628b0a",
"raw_uuid":"00000000-0000-0000-0000-000000000000",
"sector_size":512,
"blockdev":"pmem0",
"numa_node":0
}

ndctl disable-namespace namespace0.0

disabled 1 namespace

ndctl destroy-namespace namespace0.0

destroyed 1 namespace

ndctl list -n namespace0.0 -iu <====' destroy' doesn't destroy

{
"dev":"namespace0.0",
"mode":"fsdax",
"size":"4.00 GiB (4.29 GB)",
"sector_size":512,
"state":"disabled",
"numa_node":0
}

ndctl create-namespace -f -r region0 -s 2G <=== w/o destroy, create-ns fails for lack of resource

failed to create namespace: Resource temporarily unavailable

ndctl enable-namespace namespace0.0

[ 950.702307] nd_pmem pfn0.1: unable to guarantee persistence of writes
[ 951.145507] pmem0: detected capacity change from 0 to 4225761280
enabled 1 namespace
[root@brm-x4600-03 region0]# ndctl list -n namespace0.0 -iu
{
"dev":"namespace0.0",
"mode":"fsdax",
"size":"3.94 GiB (4.23 GB)",
"uuid":"8ab76639-bfc5-4ba5-b7be-8f7755628b0a",
"raw_uuid":"00000000-0000-0000-0000-000000000000",
"sector_size":512,
"blockdev":"pmem0",
"numa_node":0
}

I cannot create a BLK Namespaces

Hello,

I emulate a PMEM with 1G of RAM using a Virtual Machine with Fedora 25 Server, when I use ndctl tool, I can't create a BLK namespace with the following command :
$ndctl create-namespace --type=blk --mode=sector -e namespace0.0 -f

I have non output result, and when I checking with :

$ndctl list

I have the following output :
{ "dev":"namespace0.0", "mode":"memory", "size":1073741824, "blockdev":"pmem0" }

Thank you for your help.

sth about libndctl.so and libndctl.h

My purpose is to use the interface provided by ndctl to do ARS in the system which has the nvdimm running.

after compiling the ndctl, i got the libndctl.so and libdaxctl.so.

Is the libndctl.so and libndctl.h enough to help me realize my function(ARS)?

@djbw

v59.2 - Can't create dax device on Ubuntu 16.04.1 LTS with kernel 4.9.4

Can't create dax device on Ubuntu 16.04.1 LTS with kernel 4.9.4

user@user:~$ ndctl --version
58.4
user@user:~$ sudo ndctl create-namespace -e namespace1.0 -f -m dax -v
{
  "dev":"namespace1.0",
  "mode":"dax",
  "size":"2014.00 MiB (2111.83 MB)",
  "uuid":"d4dce333-5823-41d9-81fc-6f6a4900932f",
  "daxregion":{
    "id":1,
    "devices":[
      {   
        "chardev":"dax1.0",
        "size":"2014.00 MiB (2111.83 MB)"
      }   
    ]   
  },  
  "numa_node":0
}
user@user:~$ ndctl --version
59.2.1.gfd0f527
user@user:~$ sudo ndctl create-namespace -e namespace1.0 -f -m dax -v
sudo: unable to resolve host 71-114: Connection timed out 
validate_namespace_options:569: region1: falling back to a 4K alignment
libndctl: ndctl_dax_enable: dax1.0: failed to enable
  Error: namespace1.0: failed to enable

failed to reconfigure namespace: No such device or address

After using create-namespace with ndctl v59.2 namespace is disapring. Works fine with v58.4

fail to get the error info via ARS API

the version of ndctl:60.3+ with patch(https://patchwork.kernel.org/patch/10444419/)

I tried to get the ARS result of a specified range after i successfully submitted the ars start cmd,however the ndctl_cmd_ars_in_progress() API is always returning non-zero which means the ARS is in progress

the ARS length is 2560bytes which is reasonable.so is the ARS start address.

Below is some related info:

1.err info:
[root@localhost fV3]# ndctl list -RM
{
"dev":"region1",
"size":134217728000,
"available_size":0,
"type":"pmem",
"numa_node":2,
"iset_id":3168996772246421800,
"badblock_count":1,
"badblocks":[
{
"offset":4194306,
"length":1,
"dimms":[
"nmem0"
]
}
],
"persistence_domain":"unknown"
}

2.BIOS log during the ARS procedure:
(DSM) DsmServeNgnCommandsFromOS BEGIN: function 1, input len 16
[CR] (DSM) DsmQueryArsCapabilities: range <0x30C0000400:0x30C0001800)
[CR] (ARS) GetScrubbableInterleaveSets: Getting interleave sets from: 0x30C0000400 - 0x30C00017FF
[CR] (ARS) GetScrubbableInterleaveSets: BaseAddress = 0x3040000000, Limit = 0x4F80000000 - PMEM
[CR] (ARS) GetScrubbableInterleaveSets: 1 PMEM interleave sets found
[CR] (DSM) DsmQueryArsCapabilities: returning Success (interface status 0x20000)
[CR] (DSM) DsmServeNgnCommandsFromOS END: status 0x20000, output len 12
[CR] (DSM) DsmServeNgnCommandsFromOS BEGIN: function 2, input len 24
[CR] (DSM) DsmStartArs: range <0x30C0000400:0x30C0001800), type: 0x0002, flags: 0x00
[CR] (ARS) GetScrubbableInterleaveSets: Getting interleave sets from: 0x30C0000400 - 0x30C00017FF
[CR] (ARS) GetScrubbableInterleaveSets: BaseAddress = 0x3040000000, Limit = 0x4F80000000 - PMEM
[CR] (ARS) GetScrubbableInterleaveSets: 1 PMEM interleave sets found
[CR] (DSM) DsmServeNgnCommandsFromOS END: status 0x6, output len 4
[CR] (DSM) DsmServeNgnCommandsFromOS BEGIN: function 3, input len 0
[CR] (DSM) DsmQueryArsStatus ()
[CR] (ARS) DsmGetArsStatus ()
[CR] (DSM) DsmServeNgnCommandsFromOS END: status 0x10000, output len 44

ndctl enable-region failed still return 0 when "echo $?"

Version: ndctl-59.2
When there is a bad DIMM or unusable region on an AEP system, attempting to
enable the region via ndctl results in messages such as the one below:

ndctl list -ir 7
{
"dev":"region7",
"size":527207235584,
"available_size":0,
"type":"pmem",
"iset_id":1298162592740671488,
"state":"disabled"
}
ndctl enable-region region7
libndctl: ndctl_region_enable: region7: failed to enable
enabled 1 region
echo $?
0

namespace align with mode=memory is different

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)

ndctl align option doesnt fallback to default value

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.

Files without copyright and License files

Hello,

I am adding this package into Debian as showed at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829257

But unfortunately the package could not be distributed in Debian as-is, because there are files that do not have copyright neither license files. Debian only distribute package when all the files has could be redistributed.

That said, could you please add a Copyright notice to the files that are missing, and license files for the files that does not have a license listed.

This is the list I created:

 Documentation/Makefile.am
 Documentation/asciidoc.conf
 Documentation/dimm-description.txt
 Documentation/labels-description.txt
 Documentation/labels-options.txt
 Documentation/manpage-base.xsl
 Documentation/manpage-normal.xsl
 Documentation/namespace-description.txt
 Documentation/ndctl-check-labels.txt
 Documentation/ndctl-create-namespace.txt
 Documentation/ndctl-destroy-namespace.txt
 Documentation/ndctl-disable-dimm.txt
 Documentation/ndctl-disable-namespace.txt
 Documentation/ndctl-disable-region.txt
 Documentation/ndctl-enable-dimm.txt
 Documentation/ndctl-enable-namespace.txt
 Documentation/ndctl-enable-region.txt
 Documentation/ndctl-init-labels.txt
 Documentation/ndctl-list.txt
 Documentation/ndctl-read-labels.txt
 Documentation/ndctl-zero-labels.txt
 Documentation/ndctl.txt
 Documentation/region-description.txt
 Documentation/xable-dimm-options.txt
 Documentation/xable-namespace-options.txt
 Documentation/xable-region-options.txt
 Makefile.am
 Makefile.am.in
 README.md
 autogen.sh
 configure.ac
 contrib/ndctl
 daxctl/lib/Makefile.am
 daxctl/lib/libdaxctl.c
 daxctl/lib/libdaxctl.pc.in
 daxctl/lib/libdaxctl.sym
 git-version
 git-version-gen
 licenses/BSD-MIT
 licenses/CC0
 make-git-snapshot.sh
 ndctl.spec.in
 ndctl/Makefile.am
 ndctl/builtin-bat.c
 ndctl/builtin-create-nfit.c
 ndctl/builtin-help.c
 ndctl/builtin-list.c
 ndctl/builtin-test.c
 ndctl/builtin-xable-region.c
 ndctl/builtin.h
 ndctl/lib/.gitignore
 ndctl/lib/Makefile.am
 ndctl/lib/libndctl.pc.in
 ndctl/lib/libndctl.sym
 ndctl/ndctl.c
 ndctl/util/json-smart.c
 ndctl/util/json.c
 ndctl/util/json.h
 nfit.h
 rpmbuild.sh
 sles/header
 test.h
 test/Makefile.am
 test/clear.sh
 test/core.c
 test/create.sh
 test/dax-errors.c
 test/dax-errors.sh
 test/dax-pmd.c
 test/dax.sh git-version
 git-version-gen
 test/device-dax.c
 test/mmap.c
 test/mmap.sh

regions emit blk device not enabled

Hi,

I followed these steps to build nfit_test. The build is successful and I can see the pmem devices. however i do not see blk devices. It seems all these regions show probing failures:

"probe of regionx failed with error -12".

I did some debug and found that the wrapper functions in iomap.c are not called, instead the real functions are called thus cause failure.

Did I miss any steps? How to solve this problem?

Thank you.

Configure the kernel to make some memory available to CMA (contiguous memory allocator). This will be used to emulate DAX.
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=200
or
cma=200M on the kernel command line.

Compile all components of the libnvdimm sub-system as modules:
CONFIG_LIBNVDIMM=m
CONFIG_BLK_DEV_PMEM=m
CONFIG_ND_BLK=m
CONFIG_ND_BTT=m

Build and install the unit test enabled libnvdimm modules in the following order. The unit test modules need to be in place prior to the depmod that runs during the final modules_install
make M=tools/testing/nvdimm/
sudo make M=tools/testing/nvdimm/ modules_install
sudo make modules_install

CentOS 7 make Fail

[root@localhost ndctl-master]# make
GEN version.m4
make --no-print-directory all-recursive
GEN version.m4
Making all in .
GEN version.m4
CC ccan/str/str.o
CC ccan/str/debug.o
CC ccan/list/list.o
AR libccan.a
CC util/parse-options.o
CC util/usage.o
CC util/size.o
CC util/main.o
CC util/help.o
CC util/strbuf.o
CC util/wrapper.o
CC util/filter.o
CC util/bitmap.o
AR libutil.a
GEN rhel/ndctl.spec
GEN sles/ndctl.spec
Making all in daxctl/lib
CC ../../util/sysfs.lo
CC ../../util/log.lo
CC libdaxctl.lo
CCLD libdaxctl.la
GEN libdaxctl.pc
Making all in ndctl/lib
CC dimm.lo
CC inject.lo
CC nfit.lo
CC smart.lo
CC intel.lo
CC hpe1.lo
CC msft.lo
CC ars.lo
CC firmware.lo
CC libndctl.lo
CCLD libndctl.la
GEN libndctl.pc
Making all in ndctl
CC ndctl.o
CC create-nfit.o
CC namespace.o
CC check.o
CC region.o
CC dimm.o
CC ../util/log.o
CC list.o
CC test.o
CC ../util/json.o
CC util/json-smart.o
CC inject-error.o
CC update.o
CC inject-smart.o
CCLD ndctl
Making all in daxctl
CC daxctl.o
CC list.o
CC ../util/json.o
CCLD daxctl
Making all in Documentation/ndctl
GEN ndctl.xml
GEN ndctl.1
xmlto: /home/sql-linux_cr/Downloads/CR/ndctl-master/Documentation/ndctl/ndctl.xml does not validate (status 3)
xmlto: Fix document syntax or use --skip-validation option
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
/home/sql-linux_cr/Downloads/CR/ndctl-master/Documentation/ndctl/ndctl.xml:2: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
D DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
^
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
validity error : Could not load the external subset "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
Document /home/sql-linux_cr/Downloads/CR/ndctl-master/Documentation/ndctl/ndctl.xml does not validate
make[2]: *** [ndctl.1] Error 13
rm ndctl.xml
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Kernel: 3.10.0-693

Not sure why it fails. There is active internet, able to install packages through yum.

Got "fatal: Not a git repository (or any of the parent directories): .git" when copiling ndctl-53.1.tar.gz

Pls check below steps:
wget https://github.com/pmem/ndctl/archive/v53.1.tar.gz#/ndctl-53.1.tar.gz
tar xvf ndctl-53.1.tar.gz
cd ndctl-53.1
./autogen.sh
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git


Initialized build system. For a common configuration please run:

./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64

Who triggers ARS on every boot?

I found that screen print about ARS on every boot when loading OS.

Who triggers the ARS?

I believe its not BIOS,because when I turn off the "Start ARS on boot" option in UEFI the print still exists.

Here is the screen print:
[CR] (DSM) DsmServeNgnCommandsFromOS BEGIN: function 2, input len 24
[CR] (DSM) DsmStartArs: range <0x3040000000:0x4F80000000), type: 0x0002, flags: 0x02
[CR] (ARS) GetScrubbableInterleaveSets: Getting interleave sets from: 0x3040000000 - 0x4F7FFFFFFF
[CR] (ARS) GetScrubbableInterleaveSets: BaseAddress = 0x3040000000, Limit = 0x4F80000000 - PMEM
[CR] (ARS) GetScrubbableInterleaveSets: 1 PMEM interleave sets found
[CR] (ARS) GetScrubbableInterleaveSets: Getting interleave sets from: 0x3040000000 - 0x4F7FFFFFFF
[CR] (ARS) GetScrubbableInterleaveSets: BaseAddress = 0x3040000000, Limit = 0x4F80000000 - PMEM
[CR] (ARS) GetScrubbableInterleaveSets: 1 PMEM interleave sets found
[CR] (ARS) 4 scrubber records, filter start: 0x3040000000, filter end: 0x4F7FFFFFFF
[CR] (ARS) 4 errors total
[CR] (ARS) DsmGetArsStatus ()
[CR] (DSM) DsmServeNgnCommandsFromOS END: status 0x0, output len 4
[CR] (DSM) DsmServeNgnCommandsFromOS BEGIN: function 3, input len 0
[CR] (DSM) DsmQueryArsStatus ()
[CR] (ARS) DsmGetArsStatus ()
[CR] (DSM) DsmServeNgnCommandsFromOS END: status 0x0, output len 140

[zero-labels] silently fails with active regions and namespaces without providing a helpful response

Config

OS: Fedora 28
Kernel: 4.17.9-200.fc28.x86_64
ndctl version: 61.5.g77fa917

Issue

Assuming a starting configuration with an active namespace and region:

# ndctl list -NRD --region 0
{
  "dimms":[
    {
      "dev":"nmem0",
      "id":"8089-a1-1811-00000058",
      "handle":1,
      "phys_id":32
    }
  ],
  "regions":[
    {
      "dev":"region0",
      "size":267361714176,
      "available_size":0,
      "type":"pmem",
      "numa_node":0,
      "iset_id":710683120631319073,
      "mappings":[
        {
          "dimm":"nmem0",
          "offset":268435456,
          "length":267361714176,
          "position":0
        }
      ],
      "persistence_domain":"memory_controller",
      "namespaces":[
        {
          "dev":"namespace0.0",
          "mode":"fsdax",
          "map":"dev",
          "size":263182090240,
          "uuid":"0da90773-da27-4083-8058-33b928563c90",
          "raw_uuid":"9ed56df2-c0a9-4e17-b82d-28f642f95a22",
          "sector_size":512,
          "blockdev":"pmem0",
          "numa_node":0
        }
      ]
    }
  ]
}

# ndctl read-labels nmem0 -j
{
  "dev":"nmem0",
  "index":[
    {
      "signature":"NAMESPACE_INDEX",
      "major":1,
      "minor":2,
      "labelsize":256,
      "seq":2,
      "nslot":510
    },
    {
      "signature":"NAMESPACE_INDEX",
      "major":1,
      "minor":2,
      "labelsize":256,
      "seq":1,
      "nslot":510
    }
  ],
  "label":[
    {
      "uuid":"9ed56df2-c0a9-4e17-b82d-28f642f95a22",
      "name":"",
      "slot":0,
      "position":0,
      "nlabel":1,
      "isetcookie":710683120631319073,
      "lbasize":512,
      "dpa":268435456,
      "rawsize":267361714176,
      "type_guid":"79d3f066-f3b4-7440-ac43-0d3318b78cdb",
      "abstraction_guid":"ba006426-9ffb-7746-bcb0-968f11d0d225"
    }
  ]
}
read 1 nmem

If we try to zero the labels, it silently fails and doesn't provide any information back to the user:

# ndctl zero-labels nmem0 -v
zeroed 0 nmem

Disabling the namespace doesn't help

# ndctl disable-namespace namespace0.0
disabled 1 namespace

#  ndctl zero-labels nmem0 -v
zeroed 0 nmem

Neither does destroying the namespace

# ndctl destroy-namespace namespace0.0
destroyed 1 namespace

#  ndctl zero-labels nmem0 -v
zeroed 0 nmem

However it does work when there's no namespace and the region is disabled

# ndctl disable-region region0
disabled 1 region

# ndctl zero-labels nmem0 -v
zeroed 1 nmem

Summary

The current message of 'zerod 0 nmem' tells the user that no action was taken by ndctl but doesn't provide any helpful information as to why the operation failed, or what the user can do to successfully zero the labels.

Suggested Improvements

  1. Update the man page to document that the namespace and region have to be destroyed or disabled prior to zeroing labels.

  2. Implement a '-f' option to automatically destroy the namespace & disable the region prior to zeroing the labels as other commands offer.

  3. The zero-labels should return a helpful message to the user indicating that there are active regions and namespaces and the '-f' flag should be used (if implemented). This is similar to what other commands report when encountering an error.

region0 not support 'align' for dax mode error with kernel 4.11.3

Krishna notes:

We are getting the error below using pmem with linux kernel 4.11.3 and DAX as seen below.
Any help in this is appreciated.

root@50005:/lib/modules/4.11.3/kernel/drivers/dax# ndctl list {
"dev":"namespace0.0",
"mode":"raw",
"size":8589934592,
"blockdev":"pmem0"
}

root@50005:/lib/modules/4.11.3/kernel/drivers/dax# ndctl create-namespace --mode dax -e namespace0.0 -f -v
libndctl: __sysfs_device_parse: base: /sys/class/nd dev: ndctl
libndctl: __sysfs_read_attr: failed to open /sys/class/nd/ndctl0/device/nfit/revision: No such file or directory
libndctl: __sysfs_device_parse: ndctl0: processed
libndctl: __sysfs_device_parse: base: /sys/devices/platform/e820_pmem/ndbus0 dev: region
libndctl: to_module: failed to find module for alias: nd:t2 0 list: empty
libndctl: __sysfs_device_parse: region0: processed
libndctl: __sysfs_device_parse: base: /sys/devices/platform/e820_pmem/ndbus0/region0 dev: namespace0.
libndctl: to_module: alias: nd:t4 module: nd_pmem
libndctl: __sysfs_device_parse: namespace0.0: processed
libndctl: __sysfs_device_parse: base: /sys/devices/platform/e820_pmem/ndbus0/region0 dev: pfn0.
libndctl: __sysfs_device_parse: base: /sys/devices/platform/e820_pmem/ndbus0/region0 dev: dax0.
validate_namespace_options:511: region0 not support 'align' for dax mode
failed to reconfigure namespace: no suitable capacity found

Part of kernel configuration is shown below -

CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_DEV_DAX=m
CONFIG_NVDIMM_DAX=y
CONFIG_BLK_DEV_RAM_DAX=y
CONFIG_FS_DAX=y
CONFIG_X86_PMEM_LEGACY=y
CONFIG_LIBNVDIMM=y
CONFIG_NVDIMM_PFN=y
CONFIG_NVDIMM_DAX=y
CONFIG_BLK_DEV_PMEM=m
CONFIG_ARCH_HAS_PEM_API=y

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.