### cxl-update-firmware example Source: https://pmem.io/ndctl/cxl/cxl-update-firmware An example of updating firmware on mem0 with a specified file and waiting for completion, followed by the command output. ```bash # cxl update-firmware mem0 -F firmware.bin -w [ { "memdev":"mem0", "pmem_size":1073741824, "ram_size":1073741824, "serial":0, "numa_node":0, "host":"cxl_mem.0", "firmware":{ "num_slots":3, "active_slot":2, "online_activate_capable":false, "slot_1_version":"cxl_test_fw_001", "slot_2_version":"cxl_test_fw_002", "slot_3_version":"cxl_test_new_fw", "fw_update_in_progress":false } } ] firmware update completed on 1 mem device ``` -------------------------------- ### Start cxl-monitor daemon as a system service Source: https://pmem.io/ndctl/cxl/cxl-monitor Starts the cxl-monitor daemon as a system service using systemctl. This requires the cxl-monitor.service unit to be installed. ```bash systemctl start cxl-monitor.service ``` -------------------------------- ### ndctl list -BDF firmware example Source: https://pmem.io/ndctl/ndctl/ndctl-list Example output for ndctl list -BDF, which includes bus, dimm, and firmware info. Shows firmware activation state and per-dimm firmware details. ```bash # ndctl list -BDF [ { "provider":"nfit_test.0", "dev":"ndbus2", "scrub_state":"idle", "firmware":{ "activate_method":"suspend", "activate_state":"idle" }, "dimms":[ { "dev":"nmem1", "id":"cdab-0a-07e0-ffffffff", "handle":0, "phys_id":0, "security":"disabled", "firmware":{ "current_version":0, "can_update":true } }, ... ] ``` -------------------------------- ### daxctl reconfigure-device configuration file example Source: https://pmem.io/ndctl/daxctl/daxctl-reconfigure-device Example configuration for managing three devdax namespaces with different modes and options. The subsection name is arbitrary and used only to identify the config section. ```ini [reconfigure-device dax0] nvdimm.uuid = ed93e918-e165-49d8-921d-383d7b9660c5 mode = devdax [reconfigure-device dax1] nvdimm.uuid = f36d02ff-1d9f-4fb9-a5b9-8ceb10a00fe3 mode = system-ram [reconfigure-device dax2] nvdimm.uuid = f36d02ff-1d9f-4fb9-a5b9-8ceb10a00fe3 mode = system-ram online = true movable = false ``` -------------------------------- ### ndctl list dimm info example Source: https://pmem.io/ndctl/ndctl/ndctl-list Example output for dimm info when using the --dimms option. Shows device name, id, handle, physical id, and security state. ```json { "dev":"nmem0", "id":"cdab-0a-07e0-ffffffff", "handle":0, "phys_id":0, "security:":"disabled" } ``` -------------------------------- ### List regions and devices Source: https://pmem.io/ndctl/daxctl/daxctl-list Example output when listing both regions and devices. ```bash # daxctl list --regions --devices { "id":1, "devices":[ { "chardev":"dax1.0", "size":3233808384 } ] } ``` -------------------------------- ### ndctl list --device-dax example Source: https://pmem.io/ndctl/ndctl/ndctl-list Example output for device-dax details when using the --device-dax option. Shows daxregion info including alignment and character devices. ```json { "dev":"namespace0.0", "mode":"devdax", "size":4225761280, "uuid":"18ae1bbb-bb62-4efc-86df-4a5caacb5dcc", "daxregion":{ "id":0, "size":4225761280, "align":2097152, "devices":[ { "chardev":"dax0.0", "size":4225761280 } ] } } ``` -------------------------------- ### cxl disable-region example disabling all regions Source: https://pmem.io/ndctl/cxl/cxl-disable-region Example command to disable all regions, with the expected output showing that 2 regions were disabled. ```bash # cxl disable-region all disabled 2 regions ``` -------------------------------- ### ndctl list --buses --namespaces example Source: https://pmem.io/ndctl/ndctl/ndctl-list Example output from running ndctl list --buses --namespaces. Shows JSON objects for each bus with their namespaces, including mode, size, and block device. ```bash # ndctl list --buses --namespaces { "provider":"nfit_test.1", "dev":"ndbus2", "namespaces":[ { "dev":"namespace9.0", "mode":"raw", "size":33554432, "blockdev":"pmem9" } ] } { "provider":"nfit_test.0", "dev":"ndbus1" } { "provider":"e820", "dev":"ndbus0", "namespaces":[ { "dev":"namespace0.0", "mode":"fsdax", "size":8589934592, "blockdev":"pmem0" } ] } ``` -------------------------------- ### cxl destroy-region all example Source: https://pmem.io/ndctl/cxl/cxl-destroy-region Example of destroying all regions. The output confirms that two regions were destroyed. ```bash # cxl destroy-region all destroyed 2 regions ``` -------------------------------- ### Freeze security workflow example Source: https://pmem.io/ndctl/ndctl/ndctl-freeze-security This sequence demonstrates checking the initial security state of a DIMM, applying the freeze-security command, and verifying the updated security status. ```bash $ ndctl list -d nmem0 [ { "dev":"nmem0", "id":"cdab-0a-07e0-ffffffff", "handle":0, "phys_id":0, "security":"unlocked" } ] $ ndctl freeze-security nmem0 security froze 1 nmem. $ ndctl list -d nmem0 [ { "dev":"nmem0", "id":"cdab-0a-07e0-ffffffff", "handle":0, "phys_id":0, "security":"unlocked", "security_frozen":true }, ] ``` -------------------------------- ### Online memory for a device Source: https://pmem.io/ndctl/daxctl/daxctl-online-memory Example of onlining the memory for a specific device. ```bash # daxctl online-memory dax0.0 dax0.0: 62 new sections onlined onlined memory for 1 device ``` -------------------------------- ### cxl create-region example with JSON output Source: https://pmem.io/ndctl/cxl/cxl-create-region Example command that creates a region with two memdevs (mem0, mem1) using decoder0.1, 2 interleave ways, and 1024 granularity. The output shows the created region object in JSON format and a confirmation message. ```bash #cxl create-region -m -d decoder0.1 -w 2 -g 1024 mem0 mem1 ``` ```json { "region":"region0", "resource":"0xc90000000", "size":"512.00 MiB (536.87 MB)", "interleave_ways":2, "interleave_granularity":1024, "mappings":[ { "position":1, "decoder":"decoder4.0" }, { "position":0, "decoder":"decoder3.0" } ] } created 1 region ``` -------------------------------- ### ndctl list --health example Source: https://pmem.io/ndctl/ndctl/ndctl-list Example output for dimm health info when using the --health option. Shows health state, temperature, spares, thresholds, and shutdown state. ```json { "dev":"nmem0", "health":{ "health_state":"non-critical", "temperature_celsius":23, "spares_percentage":75, "alarm_temperature":true, "alarm_spares":true, "temperature_threshold":40, "spares_threshold":5, "life_used_percentage":5, "shutdown_state":"clean" } } ``` -------------------------------- ### cxl list -TP output and cxl inject-protocol-error example Source: https://pmem.io/ndctl/cxl/cxl-inject-protocol-error Example showing the output of 'cxl list -TP' to identify a dport with 'protocol_injectable' set to true, followed by an injection command using that dport. The command injects a mem-correctable protocol error. ```json # cxl list -TP [ { "port":"port1", "host":"pci0000:e0", "depth":1, "decoders_committed":1, "nr_dports":1, "dports":[ { "dport":"0000:e0:01.1", "alias":"device:02", "id":0, "protocol_injectable":true } ] } ] ``` ```bash # cxl inject-protocol-error "0000:e0:01.1" -p mem -s correctable cxl inject-protocol-error: inject_proto_err: injected mem-correctable protocol error. ``` -------------------------------- ### Online memory with existing online sections Source: https://pmem.io/ndctl/daxctl/daxctl-online-memory Example of onlining memory when some sections are already in an online state. ```bash # daxctl online-memory dax0.0 dax0.0: 1 section already online dax0.0: 61 new sections onlined onlined memory for 1 device ``` -------------------------------- ### Reconfigure dax0.0 to system-ram mode Source: https://pmem.io/ndctl/daxctl/daxctl-offline-memory Example of reconfiguring a device to system-ram mode before offlining memory. ```bash # daxctl reconfigure-device --mode=system-ram --human dax0.0 { "chardev":"dax0.0", "size":"7.87 GiB (8.45 GB)", "target_node":2, "mode":"system-ram" } ``` -------------------------------- ### Run cxl-monitor as a daemon with log file Source: https://pmem.io/ndctl/cxl/cxl-monitor Starts cxl-monitor as a daemon, sending log messages to /var/log/cxl-monitor.log. The --daemon option requires an absolute path for the log file. ```bash cxl monitor --daemon --log=/var/log/cxl-monitor.log ``` -------------------------------- ### Destroy all devices in a region Source: https://pmem.io/ndctl/daxctl/daxctl-destroy-device Example showing how to disable and destroy all devices within a specific region ID. ```bash # daxctl disable-device -r 0 all disabled 3 devices # daxctl destroy-device -r 0 all destroyed 2 devices ``` -------------------------------- ### Arm device for firmware activation with --arm Source: https://pmem.io/ndctl/ndctl/ndctl-update-firmware Example of arming a device for firmware activation with --arm. Shows the error message when the arm is aborted due to overflow, and the subsequent list of devices that were updated. ```shell ndctl update-firmware --arm --bus=nfit_test.0 all Error: update firmware: nmem4: arm aborted, tripped overflow [ { "dev":"nmem1", "id":"cdab-0a-07e0-ffffffff", "handle":"0", "phys_id":"0", "security":"disabled", "firmware":{ "current_version":"0", "can_update":true } }, { "dev":"nmem3", "id":"cdab-0a-07e0-fffeffff", "handle":"0x100", "phys_id":"0x2", "security":"disabled", "firmware":{ "current_version":"0", "can_update":true } }, { "dev":"nmem2", "id":"cdab-0a-07e0-feffffff", "handle":"0x1", "phys_id":"0x1", "security":"disabled", "firmware":{ "current_version":"0", "can_update":true } } ] updated 3 nmems. ``` -------------------------------- ### Destroy a specific dax device Source: https://pmem.io/ndctl/daxctl/daxctl-destroy-device Example showing the sequence of disabling and then destroying a specific dax device. ```bash # daxctl disable-device dax0.1 disabled 1 device # daxctl destroy-device dax0.1 destroyed 1 device ``` -------------------------------- ### Reconfigure device to system-ram mode Source: https://pmem.io/ndctl/daxctl/daxctl-online-memory Example of reconfiguring a device to system-ram mode without immediately onlining the memory. ```bash # daxctl reconfigure-device --mode=system-ram --no-online --human dax0.0 { "chardev":"dax0.0", "size":"7.87 GiB (8.45 GB)", "target_node":2, "mode":"system-ram" } ``` -------------------------------- ### cxl list -m mem0 -I output Source: https://pmem.io/ndctl/cxl/cxl-list Example output of the cxl list command with the -I option, showing memdev information including ram_size and partition_info. ```json # cxl list -m mem0 -I [ { "memdev":"mem0", "ram_size":273535729664, "partition_info":{ "total_size":273535729664, "volatile_only_size":0, "persistent_only_size":0, "partition_alignment_size":268435456 "active_volatile_size":273535729664, "active_persistent_size":0, "next_volatile_size":0, "next_persistent_size":0, } } ] ``` -------------------------------- ### daxctl config file [reconfigure-device] section Source: https://pmem.io/ndctl/daxctl/daxctl-reconfigure-device Example configuration file section for persistent reconfiguration of dax devices. The section name must be unique, and the keys set the NVDIMM namespace UUID, the desired mode (default system-ram), whether to online the memory (default true), and whether to use movable memory (default true). ```ini [reconfigure-device ] nvdimm.uuid = mode = (default: system-ram) online = (default: true) movable = (default: true) ``` -------------------------------- ### Verbose region listing with ndctl list Source: https://pmem.io/ndctl/ndctl/ndctl-list Example of running ndctl list with high verbosity (-vvv) and region filtering to display capabilities. ```bash # ndctl list -Ru -vvv -r 0 { "dev":"region0", "size":"4.00 GiB (4.29 GB)", "available_size":0, "max_available_extent":0, "type":"pmem", "numa_node":0, "target_node":2, "capabilities":[ { "mode":"sector", "sector_sizes":[ 512, 520, 528, 4096, 4104, 4160, 4224 ] }, { "mode":"fsdax", "alignments":[ 4096, 2097152, 1073741824 ] }, { "mode":"devdax", "alignments":[ 4096, 2097152, 1073741824 ] } ], "persistence_domain":"unknown" } ``` -------------------------------- ### Filter by device Source: https://pmem.io/ndctl/daxctl/daxctl-list Example of filtering the listing to a specific device instance in a region. ```bash # daxctl list --dev=1.0 { "chardev":"dax1.0", "size":3233808384 } ``` -------------------------------- ### Monitoring as a system service Source: https://pmem.io/ndctl/ndctl/ndctl-monitor Start the ndctl-monitor system service, which runs the monitor daemon as a system service. ```bash systemctl start ndctl-monitor.service ``` -------------------------------- ### cxl list output showing media errors Source: https://pmem.io/ndctl/cxl/cxl-clear-media-poison Example output from cxl list showing a device with injected poison at offset 0x1000. Use this to identify poison that can be cleared. ```bash # cxl list -m mem0 -L -u { "memdev":"mem0", "ram_size":"1024.00 MiB (1073.74 MB)", "ram_qos_class":42, "serial":"0x0", "numa_node:1, "host":"0000:35:00.0", "media_errors":[ { "offset":"0x1000", "length":64, "source":"Injected" } ] } ``` -------------------------------- ### View bus armed state with ndctl list -BF Source: https://pmem.io/ndctl/ndctl/ndctl-update-firmware Example of viewing the 'armed' state of the bus using ndctl list -BF. The output shows the firmware activation state, including activate_method and activate_state. ```json ndctl list -BF -b nfit_test.0 [ { "provider":"nfit_test.0", "dev":"ndbus2", "scrub_state":"idle", "firmware":{ "activate_method":"suspend", "activate_state":"overflow" } } ] ``` -------------------------------- ### cxl list -m mem0 -A output Source: https://pmem.io/ndctl/cxl/cxl-list Example output of the cxl list command with the -A option, showing alert configuration fields for the memdev. ```json # cxl list -m mem0 -A [ { "memdev":"mem0", "pmem_size":0, "ram_size":273535729664, "alert_config":{ "life_used_prog_warn_threshold_valid":false, "dev_over_temperature_prog_warn_threshold_valid":false, "dev_under_temperature_prog_warn_threshold_valid":false, "corrected_volatile_mem_err_prog_warn_threshold_valid":true, "corrected_pmem_err_prog_warn_threshold_valid":false, "life_used_prog_warn_threshold_writable":false, "dev_over_temperature_prog_warn_threshold_writable":false, "dev_under_temperature_prog_warn_threshold_writable":false, "corrected_volatile_mem_err_prog_warn_threshold_writable":true, "corrected_pmem_err_prog_warn_threshold_writable":false, "life_used_crit_alert_threshold":0, "life_used_prog_warn_threshold":0, "dev_over_temperature_crit_alert_threshold":0, "dev_under_temperature_crit_alert_threshold":0, "dev_over_temperature_prog_warn_threshold":0, "dev_under_temperature_prog_warn_threshold":0, "corrected_volatile_mem_err_prog_warn_threshold":0, "corrected_pmem_err_prog_warn_threshold":0 }, } ] ``` -------------------------------- ### Disable namespace and read info-block as JSON Source: https://pmem.io/ndctl/ndctl/ndctl-read-infoblock Example workflow: first disable the namespace (required before accessing the info-block), then read the info-block with -j to output JSON. The output shows the parsed info-block fields. ```bash ndctl disable-namespace namespace0.0 disabled 1 namespace ndctl read-infoblock -j namespace0.0 [ { "dev":"namespace0.0", "signature":"NVDIMM_PFN_INFO", "uuid":"56b11990-66b1-4d91-9cac-ca084c051259", "parent_uuid":"00000000-0000-0000-0000-000000000000", "flags":0, "version":"1.3", "dataoff":69206016, "npfns":1031680, "mode":2, "start_pad":0, "end_trunc":0, "align":2097152 } ] ``` -------------------------------- ### Offline the memory Source: https://pmem.io/ndctl/daxctl/daxctl-offline-memory Example command to offline the memory for a specific dax device. ```bash # daxctl offline-memory dax0.0 dax0.0: 62 sections offlined offlined memory for 1 device ``` -------------------------------- ### Disable all devices in a region Source: https://pmem.io/ndctl/daxctl/daxctl-disable-device Example command to disable all devices within region 0, including the command output. ```bash # daxctl disable-device -r 0 all disabled 3 devices ``` -------------------------------- ### Example JSON output for media errors Source: https://pmem.io/ndctl/ndctl/ndctl-list This JSON output demonstrates the structure of media error information when using the --media-errors flag. ```json { "dev":"namespace7.0", "mode":"raw", "size":33554432, "blockdev":"pmem7", "badblock_count":17, "badblocks":[ { "offset":4, "length":1 }, { "offset":32768, "length":8 }, { "offset":65528, "length":8 } ] } ``` -------------------------------- ### Start scrub on all buses Source: https://pmem.io/ndctl/ndctl/ndctl-start-scrub Initiates an ARS operation across all supported nvdimm buses in the system, returning a JSON report of the active scrub states. ```bash # ndctl start-scrub [ { "provider":"nfit_test.1", "dev":"ndbus3", "scrub_state":"active" }, { "provider":"nfit_test.0", "dev":"ndbus2", "scrub_state":"active" } ] ``` -------------------------------- ### Wait for scrub on a specific bus with error output Source: https://pmem.io/ndctl/ndctl/ndctl-wait-scrub When specifying an individual bus (or when only one bus exists), the command reports whether ARS support is available. This example shows the error when the bus does not support ARS. ```bash # ndctl wait-scrub e820 error waiting for scrub completion: Operation not supported ``` -------------------------------- ### Wait for sanitize operation on a CXL memory device Source: https://pmem.io/ndctl/cxl/cxl-wait-sanitize Example of using the cxl wait-sanitize command to wait for a sanitize operation to complete on mem0, followed by the command output. ```bash # cxl wait-sanitize mem0 sanitize completed on 1 mem device ``` -------------------------------- ### daxctl reconfigure-device failure with dax-class device model Source: https://pmem.io/ndctl/daxctl/daxctl-reconfigure-device Example of a failed reconfiguration when the dax-class device model is in use (via the dax_pmem_compat driver). The command attempts to reconfigure all devices in region 0 to system-ram mode, but fails with 'Operation not supported' and reports 'reconfigured 0 devices'. ```bash # daxctl reconfigure-device --mode=system-ram --region=0 all libdaxctl: daxctl_dev_disable: dax3.0: error: device model is dax-class dax3.0: disable failed: Operation not supported error reconfiguring devices: Operation not supported reconfigured 0 devices ``` -------------------------------- ### Check firmware update support with ndctl list -DFu Source: https://pmem.io/ndctl/ndctl/ndctl-update-firmware Example of using ndctl list -DFu to check if firmware update is enabled for a specific dimm. The output shows the device's firmware information, including current_version and can_update. ```json ndctl list -DFu -d nmem1 { "dev":"nmem1", "id":"cdab-0a-07e0-ffffffff", "handle":"0", "phys_id":"0", "security":"disabled", "firmware":{ "current_version":"0", "can_update":true } } ``` -------------------------------- ### Equivalent commands for listing switch ports Source: https://pmem.io/ndctl/cxl/cxl-list Demonstrates equivalent commands for listing switch ports by default. ```bash # cxl list -P # cxl list -P -p switch ``` -------------------------------- ### Create devices with full available size Source: https://pmem.io/ndctl/daxctl/daxctl-create-device Creates devices with the fully available size on all regions. ```bash # daxctl create-device -u [ { "chardev":"dax0.1", "size":"15.63 GiB (16.78 GB)", "target_node":0, "mode":"devdax" }, { "chardev":"dax1.1", "size":"15.63 GiB (16.78 GB)", "target_node":1, "mode":"devdax" } ] ``` -------------------------------- ### Equivalent commands for listing endpoints Source: https://pmem.io/ndctl/cxl/cxl-list Demonstrates equivalent commands for listing endpoint objects. ```bash # cxl list -E # cxl list -P -p endpoint ``` -------------------------------- ### Activate firmware synopsis Source: https://pmem.io/ndctl/ndctl/ndctl-activate-firmware The basic command structure for activating firmware on specified buses. ```bash ndctl activate-firmware [ …​ ] [] ``` -------------------------------- ### Disable a specific dax device Source: https://pmem.io/ndctl/daxctl/daxctl-disable-device Example command to disable the dax0.1 device. ```bash # daxctl disable-device dax0.1 ``` -------------------------------- ### Equivalent commands for listing root ports Source: https://pmem.io/ndctl/cxl/cxl-list Demonstrates equivalent commands for listing root ports using the -B flag versus the -P -p root -S flags. ```bash # cxl list -B # cxl list -P -p root -S ``` -------------------------------- ### ndctl setup-passphrase command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-setup-passphrase The basic command structure for setting up a passphrase on one or more NVDIMMs. ```bash ndctl setup-passphrase [..] -k [] ``` -------------------------------- ### cxl list command synopsis Source: https://pmem.io/ndctl/cxl/cxl-list Shows the basic usage of the cxl list command with its options placeholder. ```bash cxl list [] ``` -------------------------------- ### List bus firmware activation method Source: https://pmem.io/ndctl/ndctl/ndctl-activate-firmware Enumerates the default activation method for a specific bus using the ndctl list command. ```bash # ndctl list -b nfit_test.0 -BF [ { "provider":"nfit_test.0", "dev":"ndbus2", "scrub_state":"idle", "firmware":{ "activate_method":"suspend", "activate_state":"idle" } } ] ``` -------------------------------- ### ndctl enable-dimm command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-enable-dimm Shows the basic command syntax for enabling one or more DIMMs. The argument can be a nmemX device name or a dimm id number, and the keyword 'all' can be used to indicate no restriction. ```bash ndctl enable-dimm [] ``` -------------------------------- ### Start scrub on a specific bus Source: https://pmem.io/ndctl/ndctl/ndctl-start-scrub Attempts to initiate an ARS operation on a specific bus, reporting an error if the operation is not supported. ```bash # ndctl start-scrub e820 error starting scrub: Operation not supported ``` -------------------------------- ### List all devices Source: https://pmem.io/ndctl/daxctl/daxctl-list The default behavior of daxctl list when no options are provided. ```bash daxctl list --devices ``` -------------------------------- ### cxl create-region command syntax Source: https://pmem.io/ndctl/cxl/cxl-create-region Shows the basic command syntax for cxl create-region. The command takes options and targets. ```bash cxl create-region [] ``` -------------------------------- ### Enable all regions with cxl enable-region Source: https://pmem.io/ndctl/cxl/cxl-enable-region Shows the command and output when enabling all CXL regions. ```bash # cxl enable-region all enabled 2 regions ``` -------------------------------- ### cxl-update-firmware --wait behavior Source: https://pmem.io/ndctl/cxl/cxl-update-firmware Explanation of the --wait option when used without a firmware file. ```text If --wait is passed in without an accompanying firmware-file, it will initiate a wait on any current in-progress firmware updates, and then return. ``` -------------------------------- ### Run a process with numactl on a reconfigured device Source: https://pmem.io/ndctl/daxctl/daxctl-reconfigure-device Reconfigures dax0.0 to system-ram and then runs a service restricted to specific CPU and memory nodes. ```bash # daxctl reconfigure-device --mode=system-ram dax0.0 [ { "chardev":"dax0.0", "size":16777216000, "target_node":2, "mode":"system-ram" } ] # numactl --cpunodebind=0-1 --membind=2 -- some-service --opt1 --opt2 ``` -------------------------------- ### cxl list -B output showing injectable_protocol_errors Source: https://pmem.io/ndctl/cxl/cxl-inject-protocol-error Example output of 'cxl list -B' showing the 'injectable_protocol_errors' attribute under a CXL bus object. This attribute lists the available error types for injection. ```json # cxl list -B [ { "bus":"root0", "provider":"ACPI.CXL", "injectable_protocol_errors":[ "mem-correctable", "mem-fatal", ] } ] ``` -------------------------------- ### ndctl command-line syntax Source: https://pmem.io/ndctl/ndctl/ndctl Shows the general command-line syntax for the ndctl utility. Use this to understand how to invoke ndctl with options and a subcommand. ```bash ndctl [--version] [--help] [OPTIONS] COMMAND [ARGS] ``` -------------------------------- ### Enable namespace command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-enable-namespace The basic command structure for enabling a specific namespace or multiple namespaces. ```bash ndctl enable-namespace [] ``` -------------------------------- ### cxl enable-region command syntax Source: https://pmem.io/ndctl/cxl/cxl-enable-region The basic command structure for enabling a CXL region. ```bash cxl enable-region [] ``` -------------------------------- ### cxl-enable-port command syntax Source: https://pmem.io/ndctl/cxl/cxl-enable-port The basic command structure for enabling one or more CXL ports. ```bash cxl enable-port [..] [] ``` -------------------------------- ### Inject errors with --block and --count Source: https://pmem.io/ndctl/ndctl/ndctl-inject-error Injects errors into namespace0.0 starting at block 12 for 2 blocks (blocks 12 and 13). By default only the first n bytes of each block are injected, where n is the ARS unit size. ```shell ndctl inject-error --block=12 --count=2 namespace0.0 ``` -------------------------------- ### cxl list -u -m mem0 output with poison_injectable Source: https://pmem.io/ndctl/cxl/cxl-inject-media-poison Example output of `cxl list -u -m mem0` showing a device that supports poison injection. The `poison_injectable` attribute is true when the device supports poison injection and the CXL debugfs is accessible. If the debugfs is inaccessible, this attribute is always false. ```bash # cxl list -u -m mem0 { "memdev":"mem0", "ram_size":"256.00 MiB (268.44 MB)", "serial":"0", "host":"0000:0d:00.0", "firmware_version":"BWFW VERSION 00", "poison_injectable":true } ``` -------------------------------- ### Compare raw and human-readable output Source: https://pmem.io/ndctl/daxctl/daxctl-list Demonstrates the difference between default machine-friendly output and human-readable output using the --human flag. ```bash # daxctl list { "chardev":"dax1.0", "size":32828817408 } # daxctl list --human { "chardev":"dax1.0", "size":"30.57 GiB (32.83 GB)" } ``` -------------------------------- ### cxl-update-firmware synopsis Source: https://pmem.io/ndctl/cxl/cxl-update-firmware The basic syntax for the cxl-update-firmware command. ```bash cxl update-firmware [..] [] ``` -------------------------------- ### ndctl create-namespace syntax Source: https://pmem.io/ndctl/ndctl/ndctl-create-namespace Shows the command-line syntax for ndctl create-namespace. Use this to provision or reconfigure a namespace on an NVDIMM region. ```shell ndctl create-namespace [] ``` -------------------------------- ### ndctl init-labels command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-init-labels Shows the command syntax for initializing the label data area on one or more NVDIMMs. The command accepts a list of nmem device names and options. ```shell ndctl init-labels [..] [] ``` -------------------------------- ### Create dax device with specific size Source: https://pmem.io/ndctl/daxctl/daxctl-create-device Creates a dax0.1 device with a size of 4G. ```bash # daxctl create-device -s 4G [ { "chardev":"dax0.1", "size":4294967296, "target_node":0, "mode":"devdax" } ] ``` -------------------------------- ### Initialize labels on a DIMM workflow Source: https://pmem.io/ndctl/ndctl/ndctl-init-labels Workflow to initialize labels on a DIMM: list the DIMMs in a region, disable the region, initialize labels, re-enable the region, and create a namespace. The list command shows the JSON output for region1 with nmem0. ```shell # ndctl list -RD --region=region1 { "dimms":[ { "dev":"nmem0", "id":"8680-56341200" } ], "regions":[ { "dev":"region1", "size":268435456, "available_size":0, "type":"pmem", "mappings":[ { "dimm":"nmem0", "offset":13958643712, "length":268435456 } ] } ] } ``` ```shell # ndctl disable-region region1 ``` ```shell # ndctl init-labels nmem0 ``` ```shell # ndctl enable-region region1 ``` ```shell # ndctl create-namespace --region=region1 ``` -------------------------------- ### Input JSON file requirements Source: https://pmem.io/ndctl/daxctl/daxctl-create-device Details regarding the use of an input JSON file for device creation. ```text The device name is not re-created, but if a "chardev" is passed in the JSON file, it will use that to get the region id. Note that the JSON content in the file cannot be an array of JSON objects but rather a single JSON object i.e. without the array enclosing brackets. ``` -------------------------------- ### cxl list --memdevs Source: https://pmem.io/ndctl/cxl/cxl-list Lists all memdevs with raw sizes. ```console cxl list --memdevs ``` -------------------------------- ### cxl set-alert-config command syntax Source: https://pmem.io/ndctl/cxl/cxl-set-alert-config Shows the command-line syntax for cxl set-alert-config. Use it to configure warning alert thresholds on one or more CXL memdevs. ```shell cxl set-alert-config [..] [] ``` -------------------------------- ### Monitor DIMMs on a specific bus as a daemon Source: https://pmem.io/ndctl/ndctl/ndctl-monitor Run a monitor daemon to monitor DIMMs on bus 'nfit_test.1' using the --bus and --daemon options. ```shell ndctl monitor --bus=nfit_test.1 --daemon ``` -------------------------------- ### Freeze security command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-freeze-security The basic command structure for freezing security on one or more DIMMs. ```bash ndctl freeze-security [..] [] ``` -------------------------------- ### cxl reserve-dpa command syntax Source: https://pmem.io/ndctl/cxl/cxl-reserve-dpa Shows the command-line syntax for cxl reserve-dpa. The command takes one or more memdev names or IDs and optional options. It is used to find the next available decoder on an endpoint and mark a span of DPA as busy. ```shell cxl reserve-dpa [..] [] ``` -------------------------------- ### daxctl reconfigure-device command syntax Source: https://pmem.io/ndctl/daxctl/daxctl-reconfigure-device Shows the command-line syntax for daxctl reconfigure-device. The device arguments are dax device names like dax0.0, and options control the reconfiguration mode and behavior. ```bash daxctl reconfigure-device […​] [] ``` -------------------------------- ### Automate devdax namespace creation and configuration Source: https://pmem.io/ndctl/daxctl/daxctl-reconfigure-device Command to create a devdax namespace and append its configuration to the specified config file for system-ram conversion. ```bash ndctl create-namespace --mode=devdax | \ jq -r "\"[reconfigure-device $(uuidgen)]\", \"nvdimm.uuid = \(.uuid)\", \"mode = system-ram\"" >> $config_path ``` -------------------------------- ### List CXL buses Source: https://pmem.io/ndctl/cxl/cxl-list Displays the JSON output for listing CXL buses. ```bash # cxl list -B [ { "bus":"root3", "provider":"cxl_test" }, { "bus":"root0", "provider":"ACPI.CXL" } ] ``` -------------------------------- ### cxl_new Source: https://pmem.io/ndctl/libcxl/cxl_new Creates a new library context object that acts as a handle for all library operations. ```APIDOC ## cxl_new ### Description Instantiates a new library context, and stores an opaque pointer in ctx. The context is freed by cxl_unref, i.e. cxl_new(3) implies an internal cxl_ref. ### Method cxl_new ### Signature int cxl_new(struct cxl_ctx **ctx); ### Parameters - **ctx** (struct cxl_ctx **) - Required - A pointer to a pointer where the new context will be stored. ### Return Value Returns 0 on success, and a negative errno on failure. Possible error codes are: - -ENOMEM - -ENXIO ### Example See example usage in test/libcxl.c ``` -------------------------------- ### ndctl read-infoblock command synopsis Source: https://pmem.io/ndctl/ndctl/ndctl-read-infoblock Shows the command syntax for ndctl read-infoblock, which accepts one or more namespace device names and options. ```bash ndctl read-infoblock [..] [] ``` -------------------------------- ### ndctl write-infoblock command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-write-infoblock Shows the command-line syntax for ndctl write-infoblock. The namespace can be specified as namespaceX.Y, or use -o/--output to write to a file, or --stdout to write to standard output. ```bash ndctl write-infoblock [ | -o | --stdout] [] ``` -------------------------------- ### cxl-enable-port version compatibility note Source: https://pmem.io/ndctl/cxl/cxl-enable-port A note regarding the --enable-memdevs option and its kernel version requirements. ```text Note: The '-m' option requires release v83 or newer when used with kernel v6.18 or later. Older releases (before v83) will not work because kernel v6.18 changed how CXL ports and downstream ports are enumerated. In these newer kernels, the CXL port hierarchy is only established once the memdev is probed. v83 and later remain fully compatible with both older and newer kernels. ``` -------------------------------- ### Run cxl-monitor as a one-shot command Source: https://pmem.io/ndctl/cxl/cxl-monitor Runs cxl-monitor once and outputs notifications to standard output. This is the default behavior when --daemon is not specified. ```bash cxl monitor ``` -------------------------------- ### Enable a specific dax device Source: https://pmem.io/ndctl/daxctl/daxctl-enable-device Enables the specified dax device, such as dax0.1. ```bash # daxctl enable-device dax0.1 enabled 1 device ``` -------------------------------- ### Create device on specific region Source: https://pmem.io/ndctl/daxctl/daxctl-create-device Creates dax0.1 with the fully available size on region id 0. ```bash # daxctl create-device -r 0 -u { "chardev":"dax0.1", "size":"15.63 GiB (16.78 GB)", "target_node":0, "mode":"devdax" } ``` -------------------------------- ### Generate and read an infoblock via stdout Source: https://pmem.io/ndctl/ndctl/ndctl-write-infoblock Generates a 1T infoblock to stdout and pipes it to ndctl read-infoblock -j. The output shows the JSON representation of the infoblock and confirms one infoblock was written and read. ```bash ndctl write-infoblock -s 1T -c | ndctl read-infoblock -j wrote 1 infoblock [ { "file":"", "signature":"NVDIMM_PFN_INFO", "uuid":"42e1d574-76ac-402c-9132-5436e31528c0", "parent_uuid":"ef83e49c-4c4a-4fae-b908-72e94675b1b7", "flags":0, "version":"1.4", "dataoff":17196646400, "npfns":264237056, "mode":2, "start_pad":0, "end_trunc":0, "align":16777216, "page_size":4096, "page_struct_size":64 } ] read 1 infoblock ``` -------------------------------- ### Include libcxl and link with -lcxl Source: https://pmem.io/ndctl/libcxl/libcxl Shows the required include directive and compiler link flag to use the libcxl library. ```c #include cc …​ -lcxl ``` -------------------------------- ### Synopsis for daxctl-destroy-device Source: https://pmem.io/ndctl/daxctl/daxctl-destroy-device The basic syntax for invoking the destroy-device command. ```bash daxctl destroy-device […​] [] ``` -------------------------------- ### ndctl load-keys command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-load-keys Shows the command-line syntax for the ndctl load-keys utility. The command loads the master key (kek) and encrypted passphrases for all NVDIMMs into the kernel's user keyring. It is typically called during initialization, before the libnvdimm kernel module is loaded, often from an initrd. ```shell ndctl load-keys [] ``` -------------------------------- ### cxl-zero-labels command syntax Source: https://pmem.io/ndctl/cxl/cxl-zero-labels The basic command structure for zeroing out labels on one or more CXL memory devices. ```bash cxl zero-labels [..] [] ``` -------------------------------- ### cxl-write-labels command syntax Source: https://pmem.io/ndctl/cxl/cxl-write-labels The basic command syntax for writing data to a CXL memory device label area. ```bash cxl write-labels [-i ] ``` -------------------------------- ### Enable all devices in a region Source: https://pmem.io/ndctl/daxctl/daxctl-enable-device Enables all dax devices belonging to the specified region ID. ```bash # daxctl enable-device -r 0 all enabled 3 devices ``` -------------------------------- ### ndctl wait-scrub command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-wait-scrub Shows the command-line syntax for ndctl wait-scrub, which accepts an optional list of bus IDs and options. ```bash ndctl wait-scrub [ …​ ] [] ``` -------------------------------- ### Set smart controller temperature and spares threshold Source: https://pmem.io/ndctl/ndctl/ndctl-inject-smart Sets the controller temperature threshold to 32C, the spares threshold to 8, and enables the spares alarm for nmem0. ```bash ndctl inject-smart --ctrl-temperature-threshold=32 --spares-threshold=8 --spares-alarm nmem0 ``` -------------------------------- ### ndctl update-firmware command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-update-firmware Shows the command-line syntax for ndctl update-firmware. Use this to update NVDIMM firmware on a specified dimm. ```shell ndctl update-firmware [] ``` -------------------------------- ### libcxl MEMDEV command constructors (cxl_cmd_new_*) Source: https://pmem.io/ndctl/libcxl/libcxl Declarations for libcxl mailbox command constructors and label access helpers. Use these to create cxl_cmd objects for supported CXL commands; the library validates support and returns NULL if unsupported. The kernel translates libcxl command ids to CXL standard opcodes, and raw commands are typically unsupported outside debug builds. ```c struct cxl_cmd *cxl_cmd_new_raw(struct cxl_memdev *memdev, int opcode); struct cxl_cmd *cxl_cmd_new_identify(struct cxl_memdev *memdev); struct cxl_cmd *cxl_cmd_new_get_health_info(struct cxl_memdev *memdev); struct cxl_cmd *cxl_cmd_new_get_alert_config(struct cxl_memdev *memdev); struct cxl_cmd *cxl_cmd_new_set_alert_config(struct cxl_memdev *memdev); struct cxl_cmd *cxl_cmd_new_read_label(struct cxl_memdev *memdev, unsigned int offset, unsigned int length); struct cxl_cmd *cxl_cmd_new_write_label(struct cxl_memdev *memdev, void *buf, unsigned int offset, unsigned int length); int cxl_memdev_zero_label(struct cxl_memdev *memdev, size_t length, size_t offset); int cxl_memdev_read_label(struct cxl_memdev *memdev, void *buf, size_t length, size_t offset); int cxl_memdev_write_label(struct cxl_memdev *memdev, void *buf, size_t length, size_t offset); struct cxl_cmd *cxl_cmd_new_get_partition(struct cxl_memdev *memdev); struct cxl_cmd *cxl_cmd_new_set_partition(struct cxl_memdev *memdev, unsigned long long volatile_size); ``` -------------------------------- ### Enable region command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-enable-region The basic command structure for enabling a specific region or set of regions. ```bash ndctl enable-region [] ``` -------------------------------- ### Create a default fsdax namespace Source: https://pmem.io/ndctl/ndctl/ndctl-create-namespace Creates a maximally sized pmem namespace in fsdax mode, which is the default. This mode creates a block device (/dev/pmemX[.Y]) that supports DAX. ```shell ndctl create-namespace ``` -------------------------------- ### Inject poison at address and verify with cxl list --media-errors Source: https://pmem.io/ndctl/cxl/cxl-inject-media-poison Shows injecting poison at address 0x1000 with `cxl inject-media-poison mem0 -a 0x1000` and then verifying the injected error with `cxl list -m mem0 -u --media-errors`. The output confirms the poison was injected at offset 0x1000 with length 64 and source "Injected". The address can be given in decimal or hexadecimal. ```bash # cxl inject-media-poison mem0 -a 0x1000 poison inject at mem0:0x1000 # cxl list -m mem0 -u --media-errors { "memdev":"mem0", "ram_size":"256.00 MiB (268.44 MB)", "serial":"0", "host":"0000:0d:00.0", "firmware_version":"BWFW VERSION 00", "media_errors":[ { "offset":"0x1000", "length":64, "source":"Injected" } ] } ``` -------------------------------- ### Synopsis for daxctl-online-memory Source: https://pmem.io/ndctl/daxctl/daxctl-online-memory The basic syntax for invoking the daxctl-online-memory command. ```bash daxctl online-memory […​] [] ``` -------------------------------- ### ndctl list command syntax Source: https://pmem.io/ndctl/ndctl/ndctl-list Basic syntax for the ndctl-list command. Use it to dump the platform nvdimm device topology and attributes in JSON. ```bash ndctl list [] ``` -------------------------------- ### ndctl list default behavior Source: https://pmem.io/ndctl/ndctl/ndctl-list Equivalent to running ndctl list with no options. It lists all namespaces across all buses and regions. ```bash ndctl list --namespaces --bus=all --region=all ``` -------------------------------- ### Output of cxl list -P -p switch,endpoint -m mem0 Source: https://pmem.io/ndctl/cxl/cxl-list The output of the first command showing a port with its endpoint. ```json [ { "port":"port1", "host":"ACPI0016:00", "endpoints:port1":[ { "endpoint":"endpoint2", "host":"mem0" } ] } ] ``` -------------------------------- ### One-shot monitor logging to a file Source: https://pmem.io/ndctl/ndctl/ndctl-monitor Run ndctl monitor as a one-shot command, outputting notifications to the specified log file using the --log option. ```shell ndctl monitor --log=/var/log/ndctl.log ```