{"id":15003911,"url":"https://github.com/pmem/ndctl","last_synced_at":"2025-05-15T10:02:59.004Z","repository":{"id":30524622,"uuid":"34079149","full_name":"pmem/ndctl","owner":"pmem","description":"A \"device memory\" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics.","archived":false,"fork":false,"pushed_at":"2025-05-13T17:01:17.000Z","size":3950,"stargazers_count":287,"open_issues_count":97,"forks_count":140,"subscribers_count":37,"default_branch":"main","last_synced_at":"2025-05-13T18:22:02.003Z","etag":null,"topics":["cxl","dax","linux-kernel","nvdimm"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-04-16T20:34:24.000Z","updated_at":"2025-05-10T23:22:58.000Z","dependencies_parsed_at":"2023-02-16T23:00:30.437Z","dependency_job_id":"213ca243-8062-41f4-bcaa-823c29a27fdf","html_url":"https://github.com/pmem/ndctl","commit_stats":{"total_commits":1512,"total_committers":75,"mean_commits":20.16,"dds":"0.47883597883597884","last_synced_commit":"16f45755f991f4fb6d76fec70a42992426c84234"},"previous_names":[],"tags_count":101,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Fndctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Fndctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Fndctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Fndctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmem","download_url":"https://codeload.github.com/pmem/ndctl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319716,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cxl","dax","linux-kernel","nvdimm"],"created_at":"2024-09-24T19:00:37.442Z","updated_at":"2025-05-15T10:02:52.634Z","avatar_url":"https://github.com/pmem.png","language":"C","readme":"# ndctl\n\nUtility library for managing the libnvdimm (non-volatile memory device)\nsub-system in the Linux kernel\n  \n\u003ca href=\"https://repology.org/project/ndctl/versions\"\u003e\n    \u003cimg src=\"https://repology.org/badge/vertical-allrepos/ndctl.svg\" alt=\"Packaging status\" align=\"right\"\u003e\n\u003c/a\u003e\n\nBuild\n=====\n\n```\nmeson setup build;\nmeson compile -C build;\n```\n\nOptionally, to install:\n\n```\nmeson install -C build\n```\n\nThere are a number of packages required for the build steps that may not\nbe installed by default.   For information about the required packages,\nsee the \"BuildRequires:\" lines in ndctl.spec.in.\n\nhttps://github.com/pmem/ndctl/blob/main/ndctl.spec.in\n\nDocumentation\n=============\nSee the latest documentation for the NVDIMM kernel sub-system here:\n  \nhttps://www.kernel.org/doc/html/latest/driver-api/nvdimm/index.html\n\nA getting started guide is also available on the kernel.org nvdimm wiki:\n\nhttps://nvdimm.wiki.kernel.org/start\n\nUnit Tests\n==========\nThe unit tests run by `meson test` require the nfit_test.ko module to be\nloaded.  To build and install nfit_test.ko:\n\n1. Obtain the kernel source.  For example,  \n   `git clone -b libnvdimm-for-next git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git`  \n\n1. Skip to step 3 if the kernel version is \u003e= v4.8.  Otherwise, for\n   kernel versions \u003c v4.8, configure the kernel to make some memory\n   available to CMA (contiguous memory allocator). This will be used to\n   emulate DAX.  \n   ```\n   CONFIG_DMA_CMA=y\n   CONFIG_CMA_SIZE_MBYTES=200\n   ```\n   **or**  \n   `cma=200M` on the kernel command line.  \n\n1. Compile the libnvdimm sub-system as a module, make sure \"zone device\"\n   memory is enabled, and enable the btt, pfn, and dax features of the\n   sub-system:  \n\n   ```\n   CONFIG_X86_PMEM_LEGACY=m\n   CONFIG_ZONE_DEVICE=y\n   CONFIG_LIBNVDIMM=m\n   CONFIG_BLK_DEV_PMEM=m\n   CONFIG_BTT=y\n   CONFIG_NVDIMM_PFN=y\n   CONFIG_NVDIMM_DAX=y\n   CONFIG_DEV_DAX_PMEM=m\n   CONFIG_ENCRYPTED_KEYS=y\n   CONFIG_NVDIMM_SECURITY_TEST=y\n   CONFIG_STRICT_DEVMEM=y\n   CONFIG_IO_STRICT_DEVMEM=y\n   ```\n\n1. Build and install the unit test enabled libnvdimm modules in the\n   following order.  The unit test modules need to be in place prior to\n   the `depmod` that runs during the final `modules_install`  \n\n   ```\n   make M=tools/testing/nvdimm\n   sudo make M=tools/testing/nvdimm modules_install\n   sudo make modules_install\n   ```\n\n1. CXL test\n\n   The unit tests will also run CXL tests by default. In order to make these\n   work, we need to install the cxl_test.ko as well.\n\n   Obtain the CXL kernel source(optional).  For example,\n   `git clone -b pending git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git`\n\n   Enable CXL-related kernel configuration options.\n   ```\n   CONFIG_CXL_BUS=m\n   CONFIG_CXL_PCI=m\n   CONFIG_CXL_ACPI=m\n   CONFIG_CXL_PMEM=m\n   CONFIG_CXL_MEM=m\n   CONFIG_CXL_PORT=m\n   CONFIG_CXL_REGION=y\n   CONFIG_CXL_REGION_INVALIDATION_TEST=y\n   CONFIG_DEV_DAX_CXL=m\n   ```\n1. Install cxl_test and related mock modules.\n   ```\n   make M=tools/testing/cxl\n   sudo make M=tools/testing/cxl modules_install\n   sudo make modules_install\n   ```\n1. Now run `meson test -C build` in the ndctl source directory, or `ndctl test`,\n   if ndctl was built with `-Dtest=enabled` as a configuration option to meson.\n\n1. To run the 'destructive' set of tests that may clobber existing pmem\n   configurations and data, configure meson with the destructive option after the\n   `meson setup` step:\n\n   ```\n   meson configure -Dtest=enabled -Ddestructive=enabled build;\n   ```\n\nTroubleshooting\n===============\n\nThe unit tests will validate that the environment is set up correctly\nbefore they try to run. If the platform is misconfigured, i.e. the unit\ntest modules are not available, or the test versions of the modules are\nsuperseded by the \"in-tree/production\" version of the modules `meson\ntest` will skip tests and report a message like the following in\n`build/meson-logs/testlog.txt`\n\n```\nSKIP: libndctl\n==============\ntest/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\n__ndctl_test_skip: explicit skip test_libndctl:2684\nnfit_test unavailable skipping tests\n```\n\nIf the unit test modules are indeed available in the modules 'extra'\ndirectory the default depmod policy can be overridden by adding a file\nto /etc/depmod.d with the following contents:  \n\n```\noverride nfit * extra\noverride device_dax * extra\noverride dax_pmem * extra\noverride dax_pmem_core * extra\noverride dax_pmem_compat * extra\noverride libnvdimm * extra\noverride nd_btt * extra\noverride nd_e820 * extra\noverride nd_pmem * extra\n```\n\nThe nfit_test module emulates pmem with memory allocated via vmalloc().\nOne of the side effects is that this breaks 'physically contiguous'\nassumptions in the driver. Use the '--align=4K option to 'ndctl\ncreate-namespace' to avoid these corner case scenarios.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmem%2Fndctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmem%2Fndctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmem%2Fndctl/lists"}