pub/scm/utils/kernel/ndctl/ndctl.git  about / heads / tags
mirror of https://git.kernel.org/pub/scm/utils/kernel/ndctl/ndctl.git/
$ git log --pretty=format:'%h %s (%cs)%d'
4f7a1c63 ndctl: release v83 (2025-09-30)
	(HEAD -> main, tag: v83, pending)
b26e9ae3 cxl/list: remove libtracefs build dependency for --media-errors (2025-09-25)
4c6e6c38 cxl: document 'cxl enable-port -m' behavior change (2025-09-24)
b4caae2e test/dm.sh: use dm.sh as script name in cleanup error message (2025-09-11)
b9695a36 test/cxl-poison.sh: test inject and clear poison by region offset (2025-09-11)
c1e2e3cd cxl: add helper function to verify port is in memdev hierarchy (2025-08-26)
14246dd8 ndctl: fix user visible spelling errors (2025-08-14)
2e446537 test/common: move err() function to top of file (2025-08-06)
ea4cdc87 test/common: add double quotes to bash variables (2025-08-06)
01c245fc test/meson.build: add fwctl dependency needed for cxl-features.sh (2025-06-18)
...

$ git cat-file blob HEAD:README.md
# ndctl

Utility library for managing the libnvdimm (non-volatile memory device)
sub-system in the Linux kernel
  
<a href="https://repology.org/project/ndctl/versions">
    <img src="https://repology.org/badge/vertical-allrepos/ndctl.svg" alt="Packaging status" align="right">
</a>

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`  

1. 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.  

1. Apply the fragment below to your kernel config or use it to verify that the
   options required to run the NDCTL unit tests are correctly enabled.

   ```
   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_FS_DAX=y
   CONFIG_EXT4_FS=m
   CONFIG_XFS_FS=m
   CONFIG_DAX=m
   CONFIG_DEV_DAX=m
   CONFIG_ENCRYPTED_KEYS=y
   CONFIG_NVDIMM_SECURITY_TEST=y
   CONFIG_STRICT_DEVMEM=y
   CONFIG_IO_STRICT_DEVMEM=y
   CONFIG_ACPI_NFIT=m
   CONFIG_NFIT_SECURITY_DEBUG=y
   CONFIG_MEMORY_FAILURE=y
   CONFIG_MEMORY_HOTPLUG=y
   CONFIG_MEMORY_HOTREMOVE=y
   CONFIG_TRANSPARENT_HUGEPAGE=y
   ```

1. Install the following packages, (Fedora instructions):
   ```
   dnf install e2fsprogs xfsprogs parted jq trace-cmd hostname fio fio-engine-dev-dax
   ```

1. 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
   ```

1. 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`

   Apply the fragment below to your kernel config or use it to verify that the
   options required to run the CXL unit tests are correctly enabled.
   ```
   CONFIG_CXL_BUS=m
   CONFIG_CXL_PCI=m
   CONFIG_CXL_ACPI=m
   CONFIG_LIBNVDIMM=m
   CONFIG_CXL_PMEM=m
   CONFIG_CXL_MEM=m
   CONFIG_CXL_PORT=m
   CONFIG_CXL_REGION=y
   CONFIG_CXL_REGION_INVALIDATION_TEST=y
   CONFIG_CXL_FEATURES=y
   CONFIG_DAX=m
   CONFIG_TRANSPARENT_HUGEPAGE=y
   CONFIG_DEV_DAX=m
   CONFIG_DEV_DAX_CXL=m
   CONFIG_MEMORY_HOTPLUG=y
   CONFIG_MEMORY_HOTREMOVE=y
   CONFIG_NVDIMM_SECURITY_TEST=y
   CONFIG_ENCRYPTED_KEYS=y
   CONFIG_NVDIMM_KEYS=y
   ```
1. Install cxl_test and related mock modules.
   ```
   make M=tools/testing/cxl
   sudo make M=tools/testing/cxl modules_install
   sudo make modules_install
   ```
1. 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.

1. 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.

# heads (aka `branches'):
$ git for-each-ref --sort=-creatordate refs/heads \
	--format='%(HEAD) %(refname:short) %(subject) (%(creatordate:short))'
  gh-pages     docs: update to v83 (2025-09-30)
* main         ndctl: release v83 (2025-09-30)
  pending      ndctl: release v83 (2025-09-30)
  ndctl-76.y   ndctl: release v76.1 (2023-02-24)
  vv/volatile-regions cxl/list: Enumerate device-dax properties for regions (2023-02-07)
  for-75/jz/alert-config cxl/list: display alert configuration fields (2022-11-10)
  create_region cxl/decoder: add a max_available_extent attribute (2022-08-16)
  ndctl-72.y   ndctl: release v72.1 (2022-01-05)
  ndctl-71.y   ndctl: release v71.1 (2020-12-22)
  ndctl-70.y   ndctl: release v70.1 (2020-10-09)
...

# tags:
$ git for-each-ref --sort=-creatordate refs/tags \
	--format='%(refname:short) %(subject) (%(creatordate:short))'
v83          ndctl: release v83 (2025-09-30) tar.gz
v82          ndctl: release v82 (2025-06-11) tar.gz
v81          ndctl: release v81 (2025-03-21) tar.gz
v80          ndctl: release v80 (2024-10-09) tar.gz
v79          ndctl: release v79 (2024-05-02) tar.gz
v78          ndctl: release v78 (2023-08-03) tar.gz
v77          ndctl: release v77 (2023-05-02) tar.gz
v76.1        ndctl: release v76.1 (2023-02-24) tar.gz
v76          ndctl: release v76 (2023-02-22) tar.gz
v75          ndctl: release v75 (2023-01-12) tar.gz
...

# associated public inboxes:
# (number on the left is used for dev purposes)
       2807 nvdimm
       2126 linux-nvdimm
        800 linux-cxl
         45 lkml
         17 u-boot
         16 linux-patches
         15 qemu-devel
         10 linux-wireless
         10 linux-arm-kernel
          9 stable
          7 linux-devicetree
          7 linux-rdma
          7 kvm
          7 dri-devel
          6 linux-media
          6 linuxppc-dev
          6 git
          6 intel-gfx
          6 openembedded-devel
          5 netdev
          5 dpdk-dev
          5 openembedded-core
          4 linux-nfs
          4 linux-fsdevel
          4 linux-arm-msm
          4 alsa-devel
          4 linux-btrfs
          4 linux-bluetooth
          4 linux-trace-devel
          4 linux-omap
          4 poky
          3 linux-xfs
          3 netfilter-devel
          3 linux-pm
          3 linux-scsi
          3 selinux
          3 linux-gpio
          3 linux-rt-users
          3 linux-perf-users
          3 buildroot
          3 yocto-meta-arago
          2 linux-samsung-soc
          2 linux-mtd
          2 linux-mediatek
          2 linux-acpi
          2 linux-cifs
          2 linux-mm
          2 linux-mips
          2 linux-input
          2 kvmarm
          2 driverdev-devel
          2 linux-usb
          2 kernel-hardening
          2 dmaengine
          2 linux-next
          2 linux-pci
          2 linux-sgx
          2 linux-serial
          2 util-linux
          2 linux-wpan
          2 amd-gfx
          2 cip-dev
          2 linux-spi
          2 linux-i2c
          2 linux-remoteproc
          2 virtualization
          2 ccan
          2 dm-devel
          2 linux-fbdev
          2 kernel-janitors
          2 linux-staging
          2 linux-sunxi
          2 fio
          2 yocto
          2 yocto-meta-freescale
          2 yocto-meta-virtualization
          2 xenomai
          2 kexec
          2 intel-xe
          2 cpufreq
          2 kvm-ppc
          2 lm-sensors
          2 accel-config
          1 linux-fscrypt
          1 cocci
          1 linux-block
          1 linux-riscv
          1 linux-nvme
          1 live-patching
          1 bpf
          1 linux-crypto
          1 linux-efi
          1 linux-integrity
          1 linux-edac
          1 linux-amlogic
          1 linux-erofs
          1 linux-iommu
          1 xen-devel
          1 linux-snps-arc
          1 fstests
          1 linux-hwmon
          1 linux-rtc
          1 linux-renesas-soc
          1 linux-kselftest
          1 linux-clk
          1 linux-iio
          1 linux-parisc
          1 linux-ext4
          1 linux-leds
          1 linux-security-module
          1 linux-f2fs-devel
          1 linux-modules
          1 kernelnewbies
          1 linux-ide
          1 linux-watchdog
          1 linux-hyperv
          1 workflows
          1 rcu
          1 selinux-refpolicy
          1 linux-m68k
          1 linux-i3c
          1 linux-spdx
          1 ksummit-discuss
          1 wireguard
          1 backports
          1 io-uring
          1 linux-kernel-mentees
          1 linux-doc
          1 linux-csky
          1 linux-man
          1 linux-mmc
          1 tpmdd-devel
          1 linux-unionfs
          1 linux-firmware
          1 linux-api
          1 linux-audit
          1 linux-dash
          1 linux-bcache
          1 linux-sparse
          1 mm-commits
          1 linux-pwm
          1 linux-tegra
          1 lttng-dev
          1 linux-kbuild
          1 linux-fpga
          1 ceph-devel
          1 linux-arch
          1 linux-can
          1 containers
          1 linux-rockchip
          1 linux-raid
          1 xdp-newbies
          1 platform-driver-x86
          1 phone-devel
          1 openbmc
          1 linux-hardening
          1 dash
          1 keyrings
          1 linux-sctp
          1 target-devel
          1 lustre-devel
          1 linux-sh
          1 soc
          1 ocfs2-devel
          1 rust-for-linux
          1 ath10k
          1 ath11k
          1 nouveau
          1 linux-phy
          1 linux-s390
          1 sparclinux
          1 mptcp
          1 linux-coco
          1 regressions
          1 ksummit
          1 b43-dev
          1 linux-nfc
          1 linux-bcachefs
          1 ath9k-devel
          1 ntfs3
          1 llvm
          1 iwd
          1 ell
          1 ofono
          1 ltp
          1 yocto-toaster
          1 yocto-meta-arm
          1 yocto-docs
          1 bitbake-devel
          1 chrome-platform
          1 ntb
          1 yocto-meta-ti
          1 outreachy
          1 damon
          1 asahi
          1 openrisc
          1 intel-wired-lan
          1 loongarch
          1 imx
          1 ath12k
          1 b4-sent
          1 linux-trace-kernel
          1 oe-linux-nfc
          1 oe-kbuild-all
          1 oe-chipsec
          1 batman
          1 linux-um
          1 virtio-dev
          1 virtio-comment
          1 v9fs
          1 ecryptfs
          1 qemu-riscv
          1 linux-ia64
          1 cluster-devel
          1 grub-devel
          1 kbd
          1 autofs
          1 dccp
          1 cgroups
          1 devicetree-spec
          1 devicetree-compiler
          1 initramfs
          1 hail-devel
          1 kvm-ia64
          1 linux-8086
          1 kernel-testers
          1 linux-alpha
          1 linux-btrace
          1 linux-embedded
          1 linux-hams
          1 linux-hexagon
          1 linux-hotplug
          1 linux-laptop
          1 linux-sound
          1 trinity
          1 reiserfs-devel
          1 linux-metag
          1 linux-x25
          1 linux-nilfs
          1 lvs-devel
          1 netfilter
          1 linux-oxnas
          1 u-boot-amlogic
          1 lvm-devel
          1 acpica-devel
          1 perfbook
          1 virtio-fs
          1 smatch
          1 fuego
          1 wireless-regdb
          1 igt-dev
          1 powertop

git clone https://yhbt.net/lore/pub/scm/utils/kernel/ndctl/ndctl.git