From patchwork Wed Jan 5 21:31:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 900C7C433EF for ; Wed, 5 Jan 2022 21:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244489AbiAEVcR (ORCPT ); Wed, 5 Jan 2022 16:32:17 -0500 Received: from mga11.intel.com ([192.55.52.93]:32461 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244495AbiAEVbr (ORCPT ); Wed, 5 Jan 2022 16:31:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418307; x=1672954307; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1jf6mjMkVfAxzHE5koXGaHq5xLDtB1enGeGWwlLvxlI=; b=Ux+6tiSgFyLrdhmu5Jam255tzKaiILGgBpqyEWRWEejuVli7mYTgXEZP e3E8Tw0IH5TbYycRBNT92edDYUWKvVPRFgrA4HbQU/tm1ooSAQMPQ1oCu MzoqKAHK/BV8APwPWYFrPwEPk79X6cv3ItcTL+da30b5qvNHuoIyJnmyl dtpYZRJ6jdsAVK/XZ1PXoG1AM1G1rabdAjXLV8KAKvkfx81BSjjnAo9QR K0t6xv/HyjIblg78eJfJog7EUGIHaGmJa37Y6KFtYTiSs3NN33K7uCZXh 5hulzSD3fxjzEUFxVr8LWXJHIriDvSs135ey3GfhIjPld/Ssjd+HslUU8 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="240083925" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="240083925" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:31:45 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="488727214" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:31:44 -0800 Subject: [ndctl PATCH v3 01/16] ndctl/docs: Clarify update-firwmware activation 'overflow' conditions From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:31:44 -0800 Message-ID: <164141830490.3990253.6263569501446070716.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Give examples and remediation for "overflow" events, i.e. where the estimated time to complete activation exceeds the platform advertised maximum. When that happens forced activation can lead to undefined results. Signed-off-by: Dan Williams --- Documentation/ndctl/ndctl-update-firmware.txt | 64 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/Documentation/ndctl/ndctl-update-firmware.txt b/Documentation/ndctl/ndctl-update-firmware.txt index 1080d62a20b9..61664575f5b1 100644 --- a/Documentation/ndctl/ndctl-update-firmware.txt +++ b/Documentation/ndctl/ndctl-update-firmware.txt @@ -58,7 +58,69 @@ include::xable-bus-options.txt[] Arm a device for firmware activation. This is enabled by default when a firmware image is specified. Specify --no-arm to disable this default. Otherwise, without a firmware image, this option can be - used to manually arm a device for firmware activate. + used to manually arm a device for firmware activate. When a + device transitions from unarmed to armed the platform recalculates the + firmware activation time and compares it against the maximum platform + supported time. If the activation time would exceed the platform maximum the + arm attempt is aborted: + +[verse] +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. + + It is possible, but not recommended, to ignore timeout overflows + with the --force option. At any point to view the 'armed' state of the + bus do: + +[verse] +ndctl list -BF -b nfit_test.0 +[ + { + "provider":"nfit_test.0", + "dev":"ndbus2", + "scrub_state":"idle", + "firmware":{ + "activate_method":"suspend", + "activate_state":"overflow" + } + } +] -D:: --disarm:: From patchwork Wed Jan 5 21:31:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 977CBC433EF for ; Wed, 5 Jan 2022 21:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244508AbiAEVce (ORCPT ); Wed, 5 Jan 2022 16:32:34 -0500 Received: from mga14.intel.com ([192.55.52.115]:63652 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244513AbiAEVbu (ORCPT ); Wed, 5 Jan 2022 16:31:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418310; x=1672954310; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZajtxRjy+8ZNb8dlfcJqunXfCWxVuhwxI8eHmJpO6+c=; b=fImsRBzPF81xXxpw+llIXSfZ15H7yEUDdwp7tDyrODy0SFiUk3d7Rxkd 6VCdWBrQ98k3z/QWVUZLM8uyJ0WK3NRRe+oleZjIlSMY7aHY99WR7jUZy zFz/7tAb2t3JHjJuz459jTj9fRh/o2gJ7ZJLiihaMdBdNYjrr1Bh3d1FT Xz5iM/boTeCIAbn2UoDmcslkH1ZPVYDEnsTsLHPKS74iQ9jbDvEnNMHN6 ur12J4a/3p7SdE+DUq81KkC2FzSnXvhKfYfab2KyUdtvgQvzshS9CdVvT 7EYg7eJf17Kjg9HtZLQ4ZE/XGFVvCKBR/OmtYSzXQqjWlZp0I8rRlrwmg A==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242746534" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242746534" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:31:50 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="470718707" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:31:50 -0800 Subject: [ndctl PATCH v3 02/16] ndctl/test: Prepare for BLK-aperture support removal From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:31:50 -0800 Message-ID: <164141830999.3990253.5021445352398348657.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The kernel is dropping its support for the BLK-aperture access method. The primary side effect of this for nfit_test is that NVDIMM namespace labeling will not be enabled by default. Update the unit tests to initialize the label index area in this scenario. Signed-off-by: Dan Williams --- test/core.c | 31 ++++++++++++++++++++++++++++--- test/libndctl.c | 49 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/test/core.c b/test/core.c index 2b03aa9b3f2a..93e1dae5a144 100644 --- a/test/core.c +++ b/test/core.c @@ -261,8 +261,8 @@ retry: ndctl_bus_foreach(nd_ctx, bus) { struct ndctl_region *region; - if (strncmp(ndctl_bus_get_provider(bus), - "nfit_test", 9) != 0) + if (strcmp(ndctl_bus_get_provider(bus), + "nfit_test.0") != 0) continue; ndctl_region_foreach(bus, region) ndctl_region_disable_invalidate(region); @@ -280,5 +280,30 @@ retry: NULL, NULL, NULL, NULL); if (rc) kmod_unref(*ctx); - return rc; + + if (!nd_ctx) + return rc; + + ndctl_bus_foreach (nd_ctx, bus) { + struct ndctl_region *region; + struct ndctl_dimm *dimm; + + if (strcmp(ndctl_bus_get_provider(bus), "nfit_test.0") != 0) + continue; + + ndctl_region_foreach (bus, region) + ndctl_region_disable_invalidate(region); + + ndctl_dimm_foreach (bus, dimm) { + ndctl_dimm_read_label_index(dimm); + ndctl_dimm_init_labels(dimm, NDCTL_NS_VERSION_1_2); + ndctl_dimm_disable(dimm); + ndctl_dimm_enable(dimm); + } + + ndctl_region_foreach (bus, region) + ndctl_region_enable(region); + } + + return 0; } diff --git a/test/libndctl.c b/test/libndctl.c index 391b94086dae..0d6b9dd5b04b 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -2588,17 +2588,41 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n, return 0; } -static void reset_bus(struct ndctl_bus *bus) +enum dimm_reset { + DIMM_INIT, + DIMM_ZERO, +}; + +static int reset_dimms(struct ndctl_bus *bus, enum dimm_reset reset) { - struct ndctl_region *region; struct ndctl_dimm *dimm; + int rc = 0; + + ndctl_dimm_foreach(bus, dimm) { + if (reset == DIMM_ZERO) + ndctl_dimm_zero_labels(dimm); + else { + ndctl_dimm_read_label_index(dimm); + ndctl_dimm_init_labels(dimm, NDCTL_NS_VERSION_1_2); + } + ndctl_dimm_disable(dimm); + rc = ndctl_dimm_enable(dimm); + if (rc) + break; + } + + return rc; +} + +static void reset_bus(struct ndctl_bus *bus, enum dimm_reset reset) +{ + struct ndctl_region *region; /* disable all regions so that set_config_data commands are permitted */ ndctl_region_foreach(bus, region) ndctl_region_disable_invalidate(region); - ndctl_dimm_foreach(bus, dimm) - ndctl_dimm_zero_labels(dimm); + reset_dimms(bus, reset); /* set regions back to their default state */ ndctl_region_foreach(bus, region) @@ -2609,7 +2633,6 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test) { struct ndctl_bus *bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0); struct ndctl_region *region; - struct ndctl_dimm *dimm; int rc; if (!bus) @@ -2626,13 +2649,10 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test) if (rc) return rc; - ndctl_dimm_foreach(bus, dimm) { - rc = ndctl_dimm_zero_labels(dimm); - if (rc < 0) { - fprintf(stderr, "failed to zero %s\n", - ndctl_dimm_get_devname(dimm)); - return rc; - } + rc = reset_dimms(bus, DIMM_INIT); + if (rc < 0) { + fprintf(stderr, "failed to reset dimms\n"); + return rc; } /* @@ -2650,14 +2670,14 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test) rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), DAX); if (rc) return rc; - reset_bus(bus); + reset_bus(bus, DIMM_INIT); } if (ndctl_test_attempt(test, KERNEL_VERSION(4, 8, 0))) { rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), PFN); if (rc) return rc; - reset_bus(bus); + reset_bus(bus, DIMM_INIT); } return check_regions(bus, regions0, ARRAY_SIZE(regions0), BTT); @@ -2672,6 +2692,7 @@ static int do_test1(struct ndctl_ctx *ctx, struct ndctl_test *test) return -ENXIO; ndctl_bus_wait_probe(bus); + reset_bus(bus, DIMM_ZERO); /* * Starting with v4.10 the dimm on nfit_test.1 gets a unique From patchwork Wed Jan 5 21:31:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26AD1C433F5 for ; Wed, 5 Jan 2022 21:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244507AbiAEVeg (ORCPT ); Wed, 5 Jan 2022 16:34:36 -0500 Received: from mga14.intel.com ([192.55.52.115]:63662 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244426AbiAEVdz (ORCPT ); Wed, 5 Jan 2022 16:33:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418435; x=1672954435; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nkw69Y9cVQM75moQImxfRDkfj6yZ6Kns0MeaOUeKsSU=; b=YiM0qbZ7G5V6mBpXtJ9joBOAXODlH6clfCEVxF48jo05GoM5grvbtKV0 5McHUOkSrtGshJuAa35d7WdXIAgdlexRhn5xHYKPY391CRr1bqkha912c yiR8RGxiAm1q+8Sb2T4w6TOlW8GLKQMxAQezgsP17ZcJXHQIgw5HqhEG/ IGSiL33BaxEoDaF1wnu2KPgnWhiEyfmSaNHJNgLPail7KiUMzZoLpAhB2 lr6L906Wy1EvAjPsKYwzXDRS4RhvhZV7lc4zUlJajEPSzx7KJ/R+24PLt LiBMo5T/0Rodorxgm2RPc4+FFUr0dOfonOluWaZk0G/6PHQROx/g2MwOT g==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242746574" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242746574" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:31:55 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="470718730" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:31:55 -0800 Subject: [ndctl PATCH v3 03/16] ndctl/test: Move 'reset()' to function in 'common' From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:31:55 -0800 Message-ID: <164141831509.3990253.14783946910211635678.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org When BLK mode is removed, tests that expect the nfit_test region to allow pmem namespace creation will need to 'init' rather than 'zero' labels. In preparation, take the time opportunity to move reset() to a common function. So that 'ndctl zero-labels' can be replaced with 'ndctl init-labels' in one central location. Signed-off-by: Dan Williams --- test/blk-exhaust.sh | 4 +--- test/btt-check.sh | 7 ------- test/btt-errors.sh | 12 +++--------- test/btt-pad-compat.sh | 7 ------- test/clear.sh | 4 +--- test/common | 15 +++++++++++++++ test/create.sh | 4 +--- test/daxctl-create.sh | 4 ++-- test/daxdev-errors.sh | 4 +--- test/firmware-update.sh | 8 +++----- test/inject-error.sh | 7 ------- test/max_available_extent_ns.sh | 9 +-------- test/monitor.sh | 11 ++--------- test/multi-dax.sh | 4 +--- test/pfn-meta-errors.sh | 4 +--- test/pmem-errors.sh | 4 +--- test/rescan-partitions.sh | 7 ------- test/sector-mode.sh | 9 ++------- test/track-uuid.sh | 4 +--- 19 files changed, 36 insertions(+), 92 deletions(-) diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh index 09c4aae146a6..b6d3808969f1 100755 --- a/test/blk-exhaust.sh +++ b/test/blk-exhaust.sh @@ -14,9 +14,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset # if the kernel accounting is correct we should be able to create two # pmem and two blk namespaces on nfit_test.0 diff --git a/test/btt-check.sh b/test/btt-check.sh index 8e0b489a8eca..65b5c58bb236 100755 --- a/test/btt-check.sh +++ b/test/btt-check.sh @@ -39,13 +39,6 @@ create() [ $size -gt 0 ] || err "$LINENO" } -reset() -{ - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all -} - # re-enable the BTT namespace, and do IO to it in an attempt to # verify it still comes up ok, and functions as expected post_repair_test() diff --git a/test/btt-errors.sh b/test/btt-errors.sh index 4e59f57aea7c..5a20d26fe6d5 100755 --- a/test/btt-errors.sh +++ b/test/btt-errors.sh @@ -45,9 +45,7 @@ trap 'err $LINENO cleanup' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 @@ -126,9 +124,7 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1 # reset everything to get a clean log if grep -q "$MNT" /proc/mounts; then umount $MNT; fi -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset dev="x" json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector) eval "$(echo "$json" | json2var)" @@ -148,9 +144,7 @@ force_raw 0 dd if=/dev/$blockdev of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true # done, exit -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset cleanup _cleanup exit 0 diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh index bf1ea54af9d2..be538b761151 100755 --- a/test/btt-pad-compat.sh +++ b/test/btt-pad-compat.sh @@ -37,13 +37,6 @@ create() fi } -reset() -{ - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all -} - verify_idx() { idx0="$1" diff --git a/test/clear.sh b/test/clear.sh index fb9d52c837d4..c4d02d54714d 100755 --- a/test/clear.sh +++ b/test/clear.sh @@ -14,9 +14,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 diff --git a/test/common b/test/common index 6bcefcad9bf9..3c54d633251f 100644 --- a/test/common +++ b/test/common @@ -46,6 +46,21 @@ err() exit $rc } +reset() +{ + $NDCTL disable-region -b $NFIT_TEST_BUS0 all + $NDCTL zero-labels -b $NFIT_TEST_BUS0 all + $NDCTL enable-region -b $NFIT_TEST_BUS0 all +} + +reset1() +{ + $NDCTL disable-region -b $NFIT_TEST_BUS1 all + $NDCTL zero-labels -b $NFIT_TEST_BUS1 all + $NDCTL enable-region -b $NFIT_TEST_BUS1 all +} + + # check_min_kver # $1: Supported kernel version. format: X.Y # diff --git a/test/create.sh b/test/create.sh index b0fd99f1e7b1..e9baaa075a28 100755 --- a/test/create.sh +++ b/test/create.sh @@ -15,9 +15,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh index 198779a851b4..d319a3939ac5 100755 --- a/test/daxctl-create.sh +++ b/test/daxctl-create.sh @@ -10,7 +10,7 @@ trap 'cleanup $LINENO' ERR cleanup() { printf "Error at line %d\n" "$1" - [[ $testdev ]] && reset + [[ $testdev ]] && reset_dax exit $rc } @@ -70,7 +70,7 @@ reset_dev() "$DAXCTL" enable-device "$testdev" } -reset() +reset_dax() { test -n "$testdev" diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh index 9547d781162b..e13453dfaa73 100755 --- a/test/daxdev-errors.sh +++ b/test/daxdev-errors.sh @@ -15,9 +15,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 diff --git a/test/firmware-update.sh b/test/firmware-update.sh index 8cc9c41b57ca..93ce166e6255 100755 --- a/test/firmware-update.sh +++ b/test/firmware-update.sh @@ -10,11 +10,9 @@ image="update-fw.img" trap 'err $LINENO' ERR -reset() +fwupd_reset() { - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all + reset if [ -f $image ]; then rm -f $image fi @@ -73,7 +71,7 @@ do_tests() check_min_kver "4.16" || do_skip "may lack firmware update test handling" modprobe nfit_test -reset +fwupd_reset detect rc=1 do_tests diff --git a/test/inject-error.sh b/test/inject-error.sh index 7d0b8269f5db..fd823b6cfa13 100755 --- a/test/inject-error.sh +++ b/test/inject-error.sh @@ -37,13 +37,6 @@ create() [ $size -gt 0 ] || err "$LINENO" } -reset() -{ - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all -} - check_status() { local sector="$1" diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh index 343f3c9eac49..47a921f5edf2 100755 --- a/test/max_available_extent_ns.sh +++ b/test/max_available_extent_ns.sh @@ -11,13 +11,6 @@ trap 'err $LINENO' ERR check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size" check_prereq "jq" -init() -{ - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all -} - do_test() { region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1) @@ -40,7 +33,7 @@ do_test() modprobe nfit_test rc=1 -init +reset do_test _cleanup exit 0 diff --git a/test/monitor.sh b/test/monitor.sh index 28c55415c819..14450a7b23e3 100755 --- a/test/monitor.sh +++ b/test/monitor.sh @@ -19,13 +19,6 @@ trap 'err $LINENO' ERR check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service" -init() -{ - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all -} - start_monitor() { logfile=$(mktemp) @@ -112,7 +105,7 @@ test_filter_region() test_filter_namespace() { - init + reset monitor_namespace=$($NDCTL create-namespace -b $smart_supported_bus | jq -r .dev) monitor_dimms=$(get_monitor_dimm "-n $monitor_namespace") start_monitor "-n $monitor_namespace" @@ -170,7 +163,7 @@ do_tests() modprobe nfit_test rc=1 -init +reset set_smart_supported_bus do_tests _cleanup diff --git a/test/multi-dax.sh b/test/multi-dax.sh index b343a3869f9c..04070adb18e4 100755 --- a/test/multi-dax.sh +++ b/test/multi-dax.sh @@ -17,9 +17,7 @@ ALIGN_SIZE=`getconf PAGESIZE` # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" diff --git a/test/pfn-meta-errors.sh b/test/pfn-meta-errors.sh index 0ade2e52a8ad..631489797087 100755 --- a/test/pfn-meta-errors.sh +++ b/test/pfn-meta-errors.sh @@ -29,9 +29,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh index 4225c3bce0c7..20657801fc0e 100755 --- a/test/pmem-errors.sh +++ b/test/pmem-errors.sh @@ -28,9 +28,7 @@ trap 'err $LINENO cleanup' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh index 1686de3552f1..51bbd731fb55 100755 --- a/test/rescan-partitions.sh +++ b/test/rescan-partitions.sh @@ -25,13 +25,6 @@ check_min_kver "4.16" || do_skip "may not contain fixes for partition rescanning check_prereq "parted" check_prereq "blockdev" -reset() -{ - $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all - $NDCTL enable-region -b $NFIT_TEST_BUS0 all -} - test_mode() { local mode="$1" diff --git a/test/sector-mode.sh b/test/sector-mode.sh index 7a2faeae8a2d..439ef331adaf 100755 --- a/test/sector-mode.sh +++ b/test/sector-mode.sh @@ -15,13 +15,8 @@ ALIGN_SIZE=`getconf PAGESIZE` # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all - -$NDCTL disable-region -b $NFIT_TEST_BUS1 all -$NDCTL zero-labels -b $NFIT_TEST_BUS1 all -$NDCTL enable-region -b $NFIT_TEST_BUS1 all +reset +reset1 rc=1 query=". | sort_by(.size) | reverse | .[0].dev" diff --git a/test/track-uuid.sh b/test/track-uuid.sh index be3cf9c07a0a..3bacd2c24787 100755 --- a/test/track-uuid.sh +++ b/test/track-uuid.sh @@ -12,9 +12,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test -$NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all -$NDCTL enable-region -b $NFIT_TEST_BUS0 all +reset rc=1 From patchwork Wed Jan 5 21:32:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBEC9C433FE for ; Wed, 5 Jan 2022 21:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244426AbiAEVei (ORCPT ); Wed, 5 Jan 2022 16:34:38 -0500 Received: from mga14.intel.com ([192.55.52.115]:63626 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244458AbiAEVeI (ORCPT ); Wed, 5 Jan 2022 16:34:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418448; x=1672954448; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VvqYIlkRHgJ9qXPmwzXXUh/RgXfXlalF6pCDeVGVYq4=; b=d9y0psjJuPnytsFHWqp0rxzRQeSuHOv4GWY39qvqT3T9rD2WtF6aUOP0 zvYXo+W+PawMOutJqd4zbXxJDUTl6FH3Ya9YrWjAiFvEUmjrcSljhPXAF wUkYPOFBfz84RtSEoEGd0LDb4xbYovUsVI487LJhRSmholv3TjIJDVAuo G3//1+xpLIEFL+AT1I40QVgbty036OyIj/DeMc/HlAAMlH+MEKezH5ahe MCAsbpSAWR1NsvZxYhzUQnBjG4s2D/taf4nvXK6WfisaHjmnO0gXH7o6x O6VHjrTBhfOMJuL3BUl0KZLn9ESDcqFlZm9ERU+sDAymEz5CDVcls0Y3z A==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242746608" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242746608" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:00 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="488727326" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:00 -0800 Subject: [ndctl PATCH v3 04/16] ndctl/test: Initialize the label area by default From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:00 -0800 Message-ID: <164141832017.3990253.10383328274835531066.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The removal of BLK-mode support causes nfit_test regions to not be 'aliased' by default, which means that the only way to enable labels is to initialize the namespace label index block. In support of that the common 'reset()' helper is updated to initialize v1.1 labels instead of zero them. Additionally, it highlighted that some btt tests have silent assumptions of v1.1 vs v1.2 label support. Add a 'resetV()' alternative to the common 'reset()' function that initializes the label area to v1.2. Signed-off-by: Dan Williams --- test/btt-errors.sh | 4 ++-- test/btt-pad-compat.sh | 2 +- test/common | 11 +++++++++-- test/label-compat.sh | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/test/btt-errors.sh b/test/btt-errors.sh index 5a20d26fe6d5..6e69178cc3cf 100755 --- a/test/btt-errors.sh +++ b/test/btt-errors.sh @@ -45,7 +45,7 @@ trap 'err $LINENO cleanup' ERR # setup (reset nfit_test dimms) modprobe nfit_test -reset +resetV rc=1 @@ -124,7 +124,7 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1 # reset everything to get a clean log if grep -q "$MNT" /proc/mounts; then umount $MNT; fi -reset +resetV dev="x" json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector) eval "$(echo "$json" | json2var)" diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh index be538b761151..005316a205c8 100755 --- a/test/btt-pad-compat.sh +++ b/test/btt-pad-compat.sh @@ -148,7 +148,7 @@ do_tests() verify_idx 0 1 # do the same with an old format namespace - reset + resetV create_oldfmt_ns verify_idx 0 2 diff --git a/test/common b/test/common index 3c54d633251f..b6d47128f209 100644 --- a/test/common +++ b/test/common @@ -49,14 +49,21 @@ err() reset() { $NDCTL disable-region -b $NFIT_TEST_BUS0 all - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all + $NDCTL init-labels -f -b $NFIT_TEST_BUS0 all + $NDCTL enable-region -b $NFIT_TEST_BUS0 all +} + +resetV() +{ + $NDCTL disable-region -b $NFIT_TEST_BUS0 all + $NDCTL init-labels -f -V 1.2 -b $NFIT_TEST_BUS0 all $NDCTL enable-region -b $NFIT_TEST_BUS0 all } reset1() { $NDCTL disable-region -b $NFIT_TEST_BUS1 all - $NDCTL zero-labels -b $NFIT_TEST_BUS1 all + $NDCTL init-labels -f -b $NFIT_TEST_BUS1 all $NDCTL enable-region -b $NFIT_TEST_BUS1 all } diff --git a/test/label-compat.sh b/test/label-compat.sh index 8ab285878d84..7ae4d5efd0ff 100755 --- a/test/label-compat.sh +++ b/test/label-compat.sh @@ -17,7 +17,7 @@ trap 'err $LINENO' ERR # setup (reset nfit_test dimms) modprobe nfit_test $NDCTL disable-region -b $NFIT_TEST_BUS0 all -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all +$NDCTL init-labels -f -b $NFIT_TEST_BUS0 all # grab the largest pmem region on -b $NFIT_TEST_BUS0 query=". | sort_by(.available_size) | reverse | .[0].dev" From patchwork Wed Jan 5 21:32:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50663C433EF for ; Wed, 5 Jan 2022 21:33:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244520AbiAEVdT (ORCPT ); Wed, 5 Jan 2022 16:33:19 -0500 Received: from mga12.intel.com ([192.55.52.136]:14713 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244535AbiAEVcG (ORCPT ); Wed, 5 Jan 2022 16:32:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418326; x=1672954326; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lqxas7Jp2n48528XZYMSoM/T1vo3G5+Ksw7UW8FLeP8=; b=VlrP+/yzNK0jLhw8Y8ZixrvT5vsxkbE/3YiI3fpEvNMBIcxw6q2LXONZ REPNyeU452EpvVn1aXmS+gdrvKTTDB1ocsdO1T0YOoXyzuK65JX1omGRp HC3dT4Kja7uKzi/7fUMA5nPuC1rW9UMHRrriWKMNMXrEEJrSmeIIBS7Ta uei5oETReY6f6Ya9i/sYXhla7wXqmcfYTVyBQgkbLyTtiULqaL5Wb6ufR xSFdrd+G551PdZYySoxPNDdeQFi45SZ7Bx6cMVKHAdEjYULeTEy5dVKSN BqLG6+jm33u0zus5GF9k86HWjl1lz3NBheF0gG1UyahgLaAHbxOc75xop A==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="222535851" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="222535851" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:05 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="574526270" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:05 -0800 Subject: [ndctl PATCH v3 05/16] ndctl/test: Skip BLK flags checks From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:05 -0800 Message-ID: <164141832529.3990253.16538298357542644310.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org With the removal of BLK-mode support, test/libndctl will fail to detect the JEDEC format on the nfit_test bus. Report + skip that check rather than fail the test when that happens. Signed-off-by: Dan Williams --- test/libndctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libndctl.c b/test/libndctl.c index 0d6b9dd5b04b..aa624289c708 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -2536,7 +2536,7 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n, fprintf(stderr, "dimm%d expected formats: %d got: %d\n", i, dimms[i].formats, ndctl_dimm_get_formats(dimm)); - return -ENXIO; + fprintf(stderr, "continuing...\n"); } for (j = 0; j < dimms[i].formats; j++) { if (ndctl_dimm_get_formatN(dimm, j) != dimms[i].format[j]) { @@ -2544,7 +2544,7 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n, "dimm%d expected format[%d]: %d got: %d\n", i, j, dimms[i].format[j], ndctl_dimm_get_formatN(dimm, j)); - return -ENXIO; + fprintf(stderr, "continuing...\n"); } } } From patchwork Wed Jan 5 21:32:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3494EC433FE for ; Wed, 5 Jan 2022 21:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244497AbiAEVdk (ORCPT ); Wed, 5 Jan 2022 16:33:40 -0500 Received: from mga05.intel.com ([192.55.52.43]:46270 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244541AbiAEVcc (ORCPT ); Wed, 5 Jan 2022 16:32:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418352; x=1672954352; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YG9eeeLnbMrLQY6Q0GuYOl0nHLjVehSnzpcQ/ICYIL0=; b=EMEUzUdOs2hqO7iQfm/KJFZQWLvSkunqRdc4Akf4NV5BAfPOSLj4dw57 rHoKExNsWN/8KLmDItcNhLpVEmLIB3GMz8mX1g6g7ksz9r50+Cmsph6vh 1CPoRGfNW+GD4AtgP3/n7BnhcRtsGEvlgr15cCWNVr/zT6XPgw0dqgsv2 5JtkNwu2VFLb4jZOVQLMaJfgy7F8PvzGqExfMpFBG40giMvMNRccLZAPk JW/usvspBQn1T7iMQp0gRK9w4u5in/JqZgAEejZou+1uwzErQCq16+dmd NgSmxiRVAAD7NUenZxldk3oy230qFHEWSzT4U+PgDiHAw9af6Wujqz1LR Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="328888202" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="328888202" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:10 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="689157245" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:10 -0800 Subject: [ndctl PATCH v3 06/16] ndctl/test: Move sector-mode to a different region From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:10 -0800 Message-ID: <164141833068.3990253.15694496866707006837.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Previously the largest region on the nfit_test.1 bus belonged to a BLK-mode region. With the removal of BLK-mode support update the test to instead find a suitable PMEM region to perform the checkout. Signed-off-by: Dan Williams --- test/sector-mode.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sector-mode.sh b/test/sector-mode.sh index 439ef331adaf..f70b0f1786f4 100755 --- a/test/sector-mode.sh +++ b/test/sector-mode.sh @@ -19,11 +19,11 @@ reset reset1 rc=1 -query=". | sort_by(.size) | reverse | .[0].dev" -NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query") -REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev") +query=". | sort_by(.available_size) | reverse | .[0].dev" +REGION=$($NDCTL list -R -b $NFIT_TEST_BUS1 | jq -r "$query") echo 0 > /sys/bus/nd/devices/$REGION/read_only -$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K +echo $ALIGN_SIZE > /sys/bus/nd/devices/$REGION/align +NAMESPACE=$($NDCTL create-namespace --no-autolabel -r $REGION -m sector -f -l 4K | jq -r ".dev") $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K From patchwork Wed Jan 5 21:32:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 421A1C433F5 for ; Wed, 5 Jan 2022 21:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244482AbiAEVd2 (ORCPT ); Wed, 5 Jan 2022 16:33:28 -0500 Received: from mga07.intel.com ([134.134.136.100]:51366 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244537AbiAEVcR (ORCPT ); Wed, 5 Jan 2022 16:32:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418337; x=1672954337; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yzq8zcue0vHSD6aiYYZ2CTEkWbHldxvMWQ0RcCMCF+I=; b=AkEABQPUydDeirWnn0A7DyhIRJ4unUXsAF8TIJGQAgVkpa4Dr6nRRAsE 9HG3TSY6E88XD6F5gdhKDK6Z0uZYd+wKszmzknXUGXXCl6pcvHyhWJ9Sz OESAQhwBIldlJzuJ+LQkpGgxLj65hydqu6BoKPPlNk9H89J8JbWxsHiEo V9HOsX9OvjOA5OytOaoa6PeKhUiNrrd06+m0vy4rX6j4xGtuc408BKIbm sgs/oXv5NeLX6JGQgHcwYkwT+2/3Glpogo62e44hURxyP49Sfy/e9yX4H 4hPDNg3SCxEybv8j3b5nZOPccz95yHLsIeVcscquQZPqam1sf/vkx6GYn g==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="305891533" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="305891533" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:16 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="763309968" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:16 -0800 Subject: [ndctl PATCH v3 07/16] ndctl: Deprecate BLK aperture support From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:15 -0800 Message-ID: <164141833579.3990253.17885822648406789915.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The kernel is dropping its BLK aperture support, so deprecate the same in ndctl. The options will still be supported, and the library calls will not be deleted in case code needs them to compile. However the documentation and the tests for BLK mode can be removed. Signed-off-by: Dan Williams --- .gitignore | 4 Documentation/ndctl/labels-description.txt | 5 Documentation/ndctl/ndctl-create-namespace.txt | 29 +- Documentation/ndctl/ndctl-init-labels.txt | 7 Documentation/ndctl/ndctl-list.txt | 4 Documentation/ndctl/region-description.txt | 10 - README.md | 1 contrib/nfit_test_depmod.conf | 1 ndctl/Makefile.am | 6 ndctl/bat.c | 5 ndctl/test.c | 11 - test.h | 3 test/Makefile.am | 31 -- test/blk-exhaust.sh | 30 -- test/blk_namespaces.c | 357 ------------------------ test/core.c | 1 test/create.sh | 13 - test/dpa-alloc.c | 326 ---------------------- test/libndctl.c | 198 ++----------- test/multi-pmem.c | 285 ------------------- test/parent-uuid.c | 254 ----------------- 21 files changed, 51 insertions(+), 1530 deletions(-) delete mode 100755 test/blk-exhaust.sh delete mode 100644 test/blk_namespaces.c delete mode 100644 test/dpa-alloc.c delete mode 100644 test/multi-pmem.c delete mode 100644 test/parent-uuid.c diff --git a/.gitignore b/.gitignore index 6468c7a91f06..6b19d90a12f1 100644 --- a/.gitignore +++ b/.gitignore @@ -42,20 +42,16 @@ cscope*.out tags test/*.log test/*.trs -test/blk-ns test/dax-dev test/dax-errors test/dax-pmd test/daxdev-errors test/device-dax -test/dpa-alloc test/dsm-fail test/hugetlb test/image test/libndctl test/mmap -test/multi-pmem -test/parent-uuid test/pmem-ns test/smart-listen test/smart-notify diff --git a/Documentation/ndctl/labels-description.txt b/Documentation/ndctl/labels-description.txt index 6244a49a9d3f..a246edcd369b 100644 --- a/Documentation/ndctl/labels-description.txt +++ b/Documentation/ndctl/labels-description.txt @@ -3,6 +3,5 @@ DESCRIPTION ----------- The namespace label area is a small persistent partition of capacity -available on some NVDIMM devices. The label area is used to resolve -aliasing between 'pmem' and 'blk' capacity by delineating namespace -boundaries. +available on some NVDIMM devices. The label area is used to provision +one, or more, namespaces from regions. diff --git a/Documentation/ndctl/ndctl-create-namespace.txt b/Documentation/ndctl/ndctl-create-namespace.txt index 92a89dd71e82..afb085efc6e7 100644 --- a/Documentation/ndctl/ndctl-create-namespace.txt +++ b/Documentation/ndctl/ndctl-create-namespace.txt @@ -28,27 +28,17 @@ ndctl create-namespace -f -e namespace0.0 --mode=sector OPTIONS ------- --t:: ---type=:: - Create a 'pmem' or 'blk' namespace (subject to available - capacity). A pmem namespace supports the dax (direct access) - capability to linkndctl:mmap[2] persistent memory directly into - a process address space. A blk namespace access persistent - memory through a block-window-aperture. Compared to pmem it - supports a traditional storage error model (EIO on error rather - than a cpu exception on a bad memory access), but it does not - support dax. - -m:: --mode=:: - "raw": expose the namespace capacity directly with - limitations. Neither a raw pmem namepace nor raw blk - namespace support sector atomicity by default (see "sector" - mode below). A raw pmem namespace may have limited to no dax - support depending the kernel. In other words operations like - direct-I/O targeting a dax buffer may fail for a pmem - namespace in raw mode or indirect through a page-cache buffer. - See "fsdax" and "devdax" mode for dax operation. + limitations. A raw pmem namepace namespace does not support + sector atomicity (see "sector" mode below). A raw pmem + namespace may have limited to no dax support depending the + kernel. In other words operations like direct-I/O targeting a + dax buffer may fail for a pmem namespace in raw mode or + indirect through a page-cache buffer. See "fsdax" and + "devdax" mode for dax operation. + - "sector": persistent memory, given that it is byte addressable, does not support sector atomicity. The @@ -206,8 +196,7 @@ OPTIONS * NVDIMM does not support labels * The NVDIMM supports labels, but the Label Index Block (see - UEFI 2.7) is not present and there is no capacity aliasing - between 'blk' and 'pmem' regions. + UEFI 2.7) is not present. - In the latter case the configuration can be upgraded to labelled operation by writing an index block on all DIMMs in a diff --git a/Documentation/ndctl/ndctl-init-labels.txt b/Documentation/ndctl/ndctl-init-labels.txt index 733ef0ebddfa..73685b3336b3 100644 --- a/Documentation/ndctl/ndctl-init-labels.txt +++ b/Documentation/ndctl/ndctl-init-labels.txt @@ -13,10 +13,9 @@ SYNOPSIS 'ndctl init-labels' [..] [] include::labels-description.txt[] -By default, and in kernels prior to v4.10, the kernel only honors labels -when a DIMM aliases PMEM and BLK capacity. Starting with v4.10 the -kernel will honor labels for sub-dividing PMEM if all the DIMMs in an -interleave set / region have a valid namespace index block. +Starting with v4.10 the kernel will honor labels for sub-dividing PMEM +if all the DIMMs in an interleave set / region have a valid namespace +index block. This command can be used to initialize the namespace index block if it is missing or reinitialize it if it is damaged. Note that diff --git a/Documentation/ndctl/ndctl-list.txt b/Documentation/ndctl/ndctl-list.txt index b8d517d784b4..2922f10e06c7 100644 --- a/Documentation/ndctl/ndctl-list.txt +++ b/Documentation/ndctl/ndctl-list.txt @@ -82,10 +82,6 @@ include::xable-bus-options.txt[] 'X.Y'. Limit the namespace list to the single identified device if present. --t:: ---type=:: - Filter listing by region type ('pmem' or 'blk') - -m:: --mode=:: Filter listing by the mode ('raw', 'fsdax', 'sector' or 'devdax') diff --git a/Documentation/ndctl/region-description.txt b/Documentation/ndctl/region-description.txt index c14416a3be69..ce268a015b83 100644 --- a/Documentation/ndctl/region-description.txt +++ b/Documentation/ndctl/region-description.txt @@ -2,9 +2,7 @@ DESCRIPTION ----------- -A generic REGION device is registered for each PMEM range or -BLK-aperture set. LIBNVDIMM provides a built-in driver for these REGION -devices. This driver is responsible for reconciling the aliased DPA -mappings across all regions, parsing the LABEL, if present, and then -emitting NAMESPACE devices with the resolved/exclusive DPA-boundaries -for the nd_pmem or nd_blk device driver to consume. +A generic REGION device is registered for each PMEM range / +interleave-set. LIBNVDIMM provides a built-in driver for these REGION +devices. This driver is responsible for parsing namespace labels and +instantiating PMEM namespaces for each coherent set of labels. diff --git a/README.md b/README.md index 89dfc8798603..6f36a6d9410c 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,6 @@ override dax_pmem * extra override dax_pmem_core * extra override dax_pmem_compat * extra override libnvdimm * extra -override nd_blk * extra override nd_btt * extra override nd_e820 * extra override nd_pmem * extra diff --git a/contrib/nfit_test_depmod.conf b/contrib/nfit_test_depmod.conf index 9f8498e58ff3..0e0574e03670 100644 --- a/contrib/nfit_test_depmod.conf +++ b/contrib/nfit_test_depmod.conf @@ -5,7 +5,6 @@ override dax_pmem * extra override dax_pmem_core * extra override dax_pmem_compat * extra override libnvdimm * extra -override nd_blk * extra override nd_btt * extra override nd_e820 * extra override nd_pmem * extra diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am index 4e995108e96a..93b682e8b202 100644 --- a/ndctl/Makefile.am +++ b/ndctl/Makefile.am @@ -45,8 +45,7 @@ endif EXTRA_DIST += keys.readme monitor.conf ndctl-monitor.service ndctl.conf if ENABLE_DESTRUCTIVE -ndctl_SOURCES += ../test/blk_namespaces.c \ - ../test/pmem_namespaces.c +ndctl_SOURCES += ../test/pmem_namespaces.c ndctl_SOURCES += bat.c endif @@ -67,9 +66,6 @@ if ENABLE_TEST ndctl_SOURCES += ../test/libndctl.c \ ../test/dsm-fail.c \ ../util/sysfs.c \ - ../test/dpa-alloc.c \ - ../test/parent-uuid.c \ - ../test/multi-pmem.c \ ../test/core.c \ test.c endif diff --git a/ndctl/bat.c b/ndctl/bat.c index ef00a3ba3d0b..13e964dc17cf 100644 --- a/ndctl/bat.c +++ b/ndctl/bat.c @@ -41,11 +41,6 @@ int cmd_bat(int argc, const char **argv, struct ndctl_ctx *ctx) return EXIT_FAILURE; } - rc = test_blk_namespaces(loglevel, test, ctx); - fprintf(stderr, "test_blk_namespaces: %s\n", rc ? "FAIL" : "PASS"); - if (rc && rc != 77) - return rc; - rc = test_pmem_namespaces(loglevel, test, ctx); fprintf(stderr, "test_pmem_namespaces: %s\n", rc ? "FAIL" : "PASS"); return ndctl_test_result(test, rc); diff --git a/ndctl/test.c b/ndctl/test.c index 6a05d8d62e46..a0f5bc95ae1d 100644 --- a/ndctl/test.c +++ b/ndctl/test.c @@ -58,16 +58,5 @@ int cmd_test(int argc, const char **argv, struct ndctl_ctx *ctx) if (rc && rc != 77) return rc; - rc = test_dpa_alloc(loglevel, test, ctx); - fprintf(stderr, "test-dpa-alloc: %s\n", result(rc)); - if (rc && rc != 77) - return rc; - - rc = test_parent_uuid(loglevel, test, ctx); - fprintf(stderr, "test-parent-uuid: %s\n", result(rc)); - - rc = test_multi_pmem(loglevel, test, ctx); - fprintf(stderr, "test-multi-pmem: %s\n", result(rc)); - return ndctl_test_result(test, rc); } diff --git a/test.h b/test.h index 7de13fe33ea3..b2267e669911 100644 --- a/test.h +++ b/test.h @@ -26,7 +26,6 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, struct ndctl_ctx; int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); -int test_multi_pmem(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); int test_dax_directio(int dax_fd, unsigned long align, void *dax_addr, off_t offset); int test_dax_remap(struct ndctl_test *test, int dax_fd, unsigned long align, void *dax_addr, off_t offset, bool fsdax); @@ -40,9 +39,7 @@ static inline int test_dax_poison(struct ndctl_test *test, int dax_fd, return 0; } #endif -int test_dpa_alloc(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); int test_dsm_fail(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); int test_libndctl(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); -int test_blk_namespaces(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); int test_pmem_namespaces(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx); #endif /* __TEST_H__ */ diff --git a/test/Makefile.am b/test/Makefile.am index c5b8764389ea..a5a54df4f260 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -3,9 +3,6 @@ include $(top_srcdir)/Makefile.am.in TESTS =\ libndctl \ dsm-fail \ - dpa-alloc \ - parent-uuid \ - multi-pmem \ create.sh \ clear.sh \ pmem-errors.sh \ @@ -13,7 +10,6 @@ TESTS =\ multi-dax.sh \ btt-check.sh \ label-compat.sh \ - blk-exhaust.sh \ sector-mode.sh \ inject-error.sh \ btt-errors.sh \ @@ -35,9 +31,6 @@ EXTRA_DIST += $(TESTS) common \ check_PROGRAMS =\ libndctl \ dsm-fail \ - dpa-alloc \ - parent-uuid \ - multi-pmem \ dax-errors \ smart-notify \ smart-listen \ @@ -48,7 +41,6 @@ check_PROGRAMS =\ if ENABLE_DESTRUCTIVE TESTS +=\ - blk-ns \ pmem-ns \ sub-section.sh \ dax-dev \ @@ -68,7 +60,6 @@ TESTS += security.sh endif check_PROGRAMS +=\ - blk-ns \ pmem-ns \ dax-dev \ dax-pmd \ @@ -108,18 +99,9 @@ ack_shutdown_count_set_SOURCES =\ ack_shutdown_count_set_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) -blk_ns_SOURCES = blk_namespaces.c $(testcore) -blk_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) $(UUID_LIBS) - pmem_ns_SOURCES = pmem_namespaces.c $(testcore) pmem_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) $(UUID_LIBS) -dpa_alloc_SOURCES = dpa-alloc.c $(testcore) -dpa_alloc_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS) - -parent_uuid_SOURCES = parent-uuid.c $(testcore) -parent_uuid_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS) - dax_dev_SOURCES = dax-dev.c $(testcore) dax_dev_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) @@ -169,19 +151,6 @@ smart_notify_LDADD = $(LIBNDCTL_LIB) smart_listen_SOURCES = smart-listen.c smart_listen_LDADD = $(LIBNDCTL_LIB) -multi_pmem_SOURCES = \ - multi-pmem.c \ - $(testcore) \ - ../ndctl/namespace.c \ - ../ndctl/check.c \ - ../util/json.c -multi_pmem_LDADD = \ - $(LIBNDCTL_LIB) \ - $(JSON_LIBS) \ - $(UUID_LIBS) \ - $(KMOD_LIBS) \ - ../libutil.a - list_smart_dimm_SOURCES = \ list-smart-dimm.c \ ../util/json.c diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh deleted file mode 100755 index b6d3808969f1..000000000000 --- a/test/blk-exhaust.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -x -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2015-2020 Intel Corporation. All rights reserved. - -set -e - -rc=77 - -. $(dirname $0)/common - -check_min_kver "4.11" || do_skip "may lack blk-exhaustion fix" - -trap 'err $LINENO' ERR - -# setup (reset nfit_test dimms) -modprobe nfit_test -reset - -# if the kernel accounting is correct we should be able to create two -# pmem and two blk namespaces on nfit_test.0 -rc=1 -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw - -# clearnup and exit -_cleanup - -exit 0 diff --git a/test/blk_namespaces.c b/test/blk_namespaces.c deleted file mode 100644 index f076e853ddda..000000000000 --- a/test/blk_namespaces.c +++ /dev/null @@ -1,357 +0,0 @@ -// SPDX-License-Identifier: LGPL-2.1 -// Copyright (C) 2015-2020, Intel Corporation. All rights reserved. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* The purpose of this test is to verify that we can successfully do I/O to - * multiple nd_blk namespaces that have discontiguous segments. It first - * sets up two namespaces, each 1/2 the total size of the NVDIMM and each with - * two discontiguous segments, arranged like this: - * - * +-------+-------+-------+-------+ - * | nd0 | nd1 | nd0 | nd1 | - * +-------+-------+-------+-------+ - * - * It then runs some I/O to the beginning, middle and end of each of these - * namespaces, checking data integrity. The I/O to the middle of the - * namespace will hit two pages, one on either side of the segment boundary. - */ -#define err(msg)\ - fprintf(stderr, "%s:%d: %s (%s)\n", __func__, __LINE__, msg, strerror(errno)) - -static struct ndctl_namespace *create_blk_namespace(int region_fraction, - struct ndctl_region *region) -{ - struct ndctl_namespace *ndns, *seed_ns = NULL; - unsigned long long size; - uuid_t uuid; - - ndctl_region_set_align(region, sysconf(_SC_PAGESIZE)); - ndctl_namespace_foreach(region, ndns) - if (ndctl_namespace_get_size(ndns) == 0) { - seed_ns = ndns; - break; - } - - if (!seed_ns) - return NULL; - - uuid_generate(uuid); - size = ndctl_region_get_size(region)/region_fraction; - - if (ndctl_namespace_set_uuid(seed_ns, uuid) < 0) - return NULL; - - if (ndctl_namespace_set_size(seed_ns, size) < 0) - return NULL; - - if (ndctl_namespace_set_sector_size(seed_ns, 512) < 0) - return NULL; - - if (ndctl_namespace_enable(seed_ns) < 0) - return NULL; - - return seed_ns; -} - -static int disable_blk_namespace(struct ndctl_namespace *ndns) -{ - if (ndctl_namespace_disable_invalidate(ndns) < 0) - return -ENODEV; - - if (ndctl_namespace_delete(ndns) < 0) - return -ENODEV; - - return 0; -} - -static int ns_do_io(const char *bdev) -{ - int fd, i; - int rc = 0; - const int page_size = 4096; - const int num_pages = 4; - unsigned long num_dev_pages, num_blocks; - off_t addr; - - void *random_page[num_pages]; - void *blk_page[num_pages]; - - rc = posix_memalign(random_page, page_size, page_size * num_pages); - if (rc) { - fprintf(stderr, "posix_memalign failure\n"); - return rc; - } - - rc = posix_memalign(blk_page, page_size, page_size * num_pages); - if (rc) { - fprintf(stderr, "posix_memalign failure\n"); - goto err_free_blk; - } - - for (i = 1; i < num_pages; i++) { - random_page[i] = (char*)random_page[0] + page_size * i; - blk_page[i] = (char*)blk_page[0] + page_size * i; - } - - /* read random data into random_page */ - if ((fd = open("/dev/urandom", O_RDONLY)) < 0) { - err("open"); - rc = -ENODEV; - goto err_free_all; - } - - rc = read(fd, random_page[0], page_size * num_pages); - if (rc < 0) { - err("read"); - close(fd); - goto err_free_all; - } - - close(fd); - - if ((fd = open(bdev, O_RDWR|O_DIRECT)) < 0) { - err("open"); - rc = -ENODEV; - goto err_free_all; - } - - ioctl(fd, BLKGETSIZE, &num_blocks); - num_dev_pages = num_blocks / 8; - - /* write the random data out to each of the segments */ - rc = pwrite(fd, random_page[0], page_size, 0); - if (rc < 0) { - err("write"); - goto err_close; - } - - /* two pages that span the region discontinuity */ - addr = page_size * (num_dev_pages/2 - 1); - rc = pwrite(fd, random_page[1], page_size*2, addr); - if (rc < 0) { - err("write"); - goto err_close; - } - - addr = page_size * (num_dev_pages - 1); - rc = pwrite(fd, random_page[3], page_size, addr); - if (rc < 0) { - err("write"); - goto err_close; - } - - /* read back the random data into blk_page */ - rc = pread(fd, blk_page[0], page_size, 0); - if (rc < 0) { - err("read"); - goto err_close; - } - - /* two pages that span the region discontinuity */ - addr = page_size * (num_dev_pages/2 - 1); - rc = pread(fd, blk_page[1], page_size*2, addr); - if (rc < 0) { - err("read"); - goto err_close; - } - - addr = page_size * (num_dev_pages - 1); - rc = pread(fd, blk_page[3], page_size, addr); - if (rc < 0) { - err("read"); - goto err_close; - } - - /* verify the data */ - if (memcmp(random_page[0], blk_page[0], page_size * num_pages)) { - fprintf(stderr, "Block data miscompare\n"); - rc = -EIO; - goto err_close; - } - - rc = 0; - err_close: - close(fd); - err_free_all: - free(random_page[0]); - err_free_blk: - free(blk_page[0]); - return rc; -} - -static const char *comm = "test-blk-namespaces"; - -int test_blk_namespaces(int log_level, struct ndctl_test *test, - struct ndctl_ctx *ctx) -{ - char bdev[50]; - int rc = -ENXIO; - struct ndctl_bus *bus; - struct ndctl_dimm *dimm; - struct kmod_module *mod = NULL; - struct kmod_ctx *kmod_ctx = NULL; - struct ndctl_namespace *ndns[2]; - struct ndctl_region *region, *blk_region = NULL; - - if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 2, 0))) - return 77; - - ndctl_set_log_priority(ctx, log_level); - - bus = ndctl_bus_get_by_provider(ctx, "ACPI.NFIT"); - if (bus) { - /* skip this bus if no BLK regions */ - ndctl_region_foreach(bus, region) - if (ndctl_region_get_nstype(region) - == ND_DEVICE_NAMESPACE_BLK) - break; - if (!region) - bus = NULL; - } - - if (!bus) { - fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n"); - rc = ndctl_test_init(&kmod_ctx, &mod, NULL, log_level, test); - ndctl_invalidate(ctx); - bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0"); - if (rc < 0 || !bus) { - ndctl_test_skip(test); - fprintf(stderr, "nfit_test unavailable skipping tests\n"); - return 77; - } - } - - fprintf(stderr, "%s: found provider: %s\n", comm, - ndctl_bus_get_provider(bus)); - - /* get the system to a clean state */ - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - - ndctl_dimm_foreach(bus, dimm) { - rc = ndctl_dimm_zero_labels(dimm); - if (rc < 0) { - fprintf(stderr, "failed to zero %s\n", - ndctl_dimm_get_devname(dimm)); - goto err_module; - } - } - - /* create our config */ - ndctl_region_foreach(bus, region) - if (strcmp(ndctl_region_get_type_name(region), "blk") == 0) { - blk_region = region; - break; - } - - if (!blk_region || ndctl_region_enable(blk_region) < 0) { - fprintf(stderr, "%s: failed to find block region\n", comm); - rc = -ENODEV; - goto err_cleanup; - } - - rc = -ENODEV; - ndns[0] = create_blk_namespace(4, blk_region); - if (!ndns[0]) { - fprintf(stderr, "%s: failed to create block namespace\n", comm); - goto err_cleanup; - } - - ndns[1] = create_blk_namespace(4, blk_region); - if (!ndns[1]) { - fprintf(stderr, "%s: failed to create block namespace\n", comm); - goto err_cleanup; - } - - rc = disable_blk_namespace(ndns[0]); - if (rc < 0) { - fprintf(stderr, "%s: failed to disable block namespace\n", comm); - goto err_cleanup; - } - - ndns[0] = create_blk_namespace(2, blk_region); - if (!ndns[0]) { - fprintf(stderr, "%s: failed to create block namespace\n", comm); - rc = -ENODEV; - goto err_cleanup; - } - - rc = disable_blk_namespace(ndns[1]); - if (rc < 0) { - fprintf(stderr, "%s: failed to disable block namespace\n", comm); - goto err_cleanup; - } - - rc = -ENODEV; - ndns[1] = create_blk_namespace(2, blk_region); - if (!ndns[1]) { - fprintf(stderr, "%s: failed to create block namespace\n", comm); - goto err_cleanup; - } - - /* okay, all set up, do some I/O */ - rc = -EIO; - sprintf(bdev, "/dev/%s", ndctl_namespace_get_block_device(ndns[0])); - if (ns_do_io(bdev)) - goto err_cleanup; - sprintf(bdev, "/dev/%s", ndctl_namespace_get_block_device(ndns[1])); - if (ns_do_io(bdev)) - goto err_cleanup; - rc = 0; - - err_cleanup: - /* unload nfit_test */ - bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0"); - if (bus) - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - bus = ndctl_bus_get_by_provider(ctx, "nfit_test.1"); - if (bus) - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - if (mod) - kmod_module_remove_module(mod, 0); - - err_module: - if (kmod_ctx) - kmod_unref(kmod_ctx); - return rc; -} - -int __attribute__((weak)) main(int argc, char *argv[]) -{ - struct ndctl_test *test = ndctl_test_new(0); - struct ndctl_ctx *ctx; - int rc; - - comm = argv[0]; - if (!test) { - fprintf(stderr, "failed to initialize test\n"); - return EXIT_FAILURE; - } - - rc = ndctl_new(&ctx); - if (rc) - return ndctl_test_result(test, rc); - - rc = test_blk_namespaces(LOG_DEBUG, test, ctx); - ndctl_unref(ctx); - return ndctl_test_result(test, rc); -} diff --git a/test/core.c b/test/core.c index 93e1dae5a144..dc1405d75c49 100644 --- a/test/core.c +++ b/test/core.c @@ -123,7 +123,6 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, "dax_pmem_core", "dax_pmem_compat", "libnvdimm", - "nd_blk", "nd_btt", "nd_e820", "nd_pmem", diff --git a/test/create.sh b/test/create.sh index e9baaa075a28..9a6f3733939e 100755 --- a/test/create.sh +++ b/test/create.sh @@ -40,19 +40,6 @@ eval $(echo $json | json2var) # free capacity for blk creation $NDCTL destroy-namespace -f $dev -# create blk -dev="x" -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw -v) -eval $(echo $json | json2var) -[ $dev = "x" ] && echo "fail: $LINENO" && exit 1 -[ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 - -# convert blk to sector mode -json=$($NDCTL create-namespace -m sector -l $SECTOR_SIZE -f -e $dev) -eval $(echo $json | json2var) -[ $sector_size != $SECTOR_SIZE ] && echo "fail: $LINENO" && exit 1 -[ $mode != "sector" ] && echo "fail: $LINENO" && exit 1 - _cleanup exit 0 diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c deleted file mode 100644 index 59185cf8cf3b..000000000000 --- a/test/dpa-alloc.c +++ /dev/null @@ -1,326 +0,0 @@ -// SPDX-License-Identifier: LGPL-2.1 -// Copyright (C) 2014-2020, Intel Corporation. All rights reserved. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static const char *NFIT_PROVIDER0 = "nfit_test.0"; -static const char *NFIT_PROVIDER1 = "nfit_test.1"; -#define NUM_NAMESPACES 4 - -struct test_dpa_namespace { - struct ndctl_namespace *ndns; - unsigned long long size; - uuid_t uuid; -} namespaces[NUM_NAMESPACES]; - -#define MIN_SIZE SZ_4M - -static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) -{ - unsigned int default_available_slots, available_slots, i; - struct ndctl_region *region, *blk_region = NULL; - struct ndctl_namespace *ndns; - struct ndctl_dimm *dimm; - unsigned long size, page_size; - struct ndctl_bus *bus; - char uuid_str[40]; - int round; - int rc; - - page_size = sysconf(_SC_PAGESIZE); - /* disable nfit_test.1, not used in this test */ - bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1); - if (!bus) - return -ENXIO; - ndctl_region_foreach(bus, region) { - ndctl_region_disable_invalidate(region); - ndctl_region_set_align(region, sysconf(_SC_PAGESIZE) - * ndctl_region_get_interleave_ways(region)); - } - - /* init nfit_test.0 */ - bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0); - if (!bus) - return -ENXIO; - ndctl_region_foreach(bus, region) { - ndctl_region_disable_invalidate(region); - ndctl_region_set_align(region, sysconf(_SC_PAGESIZE) - * ndctl_region_get_interleave_ways(region)); - } - - ndctl_dimm_foreach(bus, dimm) { - rc = ndctl_dimm_zero_labels(dimm); - if (rc < 0) { - fprintf(stderr, "failed to zero %s\n", - ndctl_dimm_get_devname(dimm)); - return rc; - } - } - - /* - * Find a guineapig BLK region, we know that the dimm with - * handle==0 from nfit_test.0 always allocates from highest DPA - * to lowest with no excursions into BLK only ranges. - */ - ndctl_region_foreach(bus, region) { - if (ndctl_region_get_type(region) != ND_DEVICE_REGION_BLK) - continue; - dimm = ndctl_region_get_first_dimm(region); - if (!dimm) - continue; - if (ndctl_dimm_get_handle(dimm) == 0) { - blk_region = region; - break; - } - } - if (!blk_region || ndctl_region_enable(blk_region) < 0) { - fprintf(stderr, "failed to find a usable BLK region\n"); - return -ENXIO; - } - region = blk_region; - - if (ndctl_region_get_available_size(region) / MIN_SIZE < NUM_NAMESPACES) { - fprintf(stderr, "%s insufficient available_size\n", - ndctl_region_get_devname(region)); - return -ENXIO; - } - - default_available_slots = ndctl_dimm_get_available_labels(dimm); - - /* grow namespaces */ - for (i = 0; i < ARRAY_SIZE(namespaces); i++) { - uuid_t uuid; - - ndns = ndctl_region_get_namespace_seed(region); - if (!ndns) { - fprintf(stderr, "%s: failed to get seed: %d\n", - ndctl_region_get_devname(region), i); - return -ENXIO; - } - uuid_generate_random(uuid); - ndctl_namespace_set_uuid(ndns, uuid); - ndctl_namespace_set_sector_size(ndns, 512); - ndctl_namespace_set_size(ndns, MIN_SIZE); - rc = ndctl_namespace_enable(ndns); - if (rc) { - fprintf(stderr, "failed to enable %s: %d\n", - ndctl_namespace_get_devname(ndns), rc); - return rc; - } - ndctl_namespace_disable_invalidate(ndns); - rc = ndctl_namespace_set_size(ndns, page_size); - if (rc) { - fprintf(stderr, "failed to init %s to size: %lu\n", - ndctl_namespace_get_devname(ndns), - page_size); - return rc; - } - namespaces[i].ndns = ndns; - ndctl_namespace_get_uuid(ndns, namespaces[i].uuid); - } - - available_slots = ndctl_dimm_get_available_labels(dimm); - if (available_slots != default_available_slots - - ARRAY_SIZE(namespaces)) { - fprintf(stderr, "expected %ld slots available\n", - default_available_slots - - ARRAY_SIZE(namespaces)); - return -ENOSPC; - } - - /* exhaust label space, by round-robin allocating 4K */ - round = 1; - for (i = 0; i < available_slots; i++) { - ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns; - if (i % ARRAY_SIZE(namespaces) == 0) - round++; - size = page_size * round; - rc = ndctl_namespace_set_size(ndns, size); - if (rc) { - fprintf(stderr, "%s: set_size: %lx failed: %d\n", - ndctl_namespace_get_devname(ndns), size, rc); - return rc; - } - } - - /* - * The last namespace we updated should still be modifiable via - * the kernel's reserve label - */ - i--; - round++; - ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns; - size = page_size * round; - rc = ndctl_namespace_set_size(ndns, size); - if (rc) { - fprintf(stderr, "%s failed to update while labels full\n", - ndctl_namespace_get_devname(ndns)); - return rc; - } - - round--; - size = page_size * round; - rc = ndctl_namespace_set_size(ndns, size); - if (rc) { - fprintf(stderr, "%s failed to reduce size while labels full\n", - ndctl_namespace_get_devname(ndns)); - return rc; - } - - /* do the allocations survive a region cycle? */ - for (i = 0; i < ARRAY_SIZE(namespaces); i++) { - ndns = namespaces[i].ndns; - namespaces[i].size = ndctl_namespace_get_size(ndns); - namespaces[i].ndns = NULL; - } - - ndctl_region_disable_invalidate(region); - rc = ndctl_region_enable(region); - if (rc) { - fprintf(stderr, "failed to re-enable %s: %d\n", - ndctl_region_get_devname(region), rc); - return rc; - } - - ndctl_namespace_foreach(region, ndns) { - uuid_t uuid; - - ndctl_namespace_get_uuid(ndns, uuid); - for (i = 0; i < ARRAY_SIZE(namespaces); i++) { - if (uuid_compare(uuid, namespaces[i].uuid) == 0) { - namespaces[i].ndns = ndns; - break; - } - } - } - - /* validate that they all came back */ - for (i = 0; i < ARRAY_SIZE(namespaces); i++) { - ndns = namespaces[i].ndns; - size = ndns ? ndctl_namespace_get_size(ndns) : 0; - - if (ndns && size == namespaces[i].size) - continue; - uuid_unparse(namespaces[i].uuid, uuid_str); - fprintf(stderr, "failed to recover %s\n", uuid_str); - return -ENODEV; - } - - /* test deletion and merging */ - ndns = namespaces[0].ndns; - for (i = 1; i < ARRAY_SIZE(namespaces); i++) { - struct ndctl_namespace *victim = namespaces[i].ndns; - - uuid_unparse(namespaces[i].uuid, uuid_str); - size = ndctl_namespace_get_size(victim); - rc = ndctl_namespace_disable(victim); - if (rc) { - fprintf(stderr, "failed to disable %s\n", uuid_str); - return rc; - } - rc = ndctl_namespace_delete(victim); - if (rc) { - fprintf(stderr, "failed to delete %s\n", uuid_str); - return rc; - } - size += ndctl_namespace_get_size(ndns); - rc = ndctl_namespace_set_size(ndns, size); - if (rc) { - fprintf(stderr, "failed to merge %s\n", uuid_str); - return rc; - } - } - - /* there can be only one */ - i = 0; - ndctl_namespace_foreach(region, ndns) { - unsigned long long sz = ndctl_namespace_get_size(ndns); - - if (sz) { - i++; - if (sz == size) - continue; - fprintf(stderr, "%s size: %llx expected %lx\n", - ndctl_namespace_get_devname(ndns), - sz, size); - return -ENXIO; - } - } - if (i != 1) { - fprintf(stderr, "failed to delete namespaces\n"); - return -ENXIO; - } - - available_slots = ndctl_dimm_get_available_labels(dimm); - if (available_slots != default_available_slots - 1) { - fprintf(stderr, "mishandled slot count\n"); - return -ENXIO; - } - - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - - return 0; -} - -int test_dpa_alloc(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) -{ - struct kmod_module *mod; - struct kmod_ctx *kmod_ctx; - int err, result = EXIT_FAILURE; - - if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 2, 0))) - return 77; - - ndctl_set_log_priority(ctx, loglevel); - err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test); - if (err < 0) { - ndctl_test_skip(test); - fprintf(stderr, "nfit_test unavailable skipping tests\n"); - return 77; - } - - err = do_test(ctx, test); - if (err == 0) - result = EXIT_SUCCESS; - kmod_module_remove_module(mod, 0); - kmod_unref(kmod_ctx); - return result; -} - -int __attribute__((weak)) main(int argc, char *argv[]) -{ - struct ndctl_test *test = ndctl_test_new(0); - struct ndctl_ctx *ctx; - int rc; - - if (!test) { - fprintf(stderr, "failed to initialize test\n"); - return EXIT_FAILURE; - } - - rc = ndctl_new(&ctx); - if (rc) - return ndctl_test_result(test, rc); - - rc = test_dpa_alloc(LOG_DEBUG, test, ctx); - ndctl_unref(ctx); - return ndctl_test_result(test, rc); -} diff --git a/test/libndctl.c b/test/libndctl.c index aa624289c708..0bee06b93787 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -30,46 +30,35 @@ /* * Kernel provider "nfit_test.0" produces an NFIT with the following attributes: * - * (a) (b) DIMM BLK-REGION - * +-------------------+--------+--------+--------+ - * +------+ | pm0.0 | blk2.0 | pm1.0 | blk2.1 | 0 region2 - * | imc0 +--+- - - region0- - - +--------+ +--------+ - * +--+---+ | pm0.0 | blk3.0 | pm1.0 | blk3.1 | 1 region3 - * | +-------------------+--------v v--------+ - * +--+---+ | | - * | cpu0 | region1 - * +--+---+ | | - * | +----------------------------^ ^--------+ - * +--+---+ | blk4.0 | pm1.0 | blk4.0 | 2 region4 - * | imc1 +--+----------------------------| +--------+ - * +------+ | blk5.0 | pm1.0 | blk5.0 | 3 region5 - * +----------------------------+--------+--------+ + * (a) (b) DIMM + * +-------------------+--------+--------+--------+ + * +------+ | pm0.0 | free | pm1.0 | free | 0 + * | imc0 +--+- - - region0- - - +--------+ +--------+ + * +--+---+ | pm0.0 | free | pm1.0 | free | 1 + * | +-------------------+--------v v--------+ + * +--+---+ | | + * | cpu0 | region1 + * +--+---+ | | + * | +----------------------------^ ^--------+ + * +--+---+ | free | pm1.0 | free | 2 + * | imc1 +--+----------------------------| +--------+ + * +------+ | free | pm1.0 | free | 3 + * +----------------------------+--------+--------+ * - * *) In this layout we have four dimms and two memory controllers in one - * socket. Each unique interface ("blk" or "pmem") to DPA space - * is identified by a region device with a dynamically assigned id. + * In this platform we have four DIMMs and two memory controllers in one + * socket. Each PMEM interleave set is identified by a region device with + * a dynamically assigned id. * - * *) The first portion of dimm0 and dimm1 are interleaved as REGION0. - * A single "pmem" namespace is created in the REGION0-"spa"-range - * that spans dimm0 and dimm1 with a user-specified name of "pm0.0". - * Some of that interleaved "spa" range is reclaimed as "bdw" - * accessed space starting at offset (a) into each dimm. In that - * reclaimed space we create two "bdw" "namespaces" from REGION2 and - * REGION3 where "blk2.0" and "blk3.0" are just human readable names - * that could be set to any user-desired name in the label. + * 1. The first portion of DIMM0 and DIMM1 are interleaved as REGION0. A + * single PMEM namespace is created in the REGION0-SPA-range that spans most + * of DIMM0 and DIMM1 with a user-specified name of "pm0.0". Some of that + * interleaved system-physical-address range is left free for + * another PMEM namespace to be defined. * - * *) In the last portion of dimm0 and dimm1 we have an interleaved - * "spa" range, REGION1, that spans those two dimms as well as dimm2 - * and dimm3. Some of REGION1 allocated to a "pmem" namespace named - * "pm1.0" the rest is reclaimed in 4 "bdw" namespaces (for each - * dimm in the interleave set), "blk2.1", "blk3.1", "blk4.0", and - * "blk5.0". - * - * *) The portion of dimm2 and dimm3 that do not participate in the - * REGION1 interleaved "spa" range (i.e. the DPA address below - * offset (b) are also included in the "blk4.0" and "blk5.0" - * namespaces. Note, that this example shows that "bdw" namespaces - * don't need to be contiguous in DPA-space. + * 2. In the last portion of DIMM0 and DIMM1 we have an interleaved + * system-physical-address range, REGION1, that spans those two DIMMs as + * well as DIMM2 and DIMM3. Some of REGION1 is allocated to a PMEM namespace + * named "pm1.0". * * Kernel provider "nfit_test.1" produces an NFIT with the following attributes: * @@ -127,10 +116,10 @@ struct dimm { (((n & 0xfff) << 16) | ((s & 0xf) << 12) | ((i & 0xf) << 8) \ | ((c & 0xf) << 4) | (d & 0xf)) static struct dimm dimms0[] = { - { DIMM_HANDLE(0, 0, 0, 0, 0), 0, 0, 2016, 10, 42, { 0 }, 2, { 0x201, 0x301, }, }, - { DIMM_HANDLE(0, 0, 0, 0, 1), 1, 0, 2016, 10, 42, { 0 }, 2, { 0x201, 0x301, }, }, - { DIMM_HANDLE(0, 0, 1, 0, 0), 2, 0, 2016, 10, 42, { 0 }, 2, { 0x201, 0x301, }, }, - { DIMM_HANDLE(0, 0, 1, 0, 1), 3, 0, 2016, 10, 42, { 0 }, 2, { 0x201, 0x301, }, }, + { DIMM_HANDLE(0, 0, 0, 0, 0), 0, 0, 2016, 10, 42, { 0 }, 1, { 0x201, }, }, + { DIMM_HANDLE(0, 0, 0, 0, 1), 1, 0, 2016, 10, 42, { 0 }, 1, { 0x201, }, }, + { DIMM_HANDLE(0, 0, 1, 0, 0), 2, 0, 2016, 10, 42, { 0 }, 1, { 0x201, }, }, + { DIMM_HANDLE(0, 0, 1, 0, 1), 3, 0, 2016, 10, 42, { 0 }, 1, { 0x201, }, }, }; static struct dimm dimms1[] = { @@ -240,7 +229,6 @@ struct namespace { }; static uuid_t null_uuid; -static unsigned long blk_sector_sizes[] = { 512, 520, 528, 4096, 4104, 4160, 4224, }; static unsigned long pmem_sector_sizes[] = { 512, 4096 }; static unsigned long io_sector_sizes[] = { 0 }; @@ -262,60 +250,6 @@ static struct namespace namespace1_pmem0 = { ARRAY_SIZE(pmem_sector_sizes), pmem_sector_sizes, }; -static struct namespace namespace2_blk0 = { - 0, "namespace_blk", NULL, NULL, NULL, SZ_7M, - { 3, 3, 3, 3, - 3, 3, 3, 3, - 3, 3, 3, 3, - 3, 3, 3, 3, }, 1, 1, 0, - ARRAY_SIZE(blk_sector_sizes), blk_sector_sizes, -}; - -static struct namespace namespace2_blk1 = { - 1, "namespace_blk", NULL, NULL, NULL, SZ_11M, - { 4, 4, 4, 4, - 4, 4, 4, 4, - 4, 4, 4, 4, - 4, 4, 4, 4, }, 1, 1, 0, - ARRAY_SIZE(blk_sector_sizes), blk_sector_sizes, -}; - -static struct namespace namespace3_blk0 = { - 0, "namespace_blk", NULL, NULL, NULL, SZ_7M, - { 5, 5, 5, 5, - 5, 5, 5, 5, - 5, 5, 5, 5, - 5, 5, 5, 5, }, 1, 1, 0, - ARRAY_SIZE(blk_sector_sizes), blk_sector_sizes, -}; - -static struct namespace namespace3_blk1 = { - 1, "namespace_blk", NULL, NULL, NULL, SZ_11M, - { 6, 6, 6, 6, - 6, 6, 6, 6, - 6, 6, 6, 6, - 6, 6, 6, 6, }, 1, 1, 0, - ARRAY_SIZE(blk_sector_sizes), blk_sector_sizes, -}; - -static struct namespace namespace4_blk0 = { - 0, "namespace_blk", &btt_settings, NULL, NULL, SZ_27M, - { 7, 7, 7, 7, - 7, 7, 7, 7, - 7, 7, 7, 7, - 7, 7, 7, 7, }, 1, 1, 0, - ARRAY_SIZE(blk_sector_sizes), blk_sector_sizes, -}; - -static struct namespace namespace5_blk0 = { - 0, "namespace_blk", &btt_settings, NULL, NULL, SZ_27M, - { 8, 8, 8, 8, - 8, 8, 8, 8, - 8, 8, 8, 8, - 8, 8, 8, 8, }, 1, 1, 0, - ARRAY_SIZE(blk_sector_sizes), blk_sector_sizes, -}; - static struct region regions0[] = { { { 1 }, 2, 1, "pmem", SZ_32M, SZ_32M, { 1 }, .namespaces = { @@ -339,40 +273,6 @@ static struct region regions0[] = { [0] = &default_pfn, }, }, - { { DIMM_HANDLE(0, 0, 0, 0, 0) }, 1, 1, "blk", SZ_18M, SZ_32M, - .namespaces = { - [0] = &namespace2_blk0, - [1] = &namespace2_blk1, - }, - .btts = { - [0] = &default_btt, - }, - }, - { { DIMM_HANDLE(0, 0, 0, 0, 1) }, 1, 1, "blk", SZ_18M, SZ_32M, - .namespaces = { - [0] = &namespace3_blk0, - [1] = &namespace3_blk1, - }, - .btts = { - [0] = &default_btt, - }, - }, - { { DIMM_HANDLE(0, 0, 1, 0, 0) }, 1, 1, "blk", SZ_27M, SZ_32M, - .namespaces = { - [0] = &namespace4_blk0, - }, - .btts = { - [0] = &default_btt, - }, - }, - { { DIMM_HANDLE(0, 0, 1, 0, 1) }, 1, 1, "blk", SZ_27M, SZ_32M, - .namespaces = { - [0] = &namespace5_blk0, - }, - .btts = { - [0] = &default_btt, - }, - }, }; static struct namespace namespace1 = { @@ -485,26 +385,6 @@ static struct ndctl_region *get_pmem_region_by_range_index(struct ndctl_bus *bus return NULL; } -static struct ndctl_region *get_blk_region_by_dimm_handle(struct ndctl_bus *bus, - unsigned int handle) -{ - struct ndctl_region *region; - - ndctl_region_foreach(bus, region) { - struct ndctl_mapping *map; - - if (ndctl_region_get_type(region) != ND_DEVICE_REGION_BLK) - continue; - ndctl_mapping_foreach(region, map) { - struct ndctl_dimm *dimm = ndctl_mapping_get_dimm(map); - - if (ndctl_dimm_get_handle(dimm) == handle) - return region; - } - } - return NULL; -} - enum ns_mode { BTT, PFN, DAX, }; @@ -522,11 +402,8 @@ static int check_regions(struct ndctl_bus *bus, struct region *regions, int n, struct ndctl_interleave_set *iset; char devname[50]; - if (strcmp(regions[i].type, "pmem") == 0) - region = get_pmem_region_by_range_index(bus, regions[i].range_index); - else - region = get_blk_region_by_dimm_handle(bus, regions[i].handle); - + region = get_pmem_region_by_range_index(bus, + regions[i].range_index); if (!region) { fprintf(stderr, "failed to find region type: %s ident: %x\n", regions[i].type, regions[i].handle); @@ -1065,7 +942,6 @@ static int check_btt_create(struct ndctl_region *region, struct ndctl_namespace return -ENXIO; for (i = 0; i < btt_s->num_sector_sizes; i++) { - struct ndctl_namespace *ns_seed = ndctl_region_get_namespace_seed(region); struct ndctl_btt *btt_seed = ndctl_region_get_btt_seed(region); enum ndctl_namespace_mode mode; @@ -1115,16 +991,6 @@ static int check_btt_create(struct ndctl_region *region, struct ndctl_namespace goto err; } - /* check new seed creation for BLK regions */ - if (ndctl_region_get_type(region) == ND_DEVICE_REGION_BLK) { - if (ns_seed == ndctl_region_get_namespace_seed(region) - && ndns == ns_seed) { - fprintf(stderr, "%s: failed to advance namespace seed\n", - ndctl_region_get_devname(region)); - goto err; - } - } - if (namespace->ro) { ndctl_region_set_ro(region, 0); rc = ndctl_btt_enable(btt); diff --git a/test/multi-pmem.c b/test/multi-pmem.c deleted file mode 100644 index 3ea08cc43f9a..000000000000 --- a/test/multi-pmem.c +++ /dev/null @@ -1,285 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (C) 2015-2020 Intel Corporation. All rights reserved. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define NUM_NAMESPACES 4 -#define SZ_NAMESPACE SZ_16M - -static int setup_namespace(struct ndctl_region *region) -{ - struct ndctl_ctx *ctx = ndctl_region_get_ctx(region); - const char *argv[] = { - "__func__", "-v", "-m", "raw", "-s", "16M", "-r", "", - }; - int argc = ARRAY_SIZE(argv); - - argv[argc - 1] = ndctl_region_get_devname(region); - builtin_xaction_namespace_reset(); - return cmd_create_namespace(argc, argv, ctx); -} - -static void destroy_namespace(struct ndctl_namespace *ndns) -{ - struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns); - const char *argv[] = { - "__func__", "-v", "-f", "", - }; - int argc = ARRAY_SIZE(argv); - - argv[argc - 1] = ndctl_namespace_get_devname(ndns); - builtin_xaction_namespace_reset(); - cmd_destroy_namespace(argc, argv, ctx); -} - -/* Check that the namespace device is gone (if it wasn't the seed) */ -static int check_deleted(struct ndctl_region *region, const char *devname, - struct ndctl_test *test) -{ - struct ndctl_namespace *ndns; - - if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 10, 0))) - return 0; - - ndctl_namespace_foreach(region, ndns) { - if (strcmp(devname, ndctl_namespace_get_devname(ndns))) - continue; - if (ndns == ndctl_region_get_namespace_seed(region)) - continue; - fprintf(stderr, "multi-pmem: expected %s to be deleted\n", - devname); - return -ENXIO; - } - - return 0; -} - -static int do_multi_pmem(struct ndctl_ctx *ctx, struct ndctl_test *test) -{ - int i; - char devname[100]; - struct ndctl_bus *bus; - uuid_t uuid[NUM_NAMESPACES]; - struct ndctl_namespace *ndns; - struct ndctl_dimm *dimm_target, *dimm; - struct ndctl_region *region, *target = NULL; - struct ndctl_namespace *namespaces[NUM_NAMESPACES]; - unsigned long long blk_avail, blk_avail_orig, expect; - - if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 9, 0))) { - ndctl_test_skip(test); - return 77; - } - - bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0"); - if (!bus) - return -ENXIO; - - /* disable all regions so that set_config_data commands are permitted */ - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - - ndctl_dimm_foreach(bus, dimm) { - int rc = ndctl_dimm_zero_labels(dimm); - - if (rc < 0) { - fprintf(stderr, "failed to zero %s\n", - ndctl_dimm_get_devname(dimm)); - return rc; - } - } - - /* - * Set regions back to their default state and find our target - * region. - */ - ndctl_region_foreach(bus, region) { - ndctl_region_enable(region); - if (ndctl_region_get_available_size(region) - == SZ_NAMESPACE * NUM_NAMESPACES) - target = region; - } - - if (!target) { - fprintf(stderr, "multi-pmem: failed to find target region\n"); - return -ENXIO; - } - region = target; - - for (i = 0; i < (int) ARRAY_SIZE(uuid); i++) { - if (setup_namespace(region) != 0) { - fprintf(stderr, "multi-pmem: failed to setup namespace: %d\n", i); - return -ENXIO; - } - sprintf(devname, "namespace%d.%d", - ndctl_region_get_id(region), i); - ndctl_namespace_foreach(region, ndns) - if (strcmp(ndctl_namespace_get_devname(ndns), devname) == 0 - && ndctl_namespace_is_enabled(ndns)) - break; - if (!ndns) { - fprintf(stderr, "multi-pmem: failed to find namespace: %s\n", - devname); - return -ENXIO; - } - ndctl_namespace_get_uuid(ndns, uuid[i]); - } - - /* bounce the region and verify everything came back as expected */ - ndctl_region_disable_invalidate(region); - ndctl_region_enable(region); - - for (i = 0; i < (int) ARRAY_SIZE(uuid); i++) { - char uuid_str1[40], uuid_str2[40]; - uuid_t uuid_check; - - sprintf(devname, "namespace%d.%d", - ndctl_region_get_id(region), i); - ndctl_namespace_foreach(region, ndns) - if (strcmp(ndctl_namespace_get_devname(ndns), devname) == 0 - && ndctl_namespace_is_enabled(ndns)) - break; - if (!ndns) { - fprintf(stderr, "multi-pmem: failed to restore namespace: %s\n", - devname); - return -ENXIO; - } - - ndctl_namespace_get_uuid(ndns, uuid_check); - uuid_unparse(uuid_check, uuid_str2); - uuid_unparse(uuid[i], uuid_str1); - if (uuid_compare(uuid_check, uuid[i]) != 0) { - fprintf(stderr, "multi-pmem: expected uuid[%d]: %s, got %s\n", - i, uuid_str1, uuid_str2); - return -ENXIO; - } - namespaces[i] = ndns; - } - - /* - * Check that aliased blk capacity does not increase until the - * highest dpa pmem-namespace is deleted. - */ - dimm_target = ndctl_region_get_first_dimm(region); - if (!dimm_target) { - fprintf(stderr, "multi-pmem: failed to retrieve dimm from %s\n", - ndctl_region_get_devname(region)); - return -ENXIO; - } - - dimm = NULL; - ndctl_region_foreach(bus, region) { - if (ndctl_region_get_type(region) != ND_DEVICE_REGION_BLK) - continue; - ndctl_dimm_foreach_in_region(region, dimm) - if (dimm == dimm_target) - break; - if (dimm) - break; - } - - blk_avail_orig = ndctl_region_get_available_size(region); - for (i = 1; i < NUM_NAMESPACES - 1; i++) { - ndns = namespaces[i]; - sprintf(devname, "%s", ndctl_namespace_get_devname(ndns)); - destroy_namespace(ndns); - blk_avail = ndctl_region_get_available_size(region); - if (blk_avail != blk_avail_orig) { - fprintf(stderr, "multi-pmem: destroy %s %llx avail, expect %llx\n", - devname, blk_avail, blk_avail_orig); - return -ENXIO; - } - - if (check_deleted(target, devname, test) != 0) - return -ENXIO; - } - - ndns = namespaces[NUM_NAMESPACES - 1]; - sprintf(devname, "%s", ndctl_namespace_get_devname(ndns)); - destroy_namespace(ndns); - blk_avail = ndctl_region_get_available_size(region); - expect = (SZ_NAMESPACE / ndctl_region_get_interleave_ways(target)) - * (NUM_NAMESPACES - 1) + blk_avail_orig; - if (blk_avail != expect) { - fprintf(stderr, "multi-pmem: destroy %s %llx avail, expect %llx\n", - devname, blk_avail, expect); - return -ENXIO; - } - - if (check_deleted(target, devname, test) != 0) - return -ENXIO; - - ndctl_bus_foreach(ctx, bus) { - if (strncmp(ndctl_bus_get_provider(bus), "nfit_test", 9) != 0) - continue; - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - } - - return 0; -} - -int test_multi_pmem(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) -{ - struct kmod_module *mod; - struct kmod_ctx *kmod_ctx; - int err, result = EXIT_FAILURE; - - if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 2, 0))) - return 77; - - ndctl_set_log_priority(ctx, loglevel); - - err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test); - if (err < 0) { - result = 77; - ndctl_test_skip(test); - fprintf(stderr, "%s unavailable skipping tests\n", - "nfit_test"); - return result; - } - - result = do_multi_pmem(ctx, test); - - kmod_module_remove_module(mod, 0); - kmod_unref(kmod_ctx); - return result; -} - -int __attribute__((weak)) main(int argc, char *argv[]) -{ - struct ndctl_test *test = ndctl_test_new(0); - struct ndctl_ctx *ctx; - int rc; - - if (!test) { - fprintf(stderr, "failed to initialize test\n"); - return EXIT_FAILURE; - } - - rc = ndctl_new(&ctx); - if (rc) - return ndctl_test_result(test, rc); - rc = test_multi_pmem(LOG_DEBUG, test, ctx); - ndctl_unref(ctx); - return ndctl_test_result(test, rc); -} diff --git a/test/parent-uuid.c b/test/parent-uuid.c deleted file mode 100644 index bded33afbf23..000000000000 --- a/test/parent-uuid.c +++ /dev/null @@ -1,254 +0,0 @@ -// SPDX-License-Identifier: LGPL-2.1 -// Copyright (C) 2015-2020, Intel Corporation. All rights reserved. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static const char *PROVIDER = "nfit_test.0"; - -static struct ndctl_bus *get_bus_by_provider(struct ndctl_ctx *ctx, - const char *provider) -{ - struct ndctl_bus *bus; - - ndctl_bus_foreach(ctx, bus) - if (strcmp(provider, ndctl_bus_get_provider(bus)) == 0) - return bus; - - return NULL; -} - -static struct ndctl_btt *get_idle_btt(struct ndctl_region *region) -{ - struct ndctl_btt *btt; - - ndctl_btt_foreach(region, btt) - if (!ndctl_btt_is_enabled(btt) - && !ndctl_btt_is_configured(btt)) - return btt; - return NULL; -} - -static struct ndctl_namespace *create_blk_namespace(int region_fraction, - struct ndctl_region *region, unsigned long long req_size, - uuid_t uuid) -{ - struct ndctl_namespace *ndns, *seed_ns = NULL; - unsigned long long size; - - ndctl_region_set_align(region, sysconf(_SC_PAGESIZE)); - ndctl_namespace_foreach(region, ndns) - if (ndctl_namespace_get_size(ndns) == 0) { - seed_ns = ndns; - break; - } - - if (!seed_ns) - return NULL; - - size = ndctl_region_get_size(region)/region_fraction; - if (req_size) - size = req_size; - - if (ndctl_namespace_set_uuid(seed_ns, uuid) < 0) - return NULL; - - if (ndctl_namespace_set_size(seed_ns, size) < 0) - return NULL; - - if (ndctl_namespace_set_sector_size(seed_ns, 512) < 0) - return NULL; - - if (ndctl_namespace_enable(seed_ns) < 0) - return NULL; - - return seed_ns; -} - -static int disable_blk_namespace(struct ndctl_namespace *ndns) -{ - if (ndctl_namespace_disable_invalidate(ndns) < 0) - return -ENODEV; - - if (ndctl_namespace_delete(ndns) < 0) - return -ENODEV; - - return 0; -} - -static struct ndctl_btt *check_valid_btt(struct ndctl_region *region, - struct ndctl_namespace *ndns, uuid_t btt_uuid) -{ - struct ndctl_btt *btt = NULL; - ndctl_btt_foreach(region, btt) { - struct ndctl_namespace *btt_ndns; - uuid_t uu; - - ndctl_btt_get_uuid(btt, uu); - if (uuid_compare(uu, btt_uuid) != 0) - continue; - if (!ndctl_btt_is_enabled(btt)) - continue; - btt_ndns = ndctl_btt_get_namespace(btt); - if (!btt_ndns || strcmp(ndctl_namespace_get_devname(btt_ndns), - ndctl_namespace_get_devname(ndns)) != 0) - continue; - return btt; - } - return NULL; -} - -static int do_test(struct ndctl_ctx *ctx) -{ - int rc; - struct ndctl_bus *bus; - struct ndctl_btt *btt, *found = NULL, *_btt; - struct ndctl_region *region, *blk_region = NULL; - struct ndctl_namespace *ndns, *_ndns; - unsigned long long ns_size = 18874368; - uuid_t uuid = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16}; - uuid_t btt_uuid; - - bus = get_bus_by_provider(ctx, PROVIDER); - if (!bus) { - fprintf(stderr, "failed to find NFIT-provider: %s\n", PROVIDER); - return -ENODEV; - } - - ndctl_region_foreach(bus, region) - if (strcmp(ndctl_region_get_type_name(region), "blk") == 0) { - blk_region = region; - break; - } - - if (!blk_region) { - fprintf(stderr, "failed to find block region\n"); - return -ENODEV; - } - - /* create a blk namespace */ - ndns = create_blk_namespace(1, blk_region, ns_size, uuid); - if (!ndns) { - fprintf(stderr, "failed to create block namespace\n"); - return -ENXIO; - } - - /* create a btt for this namespace */ - uuid_generate(btt_uuid); - btt = get_idle_btt(region); - if (!btt) - return -ENXIO; - - ndctl_namespace_disable_invalidate(ndns); - ndctl_btt_set_uuid(btt, btt_uuid); - ndctl_btt_set_sector_size(btt, 512); - ndctl_btt_set_namespace(btt, ndns); - rc = ndctl_btt_enable(btt); - if (rc) { - fprintf(stderr, "failed to create btt 0\n"); - return rc; - } - - /* re-create the namespace - this should auto-enable the btt */ - disable_blk_namespace(ndns); - ndns = create_blk_namespace(1, blk_region, ns_size, uuid); - if (!ndns) { - fprintf(stderr, "failed to re-create block namespace\n"); - return -ENXIO; - } - - /* Verify btt was auto-created */ - found = check_valid_btt(blk_region, ndns, btt_uuid); - if (!found) - return -ENXIO; - btt = found; - - /*disable the btt and namespace again */ - ndctl_btt_delete(btt); - disable_blk_namespace(ndns); - - /* recreate the namespace with a different uuid */ - uuid_generate(uuid); - ndns = create_blk_namespace(1, blk_region, ns_size, uuid); - if (!ndns) { - fprintf(stderr, "failed to re-create block namespace\n"); - return -ENXIO; - } - - /* make sure there is no btt on this namespace */ - found = check_valid_btt(blk_region, ndns, btt_uuid); - if (found) { - fprintf(stderr, "found a stale btt\n"); - return -ENXIO; - } - - ndctl_btt_foreach_safe(blk_region, btt, _btt) - ndctl_btt_delete(btt); - - ndctl_namespace_foreach_safe(blk_region, ndns, _ndns) - if (ndctl_namespace_get_size(ndns) != 0) - disable_blk_namespace(ndns); - - ndctl_region_foreach(bus, region) - ndctl_region_disable_invalidate(region); - - return 0; -} - -int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) -{ - struct kmod_module *mod; - struct kmod_ctx *kmod_ctx; - int err, result = EXIT_FAILURE; - - if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 3, 0))) - return 77; - - ndctl_set_log_priority(ctx, loglevel); - err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test); - if (err < 0) { - ndctl_test_skip(test); - fprintf(stderr, "nfit_test unavailable skipping tests\n"); - return 77; - } - - err = do_test(ctx); - if (err == 0) - result = EXIT_SUCCESS; - kmod_module_remove_module(mod, 0); - kmod_unref(kmod_ctx); - return result; -} - -int __attribute__((weak)) main(int argc, char *argv[]) -{ - struct ndctl_test *test = ndctl_test_new(0); - struct ndctl_ctx *ctx; - int rc; - - if (!test) { - fprintf(stderr, "failed to initialize test\n"); - return EXIT_FAILURE; - } - - rc = ndctl_new(&ctx); - if (rc) - return ndctl_test_result(test, rc); - - rc = test_parent_uuid(LOG_DEBUG, test, ctx); - ndctl_unref(ctx); - return ndctl_test_result(test, rc); -} From patchwork Wed Jan 5 21:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B48A1C433EF for ; Wed, 5 Jan 2022 21:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244484AbiAEVdc (ORCPT ); Wed, 5 Jan 2022 16:33:32 -0500 Received: from mga04.intel.com ([192.55.52.120]:55456 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244446AbiAEVcX (ORCPT ); Wed, 5 Jan 2022 16:32:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418343; x=1672954343; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WkNyoqOkNabsNshuJHnilc0Rs1nFAMTQqMLYayXSN9Q=; b=lLmF2MyZ6BMiUZ+AAHAWhwma3vyXcQwJrUq72j1+xsHHfr8sg3y1dI0h Xe1hhKaJ4PsbsvjQbtH42bWNvLi+gFVC1+WNCEi1tckqqMD/KS92a447d MQHH496L9pO4wgUnmKoCgVJ2W0jecu8FI6IPY+6nnQbuH9g1AgcaKZgU3 rNL8OHj0mabSDZq86e9F5+NDWDY+vuVzS66fSNOV5X5JskITLHlmkN+Qn 1Tk/y9opct5o9tSu1iAa9jqgxSXQjvMyX6/3fRoaf3SwbIYNU1Q6551vD TBNYMmpcImVfTjWtyMS+7RDAjonXBYcrresgXsqcOCTRQXClX4ceMeBwC w==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="241358755" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="241358755" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:21 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="574526373" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:21 -0800 Subject: [ndctl PATCH v3 08/16] ndctl/test: Fix support for missing dax_pmem_compat module From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:21 -0800 Message-ID: <164141834155.3990253.5388773351209410262.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The kernel is moving to drop CONFIG_DEV_DAX_PMEM_COMPAT. Update ndctl_test_init() to not error out if dax_pmem_compat is missing. It seems that the original implementation of support for missing dax_pmem_compat was broken, or since that time newer versions of kmod_module_new_from_name() no longer fail when the module is missing. Fixes: b7991dbc22f3 ("ndctl/test: Relax dax_pmem_compat requirement") Signed-off-by: Dan Williams --- test/core.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/test/core.c b/test/core.c index dc1405d75c49..5d1aa23723f1 100644 --- a/test/core.c +++ b/test/core.c @@ -120,7 +120,6 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, "nfit", "device_dax", "dax_pmem", - "dax_pmem_core", "dax_pmem_compat", "libnvdimm", "nd_btt", @@ -180,29 +179,27 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, /* * Skip device-dax bus-model modules on pre-v5.1 */ - if ((strcmp(name, "dax_pmem_core") == 0 - || strcmp(name, "dax_pmem_compat") == 0) - && !ndctl_test_attempt(test, - KERNEL_VERSION(5, 1, 0))) + if ((strcmp(name, "dax_pmem_compat") == 0) && + !ndctl_test_attempt(test, KERNEL_VERSION(5, 1, 0))) continue; retry: rc = kmod_module_new_from_name(*ctx, name, mod); - - /* - * dax_pmem_compat is not required, missing is ok, - * present-but-production is not ok. - */ - if (rc && strcmp(name, "dax_pmem_compat") == 0) - continue; - if (rc) { - log_err(&log_ctx, "%s.ko: missing\n", name); + log_err(&log_ctx, "failed to interrogate %s.ko\n", + name); break; } path = kmod_module_get_path(*mod); if (!path) { + /* + * dax_pmem_compat is not required, missing is + * ok, present-but-production is not ok. + */ + if (strcmp(name, "dax_pmem_compat") == 0) + continue; + if (family != NVDIMM_FAMILY_INTEL && (strcmp(name, "nfit") == 0 || strcmp(name, "nd_e820") == 0)) From patchwork Wed Jan 5 21:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB887C433FE for ; Wed, 5 Jan 2022 21:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244502AbiAEVdn (ORCPT ); Wed, 5 Jan 2022 16:33:43 -0500 Received: from mga09.intel.com ([134.134.136.24]:55028 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244504AbiAEVcd (ORCPT ); Wed, 5 Jan 2022 16:32:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418353; x=1672954353; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8EsYsC8sLdmWL7CZn1enLYmo+tnnY5yU8S9zwfashtY=; b=KJ9w5DOWDr75kXgFbKtZGzLJy9ciWEs4dhCYlbMyw5mkAVEabhPpE30h VtreIBY9anZVJB4eLCNa7jUwGouAb/x29Lwn1Z19bN5D5swEQWDgQjPQv b4aikuQuEQZJ9NjgHGL3IKpWAfML/ZPHqtd+aDCY9h7+6CYimxOa9q0BG Kvs8LbfxcqQEOCmhGWhauz6Xp3FgFK+L/RHQriHkshVnQRXqPOaNEVSnT ytI6S58Bh3KyTUbdHQA+bzXdIrkikmdFXOYGeg8wnZLLme6f9LvF7+jdz AANiM3Ov3otzo2BmfRZgTB18vj1f8+AgedyAeJBJyMfJywNtpkdravC6Z w==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242335880" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242335880" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:32 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="556686657" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:32 -0800 Subject: [ndctl PATCH v3 10/16] Documentation: Drop attrs.adoc include From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:32 -0800 Message-ID: <164141835217.3990253.17678912974035740752.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org In preparation for switching build systems, drop the attrs.adoc include for communicating variables to asciidoc. Simply add the necessary variable values to the invocation of the command using the --attribute argument. Signed-off-by: Dan Williams --- .gitignore | 1 - Documentation/daxctl/Makefile.am | 17 +++++++---------- Documentation/daxctl/daxctl-reconfigure-device.txt | 2 -- Documentation/ndctl/Makefile.am | 17 +++++++---------- Documentation/ndctl/intel-nvdimm-security.txt | 2 -- Documentation/ndctl/ndctl-load-keys.txt | 2 -- Documentation/ndctl/ndctl-monitor.txt | 2 -- Documentation/ndctl/ndctl-sanitize-dimm.txt | 2 -- Documentation/ndctl/ndctl-setup-passphrase.txt | 2 -- Documentation/ndctl/ndctl-update-passphrase.txt | 2 -- 10 files changed, 14 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 6b19d90a12f1..4ab393e71a89 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,6 @@ Documentation/daxctl/asciidoctor-extensions.rb Documentation/ndctl/asciidoctor-extensions.rb Documentation/cxl/asciidoctor-extensions.rb Documentation/cxl/lib/asciidoctor-extensions.rb -Documentation/ndctl/attrs.adoc .dirstamp daxctl/config.h daxctl/daxctl diff --git a/Documentation/daxctl/Makefile.am b/Documentation/daxctl/Makefile.am index 9c43e6176b28..78c47f5055c4 100644 --- a/Documentation/daxctl/Makefile.am +++ b/Documentation/daxctl/Makefile.am @@ -33,20 +33,11 @@ EXTRA_DIST = $(man1_MANS) CLEANFILES = $(man1_MANS) -.ONESHELL: -attrs.adoc: $(srcdir)/Makefile.am - $(AM_V_GEN) cat <<- EOF >$@ - :daxctl_confdir: $(daxctl_confdir) - :daxctl_conf: $(daxctl_conf) - :ndctl_keysdir: $(ndctl_keysdir) - EOF - XML_DEPS = \ ../../version.m4 \ ../copyright.txt \ Makefile \ - $(CONFFILE) \ - attrs.adoc + $(CONFFILE) RM ?= rm -f @@ -57,6 +48,9 @@ if USE_ASCIIDOCTOR $(ASCIIDOC) -b manpage -d manpage -acompat-mode \ -I. -rasciidoctor-extensions \ -amansource=daxctl -amanmanual="daxctl Manual" \ + -adaxctl_confdir=$(daxctl_confdir) \ + -adaxctl_conf=$(daxctl_conf) \ + -andctl_keysdir=$(ndctl_keysdir) \ -andctl_version=$(VERSION) -o $@+ $< && \ mv $@+ $@ @@ -65,6 +59,9 @@ else %.xml: %.txt $(XML_DEPS) $(AM_V_GEN)$(RM) $@+ $@ && \ $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ + -adaxctl_confdir=$(daxctl_confdir) \ + -adaxctl_conf=$(daxctl_conf) \ + -andctl_keysdir=$(ndctl_keysdir) \ --unsafe -adaxctl_version=$(VERSION) -o $@+ $< && \ mv $@+ $@ diff --git a/Documentation/daxctl/daxctl-reconfigure-device.txt b/Documentation/daxctl/daxctl-reconfigure-device.txt index b2184ec862bb..385c0c53931d 100644 --- a/Documentation/daxctl/daxctl-reconfigure-device.txt +++ b/Documentation/daxctl/daxctl-reconfigure-device.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - daxctl-reconfigure-device(1) ============================ diff --git a/Documentation/ndctl/Makefile.am b/Documentation/ndctl/Makefile.am index 37855cc0585d..203158c1dfaf 100644 --- a/Documentation/ndctl/Makefile.am +++ b/Documentation/ndctl/Makefile.am @@ -56,14 +56,6 @@ EXTRA_DIST = $(man1_MANS) CLEANFILES = $(man1_MANS) -.ONESHELL: -attrs.adoc: $(srcdir)/Makefile.am - $(AM_V_GEN) cat <<- EOF >$@ - :ndctl_confdir: $(ndctl_confdir) - :ndctl_monitorconf: $(ndctl_monitorconf) - :ndctl_keysdir: $(ndctl_keysdir) - EOF - XML_DEPS = \ ../../version.m4 \ Makefile \ @@ -76,8 +68,7 @@ XML_DEPS = \ xable-namespace-options.txt \ ars-description.txt \ labels-description.txt \ - labels-options.txt \ - attrs.adoc + labels-options.txt RM ?= rm -f @@ -88,6 +79,9 @@ if USE_ASCIIDOCTOR $(ASCIIDOC) -b manpage -d manpage -acompat-mode \ -I. -rasciidoctor-extensions \ -amansource=ndctl -amanmanual="ndctl Manual" \ + -andctl_confdir=$(ndctl_confdir) \ + -andctl_monitorconf=$(ndctl_monitorconf) \ + -andctl_keysdir=$(ndctl_keysdir) \ -andctl_version=$(VERSION) -o $@+ $< && \ mv $@+ $@ @@ -96,6 +90,9 @@ else %.xml: %.txt $(XML_DEPS) $(AM_V_GEN)$(RM) $@+ $@ && \ $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ + -andctl_confdir=$(ndctl_confdir) \ + -andctl_monitorconf=$(ndctl_monitorconf) \ + -andctl_keysdir=$(ndctl_keysdir) \ --unsafe -andctl_version=$(VERSION) -o $@+ $< && \ mv $@+ $@ diff --git a/Documentation/ndctl/intel-nvdimm-security.txt b/Documentation/ndctl/intel-nvdimm-security.txt index 142b4603db69..88b305b81978 100644 --- a/Documentation/ndctl/intel-nvdimm-security.txt +++ b/Documentation/ndctl/intel-nvdimm-security.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - THEORY OF OPERATION ------------------- The Intel Device Specific Methods (DSM) specification v1.7 and v1.8 [1] diff --git a/Documentation/ndctl/ndctl-load-keys.txt b/Documentation/ndctl/ndctl-load-keys.txt index a064f97fd069..70db57441820 100644 --- a/Documentation/ndctl/ndctl-load-keys.txt +++ b/Documentation/ndctl/ndctl-load-keys.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - ndctl-load-keys(1) ================== diff --git a/Documentation/ndctl/ndctl-monitor.txt b/Documentation/ndctl/ndctl-monitor.txt index 8c8c35b41ace..eca079d56a32 100644 --- a/Documentation/ndctl/ndctl-monitor.txt +++ b/Documentation/ndctl/ndctl-monitor.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - ndctl-monitor(1) ================ diff --git a/Documentation/ndctl/ndctl-sanitize-dimm.txt b/Documentation/ndctl/ndctl-sanitize-dimm.txt index b2e5fde9ecb3..e04467856ca4 100644 --- a/Documentation/ndctl/ndctl-sanitize-dimm.txt +++ b/Documentation/ndctl/ndctl-sanitize-dimm.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - ndctl-sanitize-dimm(1) ====================== diff --git a/Documentation/ndctl/ndctl-setup-passphrase.txt b/Documentation/ndctl/ndctl-setup-passphrase.txt index 1219279b4c66..96f709b468fc 100644 --- a/Documentation/ndctl/ndctl-setup-passphrase.txt +++ b/Documentation/ndctl/ndctl-setup-passphrase.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - ndctl-setup-passphrase(1) ========================= diff --git a/Documentation/ndctl/ndctl-update-passphrase.txt b/Documentation/ndctl/ndctl-update-passphrase.txt index c7c1bfc8ab0b..591ce44ebc3e 100644 --- a/Documentation/ndctl/ndctl-update-passphrase.txt +++ b/Documentation/ndctl/ndctl-update-passphrase.txt @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -include::attrs.adoc[] - ndctl-update-passphrase(1) ========================== From patchwork Wed Jan 5 21:32:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F3DEC433F5 for ; Wed, 5 Jan 2022 21:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244516AbiAEVfB (ORCPT ); Wed, 5 Jan 2022 16:35:01 -0500 Received: from mga03.intel.com ([134.134.136.65]:45285 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244528AbiAEVeV (ORCPT ); Wed, 5 Jan 2022 16:34:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418461; x=1672954461; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Iz6AwOBqRhVIF+2BPFBwyfgVIPz0neV1GHLBEx3UFBs=; b=W5iqtmhGv8+usR8xO9YhTJmTzzZjE3J4SZ1qiTNhe4qzXqiwx+RlJ8R7 t2EQRkZ4w4zMbxGcxC5LGHFhoJ+KCDJ1eN42R7U1p3b44AbFdfu0EzbOW U+FU3il59tR23k3qMgQ3PF+1hWZ/4P3uMYMXuIfh5nKRxVfhJ9AQ5l0nT TKP8Ivoh2n54wZv1wwVmXniD0Vhvkkt4R+y9kkR0HrbtfIVpDL5Kj51Ux X8ANy2SyDEEwpa+g6htO4aqb+wkQS7BiKfzPjThOmWdi6qtQgm+tHHC4s Oe5dzZ7OYf+ufHIFOoqGV5uev1L23QGXrNeW4480I9SPLvnrxxA8KJFd5 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242496030" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242496030" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:37 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="470718904" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:37 -0800 Subject: [ndctl PATCH v3 11/16] build: Drop unnecessary $tool/config.h includes From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:37 -0800 Message-ID: <164141835727.3990253.12971738434561351928.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org In preparation for support for meson as the build infrastructure remove some explicit config.h includes that will be replaced by a unified config.h at the top of the project. Signed-off-by: Dan Williams --- daxctl/migrate.c | 1 - ndctl/keys.c | 1 - ndctl/monitor.c | 1 - 3 files changed, 3 deletions(-) diff --git a/daxctl/migrate.c b/daxctl/migrate.c index 5fbe970fdaff..c51106625849 100644 --- a/daxctl/migrate.c +++ b/daxctl/migrate.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/ndctl/keys.c b/ndctl/keys.c index 876b34714b7e..2f33b8fb488c 100644 --- a/ndctl/keys.c +++ b/ndctl/keys.c @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/ndctl/monitor.c b/ndctl/monitor.c index 8b600a4e762b..ae694c614593 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include From patchwork Wed Jan 5 21:32:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9ED8C433EF for ; Wed, 5 Jan 2022 21:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244504AbiAEVds (ORCPT ); Wed, 5 Jan 2022 16:33:48 -0500 Received: from mga09.intel.com ([134.134.136.24]:55050 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244544AbiAEVcn (ORCPT ); Wed, 5 Jan 2022 16:32:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418363; x=1672954363; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vQxxEbqbl1RTUOVMG1TzrStopuZ3lUbgSkJhlz6poFs=; b=c61upTmfP77hw94xnjtB97v62EDYfpGb9ksqmvWpPHg3H8VDwnlzr/Mp 20O7KPBXRs26NKBCBK700YtqCJM6n7/4sZPVs/1q70nOzzSJB2rkSrOMx X4jxdFf80RGKbyOmlEuuMkI2+5KBh9cjNJ+XgrSsVfBkpqbQ8uSL1AWf0 WbtFBklw5MQnz2mpHOYJjEi8R/wu2Wyr+dcWtoNvVIgVtpxunou7IwB6l gC98SReTsl2yq0CU5zmBvFHXVsYpi/WCal0FJDDuBFZhe0kfEbq0gXNTh 3J92mwIViRyrkyasx9Bv/P2inYpDB+xMKOxWLoUhzPjvmIavOy3gLoI/d Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242335912" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242335912" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:42 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="574526557" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:42 -0800 Subject: [ndctl PATCH v3 12/16] test: Prepare out of line builds From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:42 -0800 Message-ID: <164141836235.3990253.5237538466465550643.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org In preparation for converting to meson prepare the unit tests to run out of a build directory rather than out of the source directory. Introduce TEST_PATH for the location of the test executables. Signed-off-by: Dan Williams --- test/btt-errors.sh | 4 +--- test/common | 37 +++++++++++++++++++++---------------- test/dax-pmd.c | 11 +++++++++-- test/dax.sh | 6 +++--- test/daxdev-errors.sh | 4 ++-- test/device-dax-fio.sh | 2 +- test/dm.sh | 4 ++-- test/inject-smart.sh | 2 +- test/mmap.sh | 6 +++--- test/monitor.sh | 6 +++--- test/pmem-errors.sh | 8 +++----- test/sub-section.sh | 4 ++-- test/track-uuid.sh | 2 +- 13 files changed, 52 insertions(+), 44 deletions(-) diff --git a/test/btt-errors.sh b/test/btt-errors.sh index 6e69178cc3cf..18518d503e9c 100755 --- a/test/btt-errors.sh +++ b/test/btt-errors.sh @@ -11,14 +11,12 @@ rc=77 cleanup() { - rm -f $FILE - rm -f $MNT/$FILE if grep -q "$MNT" /proc/mounts; then umount $MNT else rc=77 fi - rmdir $MNT + rm -rf $MNT } force_raw() diff --git a/test/common b/test/common index b6d47128f209..fb487958a29b 100644 --- a/test/common +++ b/test/common @@ -4,27 +4,32 @@ # Global variables # NDCTL -# -if [ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ]; then - export NDCTL=../ndctl/ndctl -elif [ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ]; then - export NDCTL=./ndctl/ndctl -else - echo "Couldn't find an ndctl binary" - exit 1 +if [ -z $NDCTL ]; then + if [ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ]; then + export NDCTL=../ndctl/ndctl + elif [ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ]; then + export NDCTL=./ndctl/ndctl + else + echo "Couldn't find an ndctl binary" + exit 1 + fi fi # DAXCTL -# -if [ -f "../daxctl/daxctl" ] && [ -x "../daxctl/daxctl" ]; then - export DAXCTL=../daxctl/daxctl -elif [ -f "./daxctl/daxctl" ] && [ -x "./daxctl/daxctl" ]; then - export DAXCTL=./daxctl/daxctl -else - echo "Couldn't find an daxctl binary" - exit 1 +if [ -z $DAXCTL ]; then + if [ -f "../daxctl/daxctl" ] && [ -x "../daxctl/daxctl" ]; then + export DAXCTL=../daxctl/daxctl + elif [ -f "./daxctl/daxctl" ] && [ -x "./daxctl/daxctl" ]; then + export DAXCTL=./daxctl/daxctl + else + echo "Couldn't find an daxctl binary" + exit 1 + fi fi +if [ -z $TEST_PATH ]; then + export TEST_PATH=. +fi # NFIT_TEST_BUS[01] # diff --git a/test/dax-pmd.c b/test/dax-pmd.c index 7648e348b0a6..f8408759d51e 100644 --- a/test/dax-pmd.c +++ b/test/dax-pmd.c @@ -24,7 +24,8 @@ __func__, __LINE__, strerror(errno)) #define faili(i) fprintf(stderr, "%s: failed at: %d: %d (%s)\n", \ __func__, __LINE__, i, strerror(errno)) -#define TEST_FILE "test_dax_data" +#define TEST_DIR "test_dax_mnt" +#define TEST_FILE TEST_DIR "/test_dax_data" #define REGION_MEM_SIZE 4096*4 #define REGION_PM_SIZE 4096*512 @@ -171,8 +172,14 @@ int test_dax_directio(int dax_fd, unsigned long align, void *dax_addr, off_t off } rc = -ENXIO; + rc = mkdir(TEST_DIR, 0600); + if (rc < 0 && errno != EEXIST) { + faili(i); + munmap(addr, 2 * align); + break; + } fd2 = open(TEST_FILE, O_CREAT|O_TRUNC|O_DIRECT|O_RDWR, - DEFFILEMODE); + 0600); if (fd2 < 0) { faili(i); munmap(addr, 2*align); diff --git a/test/dax.sh b/test/dax.sh index bcdd4e9bda27..bb9848b10ecc 100755 --- a/test/dax.sh +++ b/test/dax.sh @@ -15,13 +15,13 @@ cleanup() { else rc=77 fi - rmdir $MNT + rm -rf $MNT exit $rc } run_test() { rc=0 - if ! trace-cmd record -e fs_dax:dax_pmd_fault_done ./dax-pmd $MNT/$FILE; then + if ! trace-cmd record -e fs_dax:dax_pmd_fault_done $TEST_PATH/dax-pmd $MNT/$FILE; then rc=$? if [ "$rc" -ne 77 ] && [ "$rc" -ne 0 ]; then cleanup "$1" @@ -104,7 +104,7 @@ set -e mkdir -p $MNT trap 'err $LINENO cleanup' ERR -dev=$(./dax-dev) +dev=$($TEST_PATH/dax-dev) json=$($NDCTL list -N -n $dev) eval $(json2var <<< "$json") rc=1 diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh index e13453dfaa73..7f79718113d0 100755 --- a/test/daxdev-errors.sh +++ b/test/daxdev-errors.sh @@ -62,8 +62,8 @@ read sector len < /sys/bus/nd/devices/$region/badblocks echo "sector: $sector len: $len" # run the daxdev-errors test -test -x ./daxdev-errors -./daxdev-errors $busdev $region +test -x $TEST_PATH/daxdev-errors +$TEST_PATH/daxdev-errors $busdev $region # check badblocks, should be empty if read sector len < /sys/bus/platform/devices/nfit_test.0/$busdev/$region/badblocks; then diff --git a/test/device-dax-fio.sh b/test/device-dax-fio.sh index f57a9d266afc..c43ac058d2b0 100755 --- a/test/device-dax-fio.sh +++ b/test/device-dax-fio.sh @@ -18,7 +18,7 @@ if ! fio --enghelp | grep -q "dev-dax"; then exit 77 fi -dev=$(./dax-dev) +dev=$($TEST_PATH/dax-dev) for align in 4k 2m 1g do json=$($NDCTL create-namespace -m devdax -a $align -f -e $dev) diff --git a/test/dm.sh b/test/dm.sh index 4656e5bfbebe..b780a65c27d2 100755 --- a/test/dm.sh +++ b/test/dm.sh @@ -8,7 +8,7 @@ SKIP=77 FAIL=1 SUCCESS=0 -. ./common +. $(dirname $0)/common MNT=test_dax_mnt TEST_DM_PMEM=/dev/mapper/test_pmem @@ -30,7 +30,7 @@ cleanup() { if [ -L $TEST_DM_PMEM ]; then dmsetup remove $TEST_DM_PMEM fi - rmdir $MNT + rm -rf $MNT # opportunistic cleanup, not fatal if these fail namespaces=$($NDCTL list -N | jq -r ".[] | select(.name==\"$NAME\") | .dev") for i in $namespaces diff --git a/test/inject-smart.sh b/test/inject-smart.sh index 4ca83b8b2263..8b913601bdd2 100755 --- a/test/inject-smart.sh +++ b/test/inject-smart.sh @@ -170,7 +170,7 @@ check_prereq "jq" modprobe nfit_test rc=1 -jlist=$(./list-smart-dimm -b $bus) +jlist=$($TEST_PATH/list-smart-dimm -b $bus) dimm="$(jq '.[]."dev"?, ."dev"?' <<< $jlist | sort | head -1 | xargs)" test -n "$dimm" diff --git a/test/mmap.sh b/test/mmap.sh index 50a1d34d0b75..760257dc7f93 100755 --- a/test/mmap.sh +++ b/test/mmap.sh @@ -7,7 +7,7 @@ MNT=test_mmap_mnt FILE=image DEV="" -TEST=./mmap +TEST=$TEST_PATH/mmap rc=77 cleanup() { @@ -17,7 +17,7 @@ cleanup() { else rc=77 fi - rmdir $MNT + rm -rf $MNT exit $rc } @@ -49,7 +49,7 @@ set -e mkdir -p $MNT trap 'err $LINENO cleanup' ERR -dev=$(./dax-dev) +dev=$($TEST_PATH/dax-dev) json=$($NDCTL list -N -n $dev) eval $(json2var <<< "$json") DEV="/dev/${blockdev}" diff --git a/test/monitor.sh b/test/monitor.sh index 14450a7b23e3..ef04607d8eb0 100755 --- a/test/monitor.sh +++ b/test/monitor.sh @@ -31,7 +31,7 @@ start_monitor() set_smart_supported_bus() { smart_supported_bus=$NFIT_TEST_BUS0 - monitor_dimms=$(./list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev) + monitor_dimms=$($TEST_PATH/list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev) if [ -z $monitor_dimms ]; then smart_supported_bus=$NFIT_TEST_BUS1 fi @@ -39,14 +39,14 @@ set_smart_supported_bus() get_monitor_dimm() { - jlist=$(./list-smart-dimm -b $smart_supported_bus $1) + jlist=$($TEST_PATH/list-smart-dimm -b $smart_supported_bus $1) monitor_dimms=$(jq '.[]."dev"?, ."dev"?' <<<$jlist | sort | uniq | xargs) echo $monitor_dimms } call_notify() { - ./smart-notify $smart_supported_bus + $TEST_PATH/smart-notify $smart_supported_bus sync; sleep 3 } diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh index 20657801fc0e..9a59c25d4a79 100755 --- a/test/pmem-errors.sh +++ b/test/pmem-errors.sh @@ -10,14 +10,12 @@ rc=77 cleanup() { - rm -f $FILE - rm -f $MNT/$FILE if [ -n "$blockdev" ]; then umount /dev/$blockdev else rc=77 fi - rmdir $MNT + rm -rf $MNT } check_min_kver "4.7" || do_skip "may lack dax error handling" @@ -82,8 +80,8 @@ echo $start_sect 8 > /sys/block/$blockdev/badblocks dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true # run the dax-errors test -test -x ./dax-errors -./dax-errors $MNT/$FILE +test -x $TEST_PATH/dax-errors +$TEST_PATH/dax-errors $MNT/$FILE # TODO: disable this check till we have clear-on-write in the kernel #if read sector len < /sys/block/$blockdev/badblocks; then diff --git a/test/sub-section.sh b/test/sub-section.sh index 92ae816c448c..77b963355c8f 100755 --- a/test/sub-section.sh +++ b/test/sub-section.sh @@ -8,7 +8,7 @@ SKIP=77 FAIL=1 SUCCESS=0 -. ./common +. $(dirname $0)/common check_min_kver "5.3" || do_skip "may lack align sub-section hotplug support" @@ -30,7 +30,7 @@ cleanup() { if mountpoint -q $MNT; then umount $MNT fi - rmdir $MNT + rm -rf $MNT # opportunistic cleanup, not fatal if these fail namespaces=$($NDCTL list -N | jq -r ".[] | select(.name==\"$NAME\") | .dev") for i in $namespaces diff --git a/test/track-uuid.sh b/test/track-uuid.sh index 3bacd2c24787..a967d0e4691c 100755 --- a/test/track-uuid.sh +++ b/test/track-uuid.sh @@ -5,7 +5,7 @@ blockdev="" rc=77 -. ./common +. $(dirname $0)/common set -e trap 'err $LINENO' ERR From patchwork Wed Jan 5 21:32:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 642B2C433F5 for ; Wed, 5 Jan 2022 21:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244528AbiAEVf3 (ORCPT ); Wed, 5 Jan 2022 16:35:29 -0500 Received: from mga18.intel.com ([134.134.136.126]:16459 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244519AbiAEVfF (ORCPT ); Wed, 5 Jan 2022 16:35:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418504; x=1672954504; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nCAaItum+5HppG++YWpzN72ImzToj0lcy7j7tv0h9UU=; b=XhEekTivjbngi6K3q/tcPVK9+Ai3IaUv6IBg2eQy6zA6Xxmii3xCG46t j2nD/CgqK9KKiVLwg0rOri99ddYmCnN6ADjbNfL9sIgk/pM1VIwFeTFKp xH9oWMcWBWiAPgkycDFn55alJfphTGGHv3p2MJqSwpR6jFUl5cJMygtic p7GOzZ2heULcqjE2G+CO798lnQCsj6qAexpL93vKWHLgELNkKPRq4+bnz CnHf4QJ9IM1DOx1xwHtj+bxV38xa2gSw15YIcS/PDsJAIYWT5zgpip5jf hslXC3A9E0GIM///oPwGe0Uh7dnxY2zeJgL2YQNzlMTC592le4baYFD2j Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="229354124" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="229354124" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:48 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="668240795" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:48 -0800 Subject: [ndctl PATCH v3 13/16] ndctl: Drop executable bit for bash-completion script From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:47 -0800 Message-ID: <164141836772.3990253.4996882214531720931.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The rpm build process warns: *** WARNING: ./usr/share/bash-completion/completions/ndctl is executable but has no shebang, removing executable bit Clear the unnecessary executable bit since completion helpers are sourced, not executed. Signed-off-by: Dan Williams --- contrib/ndctl | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 contrib/ndctl diff --git a/contrib/ndctl b/contrib/ndctl old mode 100755 new mode 100644 From patchwork Wed Jan 5 21:32:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13B4DC433EF for ; Wed, 5 Jan 2022 21:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244500AbiAEVfC (ORCPT ); Wed, 5 Jan 2022 16:35:02 -0500 Received: from mga03.intel.com ([134.134.136.65]:45199 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244531AbiAEVeZ (ORCPT ); Wed, 5 Jan 2022 16:34:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418465; x=1672954465; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FvoaSKNWDqMhu7Cml7B14JkUPfLXFZeV1FOyv7XtWtI=; b=LJi4xGLtGQa+THM030whoLgzxaBJhh/QkJ9ltZgd10lQ6N3ieEv1QkWx UT6cQ99jhsy9ANlZA/y62QjmzFGxB13JJyoLFdo8B8671waMeaJnOizbi PRBWYtakn086Df0Gp5PhArUw2kzD1wl2S+EqL1OhZYF8tah3f9RZzC5q0 o04kqkCY6eSX4gdXXMEnGgBHmRkbhoAZIgEI7WB3bBJgDLHlwoGuIAKOI 9lTIC1bp0HKpOP/TR1lJ0bhkv+LaeSA7ZA1roZpzEewmDmUB1dwPM+XKD C2ZK5yK4t9bzBZLqjx5gm+g6MsOH07fkTaV7I1Izh5OPD879WfCij1MqA g==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242496064" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242496064" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:53 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="513148340" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:53 -0800 Subject: [ndctl PATCH v3 14/16] build: Add meson build infrastructure From: Dan Williams To: vishal.l.verma@intel.com Cc: Vaibhav Jain , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:53 -0800 Message-ID: <164141837329.3990253.11664056350173402543.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Build times improve from 10s of seconds to sub-second builds especially when ccache gets involved and the only change is a git version bump. Recall that every time the version changes with autotools it does a reconfigure. With meson only the objects that depend on the version string are rebuilt. So the primary motivation is to make the ndctl project more enjoyable to develop. Tools, libraries, documentation, and tests all seem to be working. The remaining work is to redo the rpm build infrastructure, and validate that installation is working as expected. Given the long standing momentum on the old build system it is still kept functional for now. The only compatibility hack when moving from an autotools build to a meson build is to delete the config.h files generated by the old system in favor of the unified configuration header build from the config.h.meson template. Tested-by: Vaibhav Jain Signed-off-by: Dan Williams --- .gitignore | 5 + Documentation/cxl/lib/meson.build | 79 ++++++++++ Documentation/cxl/meson.build | 84 +++++++++++ Documentation/daxctl/meson.build | 94 ++++++++++++ Documentation/ndctl/meson.build | 124 ++++++++++++++++ clean_config.sh | 2 config.h.meson | 151 ++++++++++++++++++++ contrib/meson.build | 28 ++++ cxl/lib/meson.build | 35 +++++ cxl/meson.build | 25 +++ daxctl/device.c | 1 daxctl/lib/meson.build | 44 ++++++ daxctl/meson.build | 35 +++++ meson.build | 280 +++++++++++++++++++++++++++++++++++++ meson_options.txt | 25 +++ ndctl/lib/meson.build | 48 ++++++ ndctl/meson.build | 82 +++++++++++ test/meson.build | 237 +++++++++++++++++++++++++++++++ tools/meson-vcs-tag.sh | 18 ++ util/meson.build | 16 ++ version.h.in | 2 21 files changed, 1414 insertions(+), 1 deletion(-) create mode 100644 Documentation/cxl/lib/meson.build create mode 100644 Documentation/cxl/meson.build create mode 100644 Documentation/daxctl/meson.build create mode 100644 Documentation/ndctl/meson.build create mode 100755 clean_config.sh create mode 100644 config.h.meson create mode 100644 contrib/meson.build create mode 100644 cxl/lib/meson.build create mode 100644 cxl/meson.build create mode 100644 daxctl/lib/meson.build create mode 100644 daxctl/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 ndctl/lib/meson.build create mode 100644 ndctl/meson.build create mode 100644 test/meson.build create mode 100755 tools/meson-vcs-tag.sh create mode 100644 util/meson.build create mode 100644 version.h.in diff --git a/.gitignore b/.gitignore index 4ab393e71a89..91c5e37b7fef 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,9 @@ Makefile.in /aclocal.m4 /autom4te.cache /build-aux -/config.* +/config.h +/config.log +/config.status /configure /libtool /stamp-h1 @@ -24,6 +26,7 @@ Documentation/ndctl/asciidoctor-extensions.rb Documentation/cxl/asciidoctor-extensions.rb Documentation/cxl/lib/asciidoctor-extensions.rb .dirstamp +build/ daxctl/config.h daxctl/daxctl daxctl/lib/libdaxctl.la diff --git a/Documentation/cxl/lib/meson.build b/Documentation/cxl/lib/meson.build new file mode 100644 index 000000000000..4b3f59685447 --- /dev/null +++ b/Documentation/cxl/lib/meson.build @@ -0,0 +1,79 @@ +if get_option('asciidoctor').enabled() + asciidoc_conf = custom_target('asciidoctor-extensions.rb', + command : [ + 'sed', '-e', 's,@Utility@,Libcxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@' + ], + input : '../../asciidoctor-extensions.rb.in', + output : 'asciidoctor-extensions.rb', + capture : true, + ) +else + asciidoc_conf = custom_target('asciidoc.conf', + command : [ + 'sed', '-e', 's,UTILITY,libcxl,g', + ], + input : '../../asciidoc.conf.in', + output : 'asciidoc.conf', + capture : true, + ) +endif + +filedeps = [ + '../../copyright.txt', +] + +libcxl_manpages = [ + 'libcxl.txt', + 'cxl_new.txt', +] + +foreach man : libcxl_manpages + name = man.split('.')[0] + output = name + '.3' + output_xml = name + '.xml' + if get_option('asciidoctor').enabled() + custom_target(name, + command : [ + asciidoc, + '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@', + '-rasciidoctor-extensions', '-amansource=libcxl', + '-amanmanual=libcxl Manual', + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@' + ], + input : man, + output : output, + depend_files : filedeps, + depends : asciidoc_conf, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man3'), + ) + else + xml = custom_target(output_xml, + command : [ + asciidoc, + '-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe', + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@', + ], + input : man, + output : output_xml, + depend_files : filedeps, + depends : asciidoc_conf, + ) + + xsl = files('../../manpage-normal.xsl') + + custom_target(name, + command : [ + xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@' + ], + depends : xml, + depend_files : xsl, + input : xml, + output : output, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man3'), + ) + endif +endforeach diff --git a/Documentation/cxl/meson.build b/Documentation/cxl/meson.build new file mode 100644 index 000000000000..64ce13f59012 --- /dev/null +++ b/Documentation/cxl/meson.build @@ -0,0 +1,84 @@ +if get_option('asciidoctor').enabled() + asciidoc_conf = custom_target('asciidoctor-extensions.rb', + command : [ + 'sed', '-e', 's,@Utility@,Cxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@' + ], + input : '../asciidoctor-extensions.rb.in', + output : 'asciidoctor-extensions.rb', + capture : true, + ) +else + asciidoc_conf = custom_target('asciidoc.conf', + command : [ + 'sed', '-e', 's,UTILITY,cxl,g', + ], + input : '../asciidoc.conf.in', + output : 'asciidoc.conf', + capture : true, + ) +endif + +filedeps = [ + '../copyright.txt', +] + +cxl_manpages = [ + 'cxl.txt', + 'cxl-list.txt', + 'cxl-read-labels.txt', + 'cxl-write-labels.txt', + 'cxl-zero-labels.txt', +] + +foreach man : cxl_manpages + name = man.split('.')[0] + output = name + '.1' + output_xml = name + '.xml' + if get_option('asciidoctor').enabled() + custom_target(name, + command : [ + asciidoc, + '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@', + '-rasciidoctor-extensions', '-amansource=cxl', + '-amanmanual=cxl Manual', + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@' + ], + input : man, + output : output, + depend_files : filedeps, + depends : asciidoc_conf, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man1'), + ) + else + xml = custom_target(output_xml, + command : [ + asciidoc, + '-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe', + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@', + ], + input : man, + output : output_xml, + depend_files : filedeps, + depends : asciidoc_conf, + ) + + xsl = files('../manpage-normal.xsl') + + custom_target(name, + command : [ + xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@' + ], + depends : xml, + depend_files : xsl, + input : xml, + output : output, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man1'), + ) + endif +endforeach + +subdir('lib') diff --git a/Documentation/daxctl/meson.build b/Documentation/daxctl/meson.build new file mode 100644 index 000000000000..7699e69c29be --- /dev/null +++ b/Documentation/daxctl/meson.build @@ -0,0 +1,94 @@ +if get_option('asciidoctor').enabled() + asciidoc_conf = custom_target('asciidoctor-extensions.rb', + command : [ + 'sed', '-e', 's,@Utility@,Daxctl,g', '-e', 's,@utility@,daxctl,g', '@INPUT@' + ], + input : '../asciidoctor-extensions.rb.in', + output : 'asciidoctor-extensions.rb', + capture : true, + ) +else + asciidoc_conf = custom_target('asciidoc.conf', + command : [ + 'sed', '-e', 's,UTILITY,daxctl,g', + ], + input : '../asciidoc.conf.in', + output : 'asciidoc.conf', + capture : true, + ) +endif + +filedeps = [ + 'human-option.txt', + '../copyright.txt', +] + +daxctl_manpages = [ + 'daxctl.txt', + 'daxctl-list.txt', + 'daxctl-migrate-device-model.txt', + 'daxctl-reconfigure-device.txt', + 'daxctl-online-memory.txt', + 'daxctl-offline-memory.txt', + 'daxctl-disable-device.txt', + 'daxctl-enable-device.txt', + 'daxctl-create-device.txt', + 'daxctl-destroy-device.txt', +] + +foreach man : daxctl_manpages + name = man.split('.')[0] + output = name + '.1' + output_xml = name + '.xml' + if get_option('asciidoctor').enabled() + custom_target(name, + command : [ + asciidoc, + '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@', + '-rasciidoctor-extensions', '-amansource=daxctl', + '-amanmanual=daxctl Manual', + '-adaxctl_confdir=@0@'.format(daxctlconf_dir), + '-adaxctl_conf=@0@'.format(daxctlconf), + '-andctl_keysdir=@0@'.format(ndctlkeys_dir), + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@' + ], + input : man, + output : output, + depend_files : filedeps, + depends : asciidoc_conf, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man1'), + ) + else + xml = custom_target(output_xml, + command : [ + asciidoc, + '-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe', + '-adaxctl_confdir=@0@'.format(daxctlconf_dir), + '-adaxctl_conf=@0@'.format(daxctlconf), + '-andctl_keysdir=@0@'.format(ndctlkeys_dir), + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@', + ], + input : man, + output : output_xml, + depend_files : filedeps, + depends : asciidoc_conf, + ) + + xsl = files('../manpage-normal.xsl') + + custom_target(name, + command : [ + xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@' + ], + depends : xml, + depend_files : xsl, + input : xml, + output : output, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man1'), + ) + endif +endforeach diff --git a/Documentation/ndctl/meson.build b/Documentation/ndctl/meson.build new file mode 100644 index 000000000000..b82635a4cc4b --- /dev/null +++ b/Documentation/ndctl/meson.build @@ -0,0 +1,124 @@ +if get_option('asciidoctor').enabled() + asciidoc_conf = custom_target('asciidoctor-extensions.rb', + command : [ + 'sed', '-e', 's,@Utility@,Ndctl,g', '-e', 's,@utility@,ndctl,g', '@INPUT@' + ], + input : '../asciidoctor-extensions.rb.in', + output : 'asciidoctor-extensions.rb', + capture : true, + ) +else + asciidoc_conf = custom_target('asciidoc.conf', + command : [ + 'sed', '-e', 's,UTILITY,ndctl,g', + ], + input : '../asciidoc.conf.in', + output : 'asciidoc.conf', + capture : true, + ) +endif + +filedeps = [ + '../copyright.txt', + 'region-description.txt', + 'xable-region-options.txt', + 'dimm-description.txt', + 'xable-dimm-options.txt', + 'xable-namespace-options.txt', + 'ars-description.txt', + 'labels-description.txt', + 'labels-options.txt', +] + +ndctl_manpages = [ + 'ndctl.txt', + 'ndctl-wait-scrub.txt', + 'ndctl-start-scrub.txt', + 'ndctl-zero-labels.txt', + 'ndctl-read-labels.txt', + 'ndctl-write-labels.txt', + 'ndctl-init-labels.txt', + 'ndctl-check-labels.txt', + 'ndctl-enable-region.txt', + 'ndctl-disable-region.txt', + 'ndctl-enable-dimm.txt', + 'ndctl-disable-dimm.txt', + 'ndctl-enable-namespace.txt', + 'ndctl-disable-namespace.txt', + 'ndctl-create-namespace.txt', + 'ndctl-destroy-namespace.txt', + 'ndctl-check-namespace.txt', + 'ndctl-clear-errors.txt', + 'ndctl-inject-error.txt', + 'ndctl-inject-smart.txt', + 'ndctl-update-firmware.txt', + 'ndctl-list.txt', + 'ndctl-monitor.txt', + 'ndctl-setup-passphrase.txt', + 'ndctl-update-passphrase.txt', + 'ndctl-remove-passphrase.txt', + 'ndctl-freeze-security.txt', + 'ndctl-sanitize-dimm.txt', + 'ndctl-load-keys.txt', + 'ndctl-wait-overwrite.txt', + 'ndctl-read-infoblock.txt', + 'ndctl-write-infoblock.txt', + 'ndctl-activate-firmware.txt', +] + +foreach man : ndctl_manpages + name = man.split('.')[0] + output = name + '.1' + output_xml = name + '.xml' + if get_option('asciidoctor').enabled() + custom_target(name, + command : [ + asciidoc, + '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@', + '-rasciidoctor-extensions', '-amansource=ndctl', + '-amanmanual=ndctl Manual', + '-andctl_confdir=@0@'.format(ndctlconf_dir), + '-andctl_monitorconf=@0@'.format(ndctlconf), + '-andctl_keysdir=@0@'.format(ndctlkeys_dir), + '-andctl_version=@0@'.format(meson.project_version()), + '-o', '@OUTPUT@', '@INPUT@' + ], + input : man, + output : output, + depend_files : filedeps, + depends : asciidoc_conf, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man1'), + ) + else + xml = custom_target(output_xml, + command : [ + asciidoc, + '-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe', + '-andctl_version=@0@'.format(meson.project_version()), + '-andctl_confdir=@0@'.format(ndctlconf_dir), + '-andctl_monitorconf=@0@'.format(ndctlconf), + '-andctl_keysdir=@0@'.format(ndctlkeys_dir), + '-o', '@OUTPUT@', '@INPUT@', + ], + input : man, + output : output_xml, + depend_files : filedeps, + depends : asciidoc_conf, + ) + + xsl = files('../manpage-normal.xsl') + + custom_target(name, + command : [ + xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@' + ], + depends : xml, + depend_files : xsl, + input : xml, + output : output, + install : get_option('docs').enabled(), + install_dir : join_paths(get_option('mandir'), 'man1'), + ) + endif +endforeach diff --git a/clean_config.sh b/clean_config.sh new file mode 100755 index 000000000000..03ec04c5554b --- /dev/null +++ b/clean_config.sh @@ -0,0 +1,2 @@ +#!/bin/bash +git ls-files -o --exclude build | grep config.h\$ | xargs rm diff --git a/config.h.meson b/config.h.meson new file mode 100644 index 000000000000..98102251b494 --- /dev/null +++ b/config.h.meson @@ -0,0 +1,151 @@ +/* Debug messages. */ +#mesondefine ENABLE_DEBUG + +/* destructive functional tests support */ +#mesondefine ENABLE_DESTRUCTIVE + +/* Documentation / man pages. */ +#mesondefine ENABLE_DOCS + +/* Enable keyutils support */ +#mesondefine ENABLE_KEYUTILS + +/* System logging. */ +#mesondefine ENABLE_LOGGING + +/* ndctl test poison support */ +#mesondefine ENABLE_POISON + +/* ndctl test support */ +#mesondefine ENABLE_TEST + +/* Define to 1 if big-endian-arch */ +#mesondefine HAVE_BIG_ENDIAN + +/* Define to 1 if you have the declaration of `BUS_MCEERR_AR', and to 0 if you + don't. */ +#mesondefine HAVE_DECL_BUS_MCEERR_AR + +/* Define to 1 if you have the declaration of `MAP_SHARED_VALIDATE', and to 0 + if you don't. */ +#mesondefine HAVE_DECL_MAP_SHARED_VALIDATE + +/* Define to 1 if you have the declaration of `MAP_SYNC', and to 0 if you + don't. */ +#mesondefine HAVE_DECL_MAP_SYNC + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_KEYUTILS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LINUX_VERSION_H + +/* Define to 1 if little-endian-arch */ +#mesondefine HAVE_LITTLE_ENDIAN + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MEMORY_H + +/* Define to 1 if you have the `secure_getenv' function. */ +#mesondefine HAVE_SECURE_GETENV + +/* Define to 1 if you have statement expressions. */ +#mesondefine HAVE_STATEMENT_EXPR + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_TYPES_H + +/* Define to 1 if typeof works with your compiler. */ +#mesondefine HAVE_TYPEOF + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_UNISTD_H + +/* Define to 1 if using libuuid */ +#mesondefine HAVE_UUID + +/* Define to 1 if you have the `__secure_getenv' function. */ +#mesondefine HAVE___SECURE_GETENV + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#mesondefine LT_OBJDIR + +/* Name of package */ +#mesondefine PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#mesondefine PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#mesondefine PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#mesondefine PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#mesondefine PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#mesondefine PACKAGE_URL + +/* Define to the version of this package. */ +#mesondefine PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#mesondefine STDC_HEADERS + +/* Version number of package */ +#mesondefine VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#mesondefine _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#mesondefine _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#mesondefine _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#mesondefine _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#mesondefine _POSIX_SOURCE + +/* Define to __typeof__ if your compiler spells it that way. */ +#mesondefine typeof + +/* Define to enable GNU Source Extensions */ +#mesondefine _GNU_SOURCE + +/* Locations to install configuration files, key config, man pages, etc.. */ +#mesondefine NDCTL_CONF_FILE +#mesondefine NDCTL_CONF_DIR +#mesondefine DAXCTL_CONF_DIR +#mesondefine NDCTL_KEYS_DIR +#mesondefine NDCTL_MAN_PATH +#mesondefine DAXCTL_MODPROBE_DATA +#mesondefine DAXCTL_MODPROBE_INSTALL +#mesondefine PREFIX diff --git a/contrib/meson.build b/contrib/meson.build new file mode 100644 index 000000000000..4ed3c20165b4 --- /dev/null +++ b/contrib/meson.build @@ -0,0 +1,28 @@ +bashcompletiondir = get_option('bashcompletiondir') +if bashcompletiondir == '' + bash_completion = dependency('bash-completion', required : false) + if bash_completion.found() + bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir') + else + bashcompletiondir = datadir / 'bash-completion/completions' + endif +endif + +if bashcompletiondir != 'no' + install_data('ndctl', install_dir : bashcompletiondir) + +# TODO Switch to symlinks once 0.61.0 is more widely available +# install_symlink('daxctl', +# install_dir : bashcompletiondir, +# pointing_to : 'ndctl' +# ) +# install_symlink('cxl', +# install_dir : bashcompletiondir, +# pointing_to : 'ndctl' +# ) + install_data('ndctl', rename : 'daxctl', install_dir : bashcompletiondir) + install_data('ndctl', rename : 'cxl', install_dir : bashcompletiondir) +endif + +modprobedatadir = get_option('sysconfdir') + '/modprobe.d/' +install_data('nvdimm-security.conf', install_dir : modprobedatadir) diff --git a/cxl/lib/meson.build b/cxl/lib/meson.build new file mode 100644 index 000000000000..eba0ce7278e7 --- /dev/null +++ b/cxl/lib/meson.build @@ -0,0 +1,35 @@ +libcxl_version = '@0@.@1@.@2@'.format( + LIBCXL_CURRENT - LIBCXL_AGE, + LIBCXL_REVISION, + LIBCXL_AGE) + +mapfile = files('libcxl.sym') +vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0]) + +cxl = library('cxl', + '../../util/sysfs.c', + '../../util/log.c', + '../../util/log.h', + 'libcxl.c', + include_directories : root_inc, + dependencies : [ + uuid, + kmod, + ], + version : libcxl_version, + install : true, + install_dir : rootlibdir, + link_args : vflag, + link_depends : mapfile, +) +cxl_dep = declare_dependency(link_with : cxl) + +custom_target( + 'libcxl.pc', + command : pkgconfig_script + [ '@INPUT@' ], + input : 'libcxl.pc.in', + output : 'libcxl.pc', + capture : true, + install : true, + install_dir : pkgconfiglibdir, +) diff --git a/cxl/meson.build b/cxl/meson.build new file mode 100644 index 000000000000..805924b9df9b --- /dev/null +++ b/cxl/meson.build @@ -0,0 +1,25 @@ +cxl_src = [ + 'cxl.c', + 'list.c', + 'memdev.c', + '../util/json.c', + 'json.c', + 'filter.c', +] + +cxl_tool = executable('cxl', + cxl_src, + include_directories : root_inc, + dependencies : [ + cxl_dep, + util_dep, + uuid, + kmod, + json, + versiondep, + ], + install : true, + install_dir : rootbindir, +) + +install_headers('libcxl.h', subdir : 'cxl') diff --git a/daxctl/device.c b/daxctl/device.c index d202f02d07e7..d2d206b95cae 100644 --- a/daxctl/device.c +++ b/daxctl/device.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/daxctl/lib/meson.build b/daxctl/lib/meson.build new file mode 100644 index 000000000000..b79c6e591945 --- /dev/null +++ b/daxctl/lib/meson.build @@ -0,0 +1,44 @@ +libdaxctl_version = '@0@.@1@.@2@'.format( + LIBDAXCTL_CURRENT - LIBDAXCTL_AGE, + LIBDAXCTL_REVISION, + LIBDAXCTL_AGE, +) + +mapfile = files('libdaxctl.sym') +vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0]) + +libdaxctl_src = [ + '../../util/iomem.c', + '../../util/sysfs.c', + '../../util/log.c', + 'libdaxctl.c', +] + +daxctl = library( + 'daxctl', + libdaxctl_src, + version : libdaxctl_version, + include_directories : root_inc, + dependencies : [ + uuid, + kmod, + ], + install : true, + install_dir : rootlibdir, + link_args : vflag, + link_depends : mapfile, +) + +daxctl_dep = declare_dependency(link_with : daxctl) + +custom_target( + 'libdaxctl.pc', + command : pkgconfig_script + [ '@INPUT@' ], + input : 'libdaxctl.pc.in', + output : 'libdaxctl.pc', + capture : true, + install : true, + install_dir : pkgconfiglibdir, +) + +install_data('daxctl.conf', install_dir : datadir / 'daxctl') diff --git a/daxctl/meson.build b/daxctl/meson.build new file mode 100644 index 000000000000..ec2e2b648d40 --- /dev/null +++ b/daxctl/meson.build @@ -0,0 +1,35 @@ +daxctl_src = [ + 'daxctl.c', + 'acpi.c', + 'list.c', + 'migrate.c', + 'device.c', + '../util/json.c', + 'json.c', + 'filter.c', +] + +daxctl_tool = executable('daxctl', + daxctl_src, + include_directories : root_inc, + dependencies : [ + daxctl_dep, + ndctl_dep, + iniparser, + util_dep, + uuid, + kmod, + json, + versiondep, + ], + install : true, + install_dir : rootbindir, +) + +install_headers('libdaxctl.h', subdir : 'daxctl') + +install_data('daxctl.example.conf', install_dir : daxctlconf_dir ) +if get_option('systemd').enabled() + install_data('90-daxctl-device.rules', install_dir : udevrulesdir) + install_data('daxdev-reconfigure@.service', install_dir : systemdunitdir) +endif diff --git a/meson.build b/meson.build new file mode 100644 index 000000000000..272ac642c193 --- /dev/null +++ b/meson.build @@ -0,0 +1,280 @@ +project('ndctl', 'c', + version : '72', + license : [ + 'GPL-2.0', + 'LGPL-2.1', + 'CC0-1.0', + 'MIT', + ], + default_options : [ + 'c_std=gnu99', + 'prefix=/usr', + 'sysconfdir=/etc', + 'localstatedir=/var', + ], +) + +# rootprefixdir and rootlibdir setup copied from systemd: +rootprefixdir = get_option('rootprefix') +rootprefix_default = '/usr' +if rootprefixdir == '' + rootprefixdir = rootprefix_default +endif +rootbindir = join_paths(rootprefixdir, 'bin') + +# join_paths ignores the preceding arguments if an absolute component is +# encountered, so this should canonicalize various paths when they are +# absolute or relative. +prefixdir = get_option('prefix') +if not prefixdir.startswith('/') + error('Prefix is not absolute: "@0@"'.format(prefixdir)) +endif +if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/') + error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format( + rootprefixdir, prefixdir)) +endif + +libdir = join_paths(prefixdir, get_option('libdir')) +rootlibdir = get_option('rootlibdir') +if rootlibdir == '' + rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1]) +endif +datadir = prefixdir / get_option('datadir') +includedir = prefixdir / get_option('includedir') + +pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig' + +datadir = prefixdir / get_option('datadir') +includedir = prefixdir / get_option('includedir') +sysconfdir = get_option('sysconfdir') + +pkgconfig_script = ''' +sed -e s,@VERSION@,@0@,g + -e s,@prefix@,@1@,g + -e s,@exec_prefix@,@1@,g + -e s,@libdir@,@2@,g + -e s,@includedir@,@3@,g +'''.format(meson.project_version(), prefixdir, libdir, includedir).split() + +cc_flags = [ + '-Wall', + '-Wchar-subscripts', + '-Wformat-security', + '-Wmissing-declarations', + '-Wmissing-prototypes', + '-Wnested-externs ', + '-Wshadow', + '-Wsign-compare', + '-Wstrict-prototypes', + '-Wtype-limits', + '-Wmaybe-uninitialized', + '-Wdeclaration-after-statement', + '-Wunused-result', + '-D_FORTIFY_SOURCE=2', + '-O2', +] +cc = meson.get_compiler('c') +add_project_arguments(cc.get_supported_arguments(cc_flags), language : 'c') + +project_source_root = meson.current_source_dir() + +# Remove this after the conversion to meson has been completed +# Cleanup the leftover config.h files to avoid conflicts with the meson +# generated config.h +git = find_program('git', required : false) +if git.found() + run_command('clean_config.sh', + env : 'GIT_DIR=@0@/.git'.format(project_source_root), + ) +endif + +version_tag = get_option('version-tag') +if version_tag != '' + vcs_data = configuration_data() + vcs_data.set('VCS_TAG', version_tag) + version_h = configure_file( + configuration : vcs_data, + input : 'version.h.in', + output : 'version.h' + ) +else + vcs_tagger = [ + project_source_root + '/tools/meson-vcs-tag.sh', + project_source_root, + meson.project_version() + ] + + version_h = vcs_tag( + input : 'version.h.in', + output : 'version.h', + command: vcs_tagger + ) +endif + +versiondep = declare_dependency( + compile_args: ['-include', 'version.h'], + sources: version_h +) + +kmod = dependency('libkmod') +libudev = dependency('libudev') +uuid = dependency('uuid') +json = dependency('json-c') +if get_option('docs').enabled() + if get_option('asciidoctor').enabled() + asciidoc = find_program('asciidoctor', required : true) + else + asciidoc = find_program('asciidoc', required : true) + xmlto = find_program('xmlto', required : true) + endif +endif + +if get_option('systemd').enabled() + systemd = dependency('systemd', required : true) + systemdunitdir = systemd.get_pkgconfig_variable('systemd_system_unit_dir') + udev = dependency('udev', required : true) + udevdir = udev.get_pkgconfig_variable('udevdir') + udevrulesdir = udevdir / 'rules.d' +endif + +cc = meson.get_compiler('c') + +# keyutils and iniparser lack pkgconfig +keyutils = cc.find_library('keyutils', required : get_option('keyutils')) +iniparser = cc.find_library('iniparser', required : true) + +conf = configuration_data() +check_headers = [ + ['HAVE_DLFCN_H', 'dlfcn.h'], + ['HAVE_INTTYPES_H', 'inttypes.h'], + ['HAVE_KEYUTILS_H', 'keyutils.h'], + ['HAVE_LINUX_VERSION_H', 'linux/version.h'], + ['HAVE_MEMORY_H', 'memory.h'], + ['HAVE_STDINT_H', 'stdint.h'], + ['HAVE_STDLIB_H', 'stdlib.h'], + ['HAVE_STRINGS_H', 'strings.h'], + ['HAVE_STRING_H', 'string.h'], + ['HAVE_SYS_STAT_H', 'sys/stat.h'], + ['HAVE_SYS_TYPES_H', 'sys/types.h'], + ['HAVE_UNISTD_H', 'unistd.h'], +] + +foreach h : check_headers + if cc.has_header(h.get(1)) + conf.set(h.get(0), 1) + endif +endforeach + +map_sync_symbols = [ + [ 'signal.h', 'BUS_MCEERR_AR' ], + [ 'linux/mman.h', 'MAP_SHARED_VALIDATE' ], + [ 'linux/mman.h', 'MAP_SYNC' ], +] + +count = 0 +foreach symbol : map_sync_symbols + if cc.has_header_symbol(symbol[0], symbol[1]) + conf.set('HAVE_DECL_@0@'.format(symbol[1].to_upper()), 1) + count = count + 1 + endif +endforeach + +poison_enabled = false +if get_option('poison').enabled() and count == 3 + poison_enabled = true +endif + +conf.set('ENABLE_POISON', poison_enabled) +conf.set('ENABLE_KEYUTILS', get_option('keyutils').enabled()) +conf.set('ENABLE_TEST', get_option('test').enabled()) +conf.set('ENABLE_DESTRUCTIVE', get_option('destructive').enabled()) +conf.set('ENABLE_LOGGING', get_option('logging').enabled()) +conf.set('ENABLE_DEBUG', get_option('dbg').enabled()) + +typeof = cc.run(''' + int main() { + struct { + char a[16]; + } x; + typeof(x) y; + + return sizeof(x) == sizeof(y); + } + ''' +) + +if typeof.compiled() and typeof.returncode() == 1 + conf.set('HAVE_TYPEOF', 1) + conf.set('HAVE_STATEMENT_EXPR', 1) +endif + +if target_machine.endian() == 'big' + conf.set('HAVE_BIG_ENDIAN', 1) +else + conf.set('HAVE_LITTLE_ENDIAN', 1) +endif + +conf.set('_GNU_SOURCE', true) +conf.set_quoted('PREFIX', get_option('prefix')) +conf.set_quoted('NDCTL_MAN_PATH', get_option('mandir')) + +foreach ident : ['secure_getenv', '__secure_getenv'] + conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) +endforeach + + +ndctlconf_dir = sysconfdir / 'ndctl.conf.d' +ndctlconf = ndctlconf_dir / 'monitor.conf' +conf.set_quoted('NDCTL_CONF_FILE', ndctlconf) +conf.set_quoted('NDCTL_CONF_DIR', ndctlconf_dir) + +ndctlkeys_dir = sysconfdir / 'ndctl' / 'keys' +conf.set_quoted('NDCTL_KEYS_DIR', ndctlkeys_dir) + +daxctlconf_dir = sysconfdir / 'daxctl.conf.d' +daxctlconf = daxctlconf_dir / 'dax.conf' +conf.set_quoted('DAXCTL_CONF_DIR', daxctlconf_dir) + +conf.set_quoted('DAXCTL_MODPROBE_DATA', datadir / 'daxctl/daxctl.conf') +conf.set_quoted('DAXCTL_MODPROBE_INSTALL', sysconfdir / 'modprobe.d/daxctl.conf') + +config_h = configure_file( + input : 'config.h.meson', + output : 'config.h', + configuration : conf +) +add_project_arguments('-include', 'config.h', language : 'c') + +LIBNDCTL_CURRENT=25 +LIBNDCTL_REVISION=1 +LIBNDCTL_AGE=19 + +LIBDAXCTL_CURRENT=6 +LIBDAXCTL_REVISION=0 +LIBDAXCTL_AGE=5 + +LIBCXL_CURRENT=1 +LIBCXL_REVISION=0 +LIBCXL_AGE=0 + +root_inc = include_directories(['.', 'ndctl', ]) + +ccan = static_library('ccan', + [ 'ccan/str/str.c', 'ccan/list/list.c' ], +) +ccan_dep = declare_dependency(link_with : ccan) + +subdir('daxctl/lib') +subdir('ndctl/lib') +subdir('cxl/lib') +subdir('util') +subdir('ndctl') +subdir('daxctl') +subdir('cxl') +if get_option('docs').enabled() + subdir('Documentation/ndctl') + subdir('Documentation/daxctl') + subdir('Documentation/cxl') +endif +subdir('test') +subdir('contrib') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000000..95312bfcb0d3 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,25 @@ +option('version-tag', type : 'string', + description : 'override the git version string') +option('docs', type : 'feature', value : 'enabled') +option('asciidoctor', type : 'feature', value : 'disabled') +option('systemd', type : 'feature', value : 'enabled') +option('keyutils', type : 'feature', value : 'enabled', + description : 'enable nvdimm device passphrase management') +option('test', type : 'feature', value : 'disabled', + description : 'enable shipping tests in ndctl') +option('destructive', type : 'feature', value : 'disabled', + description : 'enable tests that may clobber live system resources') +option('poison', type : 'feature', value : 'enabled', + description : 'enable tests that inject poison / memory-failure') +option('logging', type : 'feature', value : 'enabled', + description : 'enable log infrastructure') +option('dbg', type : 'feature', value : 'enabled', + description : 'enable dbg messages') +option('rootprefix', type : 'string', + description : '''override the root prefix [default '/' if split-usr and '/usr' otherwise]''') +option('rootlibdir', type : 'string', + description : '''[/usr]/lib/x86_64-linux-gnu or such''') +option('pkgconfiglibdir', type : 'string', value : '', + description : 'directory for standard pkg-config files') +option('bashcompletiondir', type : 'string', + description : '''${datadir}/bash-completion/completions''') diff --git a/ndctl/lib/meson.build b/ndctl/lib/meson.build new file mode 100644 index 000000000000..abce87948cf2 --- /dev/null +++ b/ndctl/lib/meson.build @@ -0,0 +1,48 @@ +libndctl_version = '@0@.@1@.@2@'.format( + LIBNDCTL_CURRENT - LIBNDCTL_AGE, + LIBNDCTL_REVISION, + LIBNDCTL_AGE) + +mapfile = files('libndctl.sym') +vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0]) + +ndctl = library( + 'ndctl', + '../../util/log.c', + '../../util/sysfs.c', + 'dimm.c', + 'inject.c', + 'nfit.c', + 'smart.c', + 'intel.c', + 'hpe1.c', + 'msft.c', + 'hyperv.c', + 'papr.c', + 'ars.c', + 'firmware.c', + 'libndctl.c', + dependencies : [ + daxctl_dep, + libudev, + uuid, + kmod, + ], + include_directories : root_inc, + version : libndctl_version, + install : true, + install_dir : rootlibdir, + link_args : vflag, + link_depends : mapfile, +) +ndctl_dep = declare_dependency(link_with : ndctl) + +custom_target( + 'libndctl.pc', + command : pkgconfig_script + [ '@INPUT@' ], + input : 'libndctl.pc.in', + output : 'libndctl.pc', + capture : true, + install : true, + install_dir : pkgconfiglibdir, +) diff --git a/ndctl/meson.build b/ndctl/meson.build new file mode 100644 index 000000000000..6a3d0e5348c2 --- /dev/null +++ b/ndctl/meson.build @@ -0,0 +1,82 @@ +ndctl_src = [ + 'ndctl.c', + 'bus.c', + 'create-nfit.c', + 'namespace.c', + 'check.c', + 'region.c', + 'dimm.c', + '../util/log.c', + '../daxctl/filter.c', + 'filter.c', + 'list.c', + '../util/json.c', + '../daxctl/json.c', + 'json.c', + 'json-smart.c', + 'inject-error.c', + 'inject-smart.c', + 'monitor.c', +] + +deps = [ + util_dep, + ndctl_dep, + daxctl_dep, + cxl_dep, + uuid, + kmod, + json, + iniparser, + versiondep, +] + +if get_option('keyutils').enabled() + ndctl_src += [ + 'keys.c', + 'load-keys.c', + ] + deps += keyutils +endif + +if get_option('test').enabled() + ndctl_src += [ + '../test/libndctl.c', + '../test/dsm-fail.c', + '../util/sysfs.c', + '../test/core.c', + 'test.c', +] +endif + +if get_option('destructive').enabled() + if get_option('test').disabled() + error('\'-D=destructive=enabled\' requires \'-Dtest=enabled\'\n') + endif + ndctl_src += [ + '../test/pmem_namespaces.c', + 'bat.c', + ] +endif + +if get_option('systemd').enabled() + install_data('ndctl-monitor.service', install_dir : systemdunitdir) +endif +install_data('monitor.conf', install_dir : ndctlconf_dir) +install_data('ndctl.conf', install_dir : ndctlconf_dir) +install_data('keys.readme', install_dir : ndctlkeys_dir) + +ndctl_tool = executable('ndctl', ndctl_src, + dependencies : deps, + install : true, + install_dir : rootbindir, + include_directories : root_inc, +) + +install_headers( + [ + 'libndctl.h', + 'ndctl.h' + ], + subdir : 'ndctl' +) diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 000000000000..94287aaef85b --- /dev/null +++ b/test/meson.build @@ -0,0 +1,237 @@ +testcore = [ + 'core.c', + '../util/log.c', + '../util/sysfs.c', +] + +libndctl_deps = [ + ndctl_dep, + daxctl_dep, + uuid, + kmod, +] + +ndctl_deps = libndctl_deps + [ + json, + util_dep, + versiondep, +] + +libndctl = executable('libndctl', testcore + [ 'libndctl.c'], + dependencies : libndctl_deps, + include_directories : root_inc, +) + +namespace_core = [ + '../ndctl/namespace.c', + '../ndctl/filter.c', + '../ndctl/check.c', + '../util/json.c', + '../ndctl/json.c', + '../daxctl/filter.c', + '../daxctl/json.c', +] + +dsm_fail = executable('dsm-fail', testcore + namespace_core + [ 'dsm-fail.c' ], + dependencies : ndctl_deps, + include_directories : root_inc, +) + +hugetlb_src = testcore + [ 'hugetlb.c', 'dax-pmd.c' ] +if poison_enabled + hugetlb_src += [ 'dax-poison.c' ] +endif +hugetlb = executable('hugetlb', hugetlb_src, + dependencies : libndctl_deps, + include_directories : root_inc, +) + +ack_shutdown_count = executable('ack-shutdown-count-set', + testcore + [ 'ack-shutdown-count-set.c' ], + dependencies : libndctl_deps, + include_directories : root_inc, +) + +dax_errors = executable('dax-errors', + 'dax-errors.c', +) + +smart_notify = executable('smart-notify', 'smart-notify.c', + dependencies : libndctl_deps, + include_directories : root_inc, +) + +smart_listen = executable('smart-listen', 'smart-listen.c', + dependencies : libndctl_deps, + include_directories : root_inc, +) + +daxdev_errors = executable('daxdev-errors', [ + 'daxdev-errors.c', + '../util/log.c', + '../util/sysfs.c', + ], + dependencies : libndctl_deps, + include_directories : root_inc, +) + +list_smart_dimm = executable('list-smart-dimm', [ + 'list-smart-dimm.c', + '../ndctl/filter.c', + '../util/json.c', + '../ndctl/json.c', + '../daxctl/json.c', + '../daxctl/filter.c', + ], + dependencies : ndctl_deps, + include_directories : root_inc, +) + +pmem_ns = executable('pmem-ns', testcore + [ 'pmem_namespaces.c' ], + dependencies : libndctl_deps, + include_directories : root_inc, +) + +dax_dev = executable('dax-dev', testcore + [ 'dax-dev.c' ], + dependencies : libndctl_deps, + include_directories : root_inc, +) + +dax_pmd_src = testcore + [ 'dax-pmd.c' ] +if poison_enabled + dax_pmd_src += [ 'dax-poison.c' ] +endif + +dax_pmd = executable('dax-pmd', dax_pmd_src, + dependencies : libndctl_deps, + include_directories : root_inc, +) + +device_dax_src = testcore + namespace_core + [ + 'device-dax.c', + 'dax-dev.c', + 'dax-pmd.c', +] + +if poison_enabled + device_dax_src += 'dax-poison.c' +endif + +device_dax = executable('device-dax', device_dax_src, + dependencies : ndctl_deps, + include_directories : root_inc, +) + +revoke_devmem = executable('revoke_devmem', testcore + [ + 'revoke-devmem.c', + 'dax-dev.c', + ], + dependencies : libndctl_deps, + include_directories : root_inc, +) + +mmap = executable('mmap', 'mmap.c',) + +create = find_program('create.sh') +clear = find_program('clear.sh') +pmem_errors = find_program('pmem-errors.sh') +daxdev_errors_sh = find_program('daxdev-errors.sh') +multi_dax = find_program('multi-dax.sh') +btt_check = find_program('btt-check.sh') +label_compat = find_program('label-compat.sh') +sector_mode = find_program('sector-mode.sh') +inject_error = find_program('inject-error.sh') +btt_errors = find_program('btt-errors.sh') +btt_pad_compat = find_program('btt-pad-compat.sh') +firmware_update = find_program('firmware-update.sh') +rescan_partitions = find_program('rescan-partitions.sh') +inject_smart = find_program('inject-smart.sh') +monitor = find_program('monitor.sh') +max_extent = find_program('max_available_extent_ns.sh') +pfn_meta_errors = find_program('pfn-meta-errors.sh') +track_uuid = find_program('track-uuid.sh') + +tests = [ + [ 'libndctl', libndctl ], + [ 'dsm-fail', dsm_fail ], + [ 'create.sh', create ], + [ 'clear.sh', clear ], + [ 'pmem-errors.sh', pmem_errors ], + [ 'daxdev-errors.sh', daxdev_errors_sh ], + [ 'multi-dax.sh', multi_dax ], + [ 'btt-check.sh', btt_check ], + [ 'label-compat.sh', label_compat ], + [ 'sector-mode.sh', sector_mode ], + [ 'inject-error.sh', inject_error ], + [ 'btt-errors.sh', btt_errors ], + [ 'hugetlb', hugetlb ], + [ 'btt-pad-compat.sh', btt_pad_compat ], + [ 'firmware-update.sh', firmware_update ], + [ 'ack-shutdown-count-set', ack_shutdown_count ], + [ 'rescan-partitions.sh', rescan_partitions ], + [ 'inject-smart.sh', inject_smart ], + [ 'monitor.sh', monitor ], + [ 'max_extent_ns', max_extent ], + [ 'pfn-meta-errors.sh', pfn_meta_errors ], + [ 'track-uuid.sh', track_uuid ], +] + +if get_option('destructive').enabled() + sub_section = find_program('sub-section.sh') + dax_ext4 = find_program('dax-ext4.sh') + dax_xfs = find_program('dax-xfs.sh') + align = find_program('align.sh') + device_dax_fio = find_program('device-dax-fio.sh') + daxctl_devices = find_program('daxctl-devices.sh') + daxctl_create = find_program('daxctl-create.sh') + dm = find_program('dm.sh') + mmap_test = find_program('mmap.sh') + + tests += [ + [ 'pmem-ns', pmem_ns ], + [ 'sub-section.sh', sub_section ], + [ 'dax-dev', dax_dev ], + [ 'dax-ext4.sh', dax_ext4 ], + [ 'dax-xfs.sh', dax_xfs ], + [ 'align.sh', align ], + [ 'device-dax', device_dax ], + [ 'revoke-devmem', revoke_devmem ], + [ 'device-dax-fio.sh', device_dax_fio ], + [ 'daxctl-devices.sh', daxctl_devices ], + [ 'daxctl-create.sh', daxctl_create ], + [ 'dm.sh', dm ], + [ 'mmap.sh', mmap_test ], + ] +endif + +if get_option('keyutils').enabled() + security = find_program('security.sh') + tests += [ + [ 'security.sh', security ] + ] +endif + +foreach t : tests + test(t[0], t[1], + is_parallel : false, + depends : [ + ndctl_tool, + daxctl_tool, + cxl_tool, + smart_notify, + list_smart_dimm, + dax_pmd, + dax_errors, + daxdev_errors, + dax_dev, + mmap, + ], + timeout : 0, + env : [ + 'NDCTL=@0@'.format(ndctl_tool.full_path()), + 'DAXCTL=@0@'.format(daxctl_tool.full_path()), + 'TEST_PATH=@0@'.format(meson.current_build_dir()), + 'DATA_PATH=@0@'.format(meson.current_source_dir()), + ], + ) +endforeach diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh new file mode 100755 index 000000000000..9f21c37b7d26 --- /dev/null +++ b/tools/meson-vcs-tag.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later + +set -eu +set -o pipefail + +dir="${1:?}" +fallback="${2:?}" + +# Apparently git describe has a bug where it always considers the work-tree +# dirty when invoked with --git-dir (even though 'git status' is happy). Work +# around this issue by cd-ing to the source directory. +cd "$dir" +# Check that we have either .git/ (a normal clone) or a .git file (a work-tree) +# and that we don't get confused if a tarball is extracted in a higher-level +# git repository. +[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | \ + sed -e 's/^v//' -e 's/-/./g' || echo "$fallback" diff --git a/util/meson.build b/util/meson.build new file mode 100644 index 000000000000..784b27915649 --- /dev/null +++ b/util/meson.build @@ -0,0 +1,16 @@ +util = static_library('util', [ + 'parse-options.c', + 'parse-configs.c', + 'usage.c', + 'size.c', + 'main.c', + 'help.c', + 'strbuf.c', + 'wrapper.c', + 'bitmap.c', + 'abspath.c', + 'iomem.c', + ], + include_directories : root_inc, +) +util_dep = declare_dependency(link_with : util) diff --git a/version.h.in b/version.h.in new file mode 100644 index 000000000000..dedbaf95caf7 --- /dev/null +++ b/version.h.in @@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: LGPL-2.1 */ +#define VERSION "@VCS_TAG@" From patchwork Wed Jan 5 21:32:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97016C433EF for ; Wed, 5 Jan 2022 21:35:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244503AbiAEVfG (ORCPT ); Wed, 5 Jan 2022 16:35:06 -0500 Received: from mga03.intel.com ([134.134.136.65]:45220 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244465AbiAEVe3 (ORCPT ); Wed, 5 Jan 2022 16:34:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418468; x=1672954468; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7WdE/EIssg2czk0Z/KQ8xFp9mJltRgl6v4rrVJtD4A8=; b=UCcDbfzuP7TeFVvC3KgCSDUksDUwQGm7lsWd791UmcQGr4r0BIchs0+H IcarMXfzNFAexT3yqV3wv9Elxn9DRJTvQMsYTDISi8dj3DHRqZLAPkbtA nxVCkRNkRFwQRtGazxYrHt4UETtCQOOVArNUA8aE/e+j/Bfxk2XP3Zf15 XoncB+msLrqC3nqq7J3n9+QCINJEOq4VznQs75859hR/9cbN2rYLZroeD tx+pXubSw9qaJLuuw5irhHjyM2o0ufDVukxSRCb4NDl4Q6XfncDjCq9r2 ETOwbIY1dihVK3a1yx/O3J3ZnYxVlghlOSGvevpc66o905PGSVrRcuvR6 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="242496087" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="242496087" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:58 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="526709678" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:32:58 -0800 Subject: [ndctl PATCH v3 15/16] build: Add meson rpmbuild support From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:32:58 -0800 Message-ID: <164141837841.3990253.11379060834465142446.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Beyond being a prerequisite for removing autotools support, this capability served as validation that the meson conversion generated all the same files as autotools and installed them to the same expected locations. The procedure to use the rpmbuild.sh script is: meson setup build meson compile -C build rhel/ndctl.spec ./rpmbuild.sh build/rhel/ndctl.spec Signed-off-by: Dan Williams --- .gitignore | 2 +- Makefile.am | 2 ++ meson.build | 6 ++++++ ndctl.spec.in | 23 +++++++++++++++++++++++ rhel/meson.build | 23 +++++++++++++++++++++++ rpmbuild.sh | 5 ++++- sles/meson.build | 36 ++++++++++++++++++++++++++++++++++++ 7 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 rhel/meson.build create mode 100644 sles/meson.build diff --git a/.gitignore b/.gitignore index 91c5e37b7fef..df8245dc10d8 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,7 @@ daxctl/lib/libdaxctl.pc ndctl/config.h ndctl/lib/libndctl.pc ndctl/ndctl -rhel/ +rhel/ndctl.spec sles/ndctl.spec version.m4 *.swp diff --git a/Makefile.am b/Makefile.am index daea39f5d41e..b78059b0b364 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,6 +22,7 @@ noinst_SCRIPTS = rhel/ndctl.spec sles/ndctl.spec CLEANFILES += $(noinst_SCRIPTS) do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \ + -e 's,MESON,0,g' \ -e 's,DAX_DNAME,daxctl-devel,g' \ -e 's,CXL_DNAME,cxl-devel,g' \ -e 's,DNAME,ndctl-devel,g' \ @@ -31,6 +32,7 @@ do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \ -e 's,LNAME,ndctl-libs,g' do_sles_subst = sed -e 's,VERSION,$(VERSION),g' \ + -e 's,MESON,0,g' \ -e 's,DAX_DNAME,libdaxctl-devel,g' \ -e 's,CXL_DNAME,libcxl-devel,g' \ -e 's,DNAME,libndctl-devel,g' \ diff --git a/meson.build b/meson.build index 272ac642c193..b22fb2e57f6b 100644 --- a/meson.build +++ b/meson.build @@ -278,3 +278,9 @@ if get_option('docs').enabled() endif subdir('test') subdir('contrib') + +# only support spec file generation from git builds +if version_tag == '' + subdir('rhel') + subdir('sles') +endif diff --git a/ndctl.spec.in b/ndctl.spec.in index cb911194a2cb..9447267839d2 100644 --- a/ndctl.spec.in +++ b/ndctl.spec.in @@ -6,14 +6,20 @@ License: GPLv2 Url: https://github.com/pmem/ndctl Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +%define with_meson MESON Requires: LNAME%{?_isa} = %{version}-%{release} Requires: DAX_LNAME%{?_isa} = %{version}-%{release} Requires: CXL_LNAME%{?_isa} = %{version}-%{release} BuildRequires: autoconf %if 0%{?rhel} < 9 BuildRequires: asciidoc +%if !%{with_meson} %define asciidoc --disable-asciidoctor +%endif %else +%if %{with_meson} +%define asciidoctor -Dasciidoctor=enabled +%endif BuildRequires: rubygem-asciidoctor %endif BuildRequires: xmlto @@ -30,6 +36,10 @@ BuildRequires: keyutils-libs-devel BuildRequires: systemd-rpm-macros BuildRequires: iniparser-devel +%if %{with_meson} +BuildRequires: meson +%endif + %description Utility library for managing the "libnvdimm" subsystem. The "libnvdimm" subsystem defines a kernel device model and control message interface for @@ -117,17 +127,30 @@ libcxl is a library for enumerating and communicating with CXL devices. %setup -q ndctl-%{version} %build +%if %{with_meson} +%meson %{?asciidoctor} -Dversion-tag=%{version} +%meson_build +%else echo %{version} > version ./autogen.sh %configure --disable-static --disable-silent-rules %{?asciidoc} make %{?_smp_mflags} +%endif %install +%if %{with_meson} +%meson_install +%else %make_install find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' +%endif %check +%if %{with_meson} +%meson_test +%else make check +%endif %ldconfig_scriptlets -n LNAME diff --git a/rhel/meson.build b/rhel/meson.build new file mode 100644 index 000000000000..8672098d84e1 --- /dev/null +++ b/rhel/meson.build @@ -0,0 +1,23 @@ +rhel_spec1 = vcs_tag( + input : '../ndctl.spec.in', + output : 'ndctl.spec.in', + command: vcs_tagger, + replace_string : 'VERSION', +) + +rhel_spec2 = custom_target('ndctl.spec', + command : [ + 'sed', '-e', 's,MESON,1,g', + '-e', 's,DAX_DNAME,daxctl-devel,g', + '-e', 's,CXL_DNAME,cxl-devel,g', + '-e', 's,DNAME,ndctl-devel,g', + '-e', '/^%defattr.*/d', + '-e', 's,DAX_LNAME,daxctl-libs,g', + '-e', 's,CXL_LNAME,cxl-libs,g', + '-e', 's,LNAME,ndctl-libs,g', + '@INPUT@' + ], + input : rhel_spec1, + output : 'ndctl.spec', + capture : true, +) diff --git a/rpmbuild.sh b/rpmbuild.sh index fe4154b6be9f..b1f4d9e5c0f3 100755 --- a/rpmbuild.sh +++ b/rpmbuild.sh @@ -1,6 +1,9 @@ #!/bin/bash + +spec=${1:-$(dirname $0)/rhel/ndctl.spec)} + pushd $(dirname $0) >/dev/null [ ! -d ~/rpmbuild/SOURCES ] && echo "rpmdev tree not found" && exit 1 ./make-git-snapshot.sh popd > /dev/null -rpmbuild -ba $(dirname $0)/rhel/ndctl.spec +rpmbuild --nocheck -ba $spec diff --git a/sles/meson.build b/sles/meson.build new file mode 100644 index 000000000000..21c72cb4f5ec --- /dev/null +++ b/sles/meson.build @@ -0,0 +1,36 @@ +sles_spec1 = vcs_tag( + input : '../ndctl.spec.in', + output : 'ndctl.spec.sles.in', + command: vcs_tagger, + replace_string : 'VERSION', +) + +header = files('header') + +sles_spec2 = custom_target('ndctl.spec.in', + command : [ + 'cat', header, '@INPUT@', + ], + input : sles_spec1, + output : 'ndctl.spec.in', + capture : true, +) + +sles_spec3 = custom_target('ndctl.spec', + command : [ + 'sed', '-e', 's,MESON,1,g', + '-e', 's,DAX_DNAME,libdaxctl-devel,g', + '-e', 's,CXL_DNAME,libcxl-devel,g', + '-e', 's,DNAME,libndctl-devel,g', + '-e', 's,%license,%doc,g', + '-e', 's,\(^License:.*GPL\)v2,\1-2.0,g', + '-e', 's,DAX_LNAME,libdaxctl@0@,g'.format(LIBDAXCTL_CURRENT - LIBDAXCTL_AGE), + '-e', 's,CXL_LNAME,libcxl@0@,g'.format(LIBCXL_CURRENT - LIBCXL_AGE), + '-e', 's,LNAME,libndctl@0@,g'.format(LIBNDCTL_CURRENT - LIBNDCTL_AGE), + '@INPUT@' + ], + + input : sles_spec2, + output : 'ndctl.spec', + capture : true, +) From patchwork Wed Jan 5 21:33:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12704767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51C32C433F5 for ; Wed, 5 Jan 2022 21:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244439AbiAEVeB (ORCPT ); Wed, 5 Jan 2022 16:34:01 -0500 Received: from mga01.intel.com ([192.55.52.88]:44708 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244466AbiAEVdE (ORCPT ); Wed, 5 Jan 2022 16:33:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641418384; x=1672954384; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uPkAE9MY5lMISgIYJ40E2L1wjf93kUPIKI7IvjoLoyA=; b=dJEmcRmY/qi803bBYsHk9IqbqrkwhrlKIPtXGf6YPwpdZKYYAqczC45g JQgNY4zAInv5y0Rmi51pnRtFuJIsuLLgjHc4lzsuh3XiYl3bnXrUo5vpj oUy5XPnwudWFBQAImLIzMnJQOvrIrpP4Jf9BHDaO9uyVd90ZRb40lSzNf AuqophdzW6gv9UJSonOKoF0lroXkBLJQo9oAX4bbTqek69itBYu1TJk0Y fGTHfsL72t5NJDRBdFtVRAN1i6neHZ5v+qScw4Uf2FPjrD8l1DRqEV9nN WOajAb4CzXUhWlHQjRxaL95ES0w2vBxZnqPbMLLE3VnO1LWCQQw7GgOQg Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="266822557" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="266822557" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:33:03 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="513148391" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 13:33:03 -0800 Subject: [ndctl PATCH v3 16/16] ndctl: Jettison autotools From: Dan Williams To: vishal.l.verma@intel.com Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Date: Wed, 05 Jan 2022 13:33:03 -0800 Message-ID: <164141838349.3990253.14745993061779737304.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> References: <164141829899.3990253.17547886681174580434.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Similar to several other projects, ndctl has run its course with autotools and sees a better path forward with Meson. Now that the Meson conversion is complete, remove the autotools infrastructure. Signed-off-by: Dan Williams --- .gitignore | 58 -------- Documentation/cxl/Makefile.am | 61 -------- Documentation/cxl/lib/Makefile.am | 58 -------- Documentation/daxctl/Makefile.am | 72 ---------- Documentation/ndctl/Makefile.am | 103 -------------- Makefile.am | 104 -------------- Makefile.am.in | 46 ------ autogen.sh | 28 ---- configure.ac | 270 ------------------------------------- cxl/Makefile.am | 25 --- cxl/lib/Makefile.am | 32 ---- daxctl/Makefile.am | 45 ------ daxctl/lib/Makefile.am | 42 ------ ndctl.spec.in | 28 ---- ndctl/Makefile.am | 86 ------------ ndctl/lib/Makefile.am | 58 -------- rhel/meson.build | 3 sles/meson.build | 3 test/Makefile.am | 169 ----------------------- 19 files changed, 4 insertions(+), 1287 deletions(-) delete mode 100644 Documentation/cxl/Makefile.am delete mode 100644 Documentation/cxl/lib/Makefile.am delete mode 100644 Documentation/daxctl/Makefile.am delete mode 100644 Documentation/ndctl/Makefile.am delete mode 100644 Makefile.am delete mode 100644 Makefile.am.in delete mode 100755 autogen.sh delete mode 100644 configure.ac delete mode 100644 cxl/Makefile.am delete mode 100644 cxl/lib/Makefile.am delete mode 100644 daxctl/Makefile.am delete mode 100644 daxctl/lib/Makefile.am delete mode 100644 ndctl/Makefile.am delete mode 100644 ndctl/lib/Makefile.am delete mode 100644 test/Makefile.am diff --git a/.gitignore b/.gitignore index df8245dc10d8..aa0ce8e400c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,63 +1,5 @@ -*.o -*.lo -*.xml -.deps/ -.libs/ -Makefile -!contrib/Makefile -Makefile.in -/aclocal.m4 -/autom4te.cache -/build-aux -/config.h -/config.log -/config.status -/configure -/libtool -/stamp-h1 -*.1 -*.3 -Documentation/daxctl/asciidoc.conf -Documentation/ndctl/asciidoc.conf -Documentation/cxl/asciidoc.conf -Documentation/cxl/lib/asciidoc.conf -Documentation/daxctl/asciidoctor-extensions.rb -Documentation/ndctl/asciidoctor-extensions.rb -Documentation/cxl/asciidoctor-extensions.rb -Documentation/cxl/lib/asciidoctor-extensions.rb -.dirstamp build/ -daxctl/config.h -daxctl/daxctl -daxctl/lib/libdaxctl.la -daxctl/lib/libdaxctl.pc -*.a -ndctl/config.h -ndctl/lib/libndctl.pc -ndctl/ndctl rhel/ndctl.spec sles/ndctl.spec -version.m4 *.swp -cscope.files -cscope*.out tags -test/*.log -test/*.trs -test/dax-dev -test/dax-errors -test/dax-pmd -test/daxdev-errors -test/device-dax -test/dsm-fail -test/hugetlb -test/image -test/libndctl -test/mmap -test/pmem-ns -test/smart-listen -test/smart-notify -test/fio.job -test/local-write-0-verify.state -test/ack-shutdown-count-set -test/list-smart-dimm diff --git a/Documentation/cxl/Makefile.am b/Documentation/cxl/Makefile.am deleted file mode 100644 index efabaa37027f..000000000000 --- a/Documentation/cxl/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2020-2021 Intel Corporation. All rights reserved. - -if USE_ASCIIDOCTOR - -do_subst = sed -e 's,@Utility@,Cxl,g' -e's,@utility@,cxl,g' -CONFFILE = asciidoctor-extensions.rb -asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -else - -do_subst = sed -e 's,UTILITY,cxl,g' -CONFFILE = asciidoc.conf -asciidoc.conf: ../asciidoc.conf.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -endif - -man1_MANS = \ - cxl.1 \ - cxl-list.1 \ - cxl-read-labels.1 \ - cxl-write-labels.1 \ - cxl-zero-labels.1 - -EXTRA_DIST = $(man1_MANS) - -CLEANFILES = $(man1_MANS) - -XML_DEPS = \ - ../../version.m4 \ - ../copyright.txt \ - Makefile \ - $(CONFFILE) - -RM ?= rm -f - -if USE_ASCIIDOCTOR - -%.1: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b manpage -d manpage -acompat-mode \ - -I. -rasciidoctor-extensions \ - -amansource=cxl -amanmanual="cxl Manual" \ - -andctl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -else - -%.xml: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ - --unsafe -acxl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -%.1: %.xml $(XML_DEPS) - $(AM_V_GEN)$(RM) $@ && \ - $(XMLTO) -o . -m ../manpage-normal.xsl man $< - -endif diff --git a/Documentation/cxl/lib/Makefile.am b/Documentation/cxl/lib/Makefile.am deleted file mode 100644 index 41e3a5fc02b6..000000000000 --- a/Documentation/cxl/lib/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2020-2021 Intel Corporation. All rights reserved. - -if USE_ASCIIDOCTOR - -do_subst = sed -e 's,@Utility@,Libcxl,g' -e's,@utility@,libcxl,g' -CONFFILE = asciidoctor-extensions.rb -asciidoctor-extensions.rb: ../../asciidoctor-extensions.rb.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -else - -do_subst = sed -e 's,UTILITY,libcxl,g' -CONFFILE = asciidoc.conf -asciidoc.conf: ../../asciidoc.conf.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -endif - -man3_MANS = \ - libcxl.3 \ - cxl_new.3 - -EXTRA_DIST = $(man3_MANS) - -CLEANFILES = $(man3_MANS) - -XML_DEPS = \ - ../../../version.m4 \ - ../../copyright.txt \ - Makefile \ - $(CONFFILE) - -RM ?= rm -f - -if USE_ASCIIDOCTOR - -%.3: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b manpage -d manpage -acompat-mode \ - -I. -rasciidoctor-extensions \ - -amansource=libcxl -amanmanual="libcxl Manual" \ - -andctl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -else - -%.xml: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ - --unsafe -alibcxl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -%.3: %.xml $(XML_DEPS) - $(AM_V_GEN)$(RM) $@ && \ - $(XMLTO) -o . -m ../../manpage-normal.xsl man $< - -endif diff --git a/Documentation/daxctl/Makefile.am b/Documentation/daxctl/Makefile.am deleted file mode 100644 index 78c47f5055c4..000000000000 --- a/Documentation/daxctl/Makefile.am +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2015-2020 Intel Corporation. All rights reserved. - -if USE_ASCIIDOCTOR - -do_subst = sed -e 's,@Utility@,Daxctl,g' -e's,@utility@,daxctl,g' -CONFFILE = asciidoctor-extensions.rb -asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -else - -do_subst = sed -e 's,UTILITY,daxctl,g' -CONFFILE = asciidoc.conf -asciidoc.conf: ../asciidoc.conf.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -endif - -man1_MANS = \ - daxctl.1 \ - daxctl-list.1 \ - daxctl-migrate-device-model.1 \ - daxctl-reconfigure-device.1 \ - daxctl-online-memory.1 \ - daxctl-offline-memory.1 \ - daxctl-disable-device.1 \ - daxctl-enable-device.1 \ - daxctl-create-device.1 \ - daxctl-destroy-device.1 - -EXTRA_DIST = $(man1_MANS) - -CLEANFILES = $(man1_MANS) - -XML_DEPS = \ - ../../version.m4 \ - ../copyright.txt \ - Makefile \ - $(CONFFILE) - -RM ?= rm -f - -if USE_ASCIIDOCTOR - -%.1: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b manpage -d manpage -acompat-mode \ - -I. -rasciidoctor-extensions \ - -amansource=daxctl -amanmanual="daxctl Manual" \ - -adaxctl_confdir=$(daxctl_confdir) \ - -adaxctl_conf=$(daxctl_conf) \ - -andctl_keysdir=$(ndctl_keysdir) \ - -andctl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -else - -%.xml: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ - -adaxctl_confdir=$(daxctl_confdir) \ - -adaxctl_conf=$(daxctl_conf) \ - -andctl_keysdir=$(ndctl_keysdir) \ - --unsafe -adaxctl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -%.1: %.xml $(XML_DEPS) - $(AM_V_GEN)$(RM) $@ && \ - $(XMLTO) -o . -m ../manpage-normal.xsl man $< - -endif diff --git a/Documentation/ndctl/Makefile.am b/Documentation/ndctl/Makefile.am deleted file mode 100644 index 203158c1dfaf..000000000000 --- a/Documentation/ndctl/Makefile.am +++ /dev/null @@ -1,103 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2015-2020 Intel Corporation. All rights reserved. - -if USE_ASCIIDOCTOR - -do_subst = sed -e 's,@Utility@,Ndctl,g' -e's,@utility@,ndctl,g' -CONFFILE = asciidoctor-extensions.rb -asciidoctor-extensions.rb: ../asciidoctor-extensions.rb.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -else - -do_subst = sed -e 's,UTILITY,ndctl,g' -CONFFILE = asciidoc.conf -asciidoc.conf: ../asciidoc.conf.in - $(AM_V_GEN) $(do_subst) < $< > $@ - -endif - -man1_MANS = \ - ndctl.1 \ - ndctl-wait-scrub.1 \ - ndctl-start-scrub.1 \ - ndctl-zero-labels.1 \ - ndctl-read-labels.1 \ - ndctl-write-labels.1 \ - ndctl-init-labels.1 \ - ndctl-check-labels.1 \ - ndctl-enable-region.1 \ - ndctl-disable-region.1 \ - ndctl-enable-dimm.1 \ - ndctl-disable-dimm.1 \ - ndctl-enable-namespace.1 \ - ndctl-disable-namespace.1 \ - ndctl-create-namespace.1 \ - ndctl-destroy-namespace.1 \ - ndctl-check-namespace.1 \ - ndctl-clear-errors.1 \ - ndctl-inject-error.1 \ - ndctl-inject-smart.1 \ - ndctl-update-firmware.1 \ - ndctl-list.1 \ - ndctl-monitor.1 \ - ndctl-setup-passphrase.1 \ - ndctl-update-passphrase.1 \ - ndctl-remove-passphrase.1 \ - ndctl-freeze-security.1 \ - ndctl-sanitize-dimm.1 \ - ndctl-load-keys.1 \ - ndctl-wait-overwrite.1 \ - ndctl-read-infoblock.1 \ - ndctl-write-infoblock.1 \ - ndctl-activate-firmware.1 - -EXTRA_DIST = $(man1_MANS) - -CLEANFILES = $(man1_MANS) - -XML_DEPS = \ - ../../version.m4 \ - Makefile \ - $(CONFFILE) \ - ../copyright.txt \ - region-description.txt \ - xable-region-options.txt \ - dimm-description.txt \ - xable-dimm-options.txt \ - xable-namespace-options.txt \ - ars-description.txt \ - labels-description.txt \ - labels-options.txt - -RM ?= rm -f - -if USE_ASCIIDOCTOR - -%.1: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b manpage -d manpage -acompat-mode \ - -I. -rasciidoctor-extensions \ - -amansource=ndctl -amanmanual="ndctl Manual" \ - -andctl_confdir=$(ndctl_confdir) \ - -andctl_monitorconf=$(ndctl_monitorconf) \ - -andctl_keysdir=$(ndctl_keysdir) \ - -andctl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -else - -%.xml: %.txt $(XML_DEPS) - $(AM_V_GEN)$(RM) $@+ $@ && \ - $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ - -andctl_confdir=$(ndctl_confdir) \ - -andctl_monitorconf=$(ndctl_monitorconf) \ - -andctl_keysdir=$(ndctl_keysdir) \ - --unsafe -andctl_version=$(VERSION) -o $@+ $< && \ - mv $@+ $@ - -%.1: %.xml $(XML_DEPS) - $(AM_V_GEN)$(RM) $@ && \ - $(XMLTO) -o . -m ../manpage-normal.xsl man $< - -endif diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index b78059b0b364..000000000000 --- a/Makefile.am +++ /dev/null @@ -1,104 +0,0 @@ -include Makefile.am.in - -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -SUBDIRS = . cxl/lib daxctl/lib ndctl/lib cxl ndctl daxctl -if ENABLE_DOCS -SUBDIRS += Documentation/ndctl Documentation/daxctl Documentation/cxl -SUBDIRS += Documentation/cxl/lib -endif -SUBDIRS += test - -BUILT_SOURCES = version.m4 -version.m4: FORCE - $(AM_V_GEN)$(top_srcdir)/git-version-gen - -FORCE: - -EXTRA_DIST += ndctl.spec.in \ - sles/header \ - contrib/nvdimm-security.conf - -noinst_SCRIPTS = rhel/ndctl.spec sles/ndctl.spec -CLEANFILES += $(noinst_SCRIPTS) - -do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \ - -e 's,MESON,0,g' \ - -e 's,DAX_DNAME,daxctl-devel,g' \ - -e 's,CXL_DNAME,cxl-devel,g' \ - -e 's,DNAME,ndctl-devel,g' \ - -e '/^%defattr.*/d' \ - -e 's,DAX_LNAME,daxctl-libs,g' \ - -e 's,CXL_LNAME,cxl-libs,g' \ - -e 's,LNAME,ndctl-libs,g' - -do_sles_subst = sed -e 's,VERSION,$(VERSION),g' \ - -e 's,MESON,0,g' \ - -e 's,DAX_DNAME,libdaxctl-devel,g' \ - -e 's,CXL_DNAME,libcxl-devel,g' \ - -e 's,DNAME,libndctl-devel,g' \ - -e 's,%license,%doc,g' \ - -e 's,\(^License:.*GPL\)v2,\1-2.0,g' \ - -e "s,DAX_LNAME,libdaxctl$$(($(LIBDAXCTL_CURRENT) - $(LIBDAXCTL_AGE))),g" \ - -e "s,CXL_LNAME,libcxl$$(($(LIBCXL_CURRENT) - $(LIBCXL_AGE))),g" \ - -e "s,LNAME,libndctl$$(($(LIBNDCTL_CURRENT) - $(LIBNDCTL_AGE))),g" - -rhel/ndctl.spec: ndctl.spec.in Makefile.am version.m4 - $(AM_V_GEN)$(MKDIR_P) rhel; $(do_rhel_subst) < $< > $@ - -sles/ndctl.spec: sles/header ndctl.spec.in Makefile.am version.m4 - $(AM_V_GEN)$(MKDIR_P) sles; cat sles/header $< | $(do_sles_subst) > $@ - -if ENABLE_BASH_COMPLETION -bashcompletiondir = $(BASH_COMPLETION_DIR) -dist_bashcompletion_DATA = contrib/ndctl -install-data-hook: - $(LN_S) -f $(BASH_COMPLETION_DIR)/ndctl $(DESTDIR)/$(BASH_COMPLETION_DIR)/daxctl - $(LN_S) -f $(BASH_COMPLETION_DIR)/ndctl $(DESTDIR)/$(BASH_COMPLETION_DIR)/cxl -endif - -modprobe_file = contrib/nvdimm-security.conf -modprobedir = $(sysconfdir)/modprobe.d/ -modprobe_DATA = $(modprobe_file) - -noinst_LIBRARIES = libccan.a -libccan_a_SOURCES = \ - ccan/str/str.h \ - ccan/str/str_debug.h \ - ccan/str/str.c \ - ccan/str/debug.c \ - ccan/list/list.h \ - ccan/list/list.c \ - ccan/container_of/container_of.h \ - ccan/check_type/check_type.h \ - ccan/build_assert/build_assert.h \ - ccan/array_size/array_size.h \ - ccan/minmax/minmax.h \ - ccan/short_types/short_types.h \ - ccan/endian/endian.h - -noinst_LIBRARIES += libutil.a -libutil_a_SOURCES = \ - util/parse-options.c \ - util/parse-options.h \ - util/parse-configs.c \ - util/parse-configs.h \ - util/usage.c \ - util/size.c \ - util/main.c \ - util/help.c \ - util/strbuf.c \ - util/wrapper.c \ - util/bitmap.c \ - util/abspath.c \ - util/iomem.c \ - util/util.h \ - util/strbuf.h \ - util/size.h \ - util/main.h \ - util/filter.h \ - util/bitmap.h - -nobase_include_HEADERS = \ - daxctl/libdaxctl.h \ - cxl/libcxl.h \ - cxl/cxl_mem.h diff --git a/Makefile.am.in b/Makefile.am.in deleted file mode 100644 index d6b126986bb4..000000000000 --- a/Makefile.am.in +++ /dev/null @@ -1,46 +0,0 @@ -EXTRA_DIST = -CLEANFILES = - -AM_MAKEFLAGS = --no-print-directory - -AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DLIBEXECDIR=\""$(libexecdir)"\" \ - -DPREFIX=\""$(prefix)"\" \ - -DNDCTL_MAN_PATH=\""$(mandir)"\" \ - -I${top_srcdir}/ \ - $(KMOD_CFLAGS) \ - $(UDEV_CFLAGS) \ - $(UUID_CFLAGS) \ - $(JSON_CFLAGS) - -AM_CFLAGS = ${my_CFLAGS} \ - -fvisibility=hidden \ - -ffunction-sections \ - -fdata-sections - -AM_LDFLAGS = \ - -Wl,--gc-sections \ - -Wl,--as-needed - -SED_PROCESS = \ - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ - -e 's,@VERSION\@,$(VERSION),g' \ - -e 's,@prefix\@,$(prefix),g' \ - -e 's,@exec_prefix\@,$(exec_prefix),g' \ - -e 's,@libdir\@,$(libdir),g' \ - -e 's,@includedir\@,$(includedir),g' \ - < $< > $@ || rm $@ - -LIBNDCTL_CURRENT=26 -LIBNDCTL_REVISION=1 -LIBNDCTL_AGE=20 - -LIBDAXCTL_CURRENT=7 -LIBDAXCTL_REVISION=0 -LIBDAXCTL_AGE=6 - -LIBCXL_CURRENT=1 -LIBCXL_REVISION=0 -LIBCXL_AGE=0 diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 2a52688bb403..000000000000 --- a/autogen.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -e - -if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then - cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \ - chmod +x .git/hooks/pre-commit && \ - echo "Activated pre-commit hook." -fi - -$(dirname $0)/git-version-gen -reconf_args='' -[ -n "$*" ] && reconf_args="$*" -autoreconf --install --symlink $reconf_args - -libdir() { - echo $(cd $1/$(gcc -print-multi-os-directory); pwd) -} - -args="--prefix=/usr \ ---sysconfdir=/etc \ ---libdir=$(libdir /usr/lib)" - -echo -echo "----------------------------------------------------------------" -echo "Initialized build system. For a common configuration please run:" -echo "----------------------------------------------------------------" -echo -echo "./configure CFLAGS='-g -O2' $args" -echo diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 1b18ed755c98..000000000000 --- a/configure.ac +++ /dev/null @@ -1,270 +0,0 @@ -AC_PREREQ(2.60) -m4_include([version.m4]) -AC_INIT([ndctl], - GIT_VERSION, - [nvdimm@lists.linux.dev], - [ndctl], - [https://github.com/pmem/ndctl]) -AC_CONFIG_SRCDIR([ndctl/lib/libndctl.c]) -AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([ - foreign - 1.11 - -Wall - -Wno-portability - silent-rules - tar-pax - no-dist-gzip - dist-xz - subdir-objects -]) -AC_PROG_CC_STDC -AC_USE_SYSTEM_EXTENSIONS -AC_SYS_LARGEFILE -AC_CONFIG_MACRO_DIR([m4]) -AM_SILENT_RULES([yes]) -LT_INIT([ - disable-static - pic-only -]) -AC_PREFIX_DEFAULT([/usr]) - -AC_PROG_SED -AC_PROG_MKDIR_P -AC_PROG_LN_S - -AC_ARG_ENABLE([docs], - AS_HELP_STRING([--disable-docs], - [disable documentation build @<:@default=enabled@:>@]), - [], enable_docs=yes) -AS_IF([test "x$enable_docs" = "xyes"], [ - AC_DEFINE(ENABLE_DOCS, [1], [Documentation / man pages.]) -]) -AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" = "xyes"]) - -AC_ARG_ENABLE([asciidoctor], - AS_HELP_STRING([--enable-asciidoctor], - [use asciidoctor for documentation build]), - [], enable_asciidoctor=yes) -AM_CONDITIONAL([USE_ASCIIDOCTOR], [test "x$enable_asciidoctor" = "xyes"]) -if test "x$enable_asciidoctor" = "xyes"; then - asciidoc="asciidoctor" -else - asciidoc="asciidoc" -fi -AC_CHECK_PROG(ASCIIDOC, [$asciidoc], [$(which $asciidoc)], [missing]) -if test "x$ASCIIDOC" = xmissing -a "x$enable_docs" = "xyes"; then - AC_MSG_ERROR([$asciidoc needed to build documentation]) -fi -AC_SUBST([ASCIIDOC]) - -if test x"$asciidoc" = x"asciidoc"; then -AC_CHECK_PROG(XMLTO, [xmlto], [$(which xmlto)], [missing]) -if test "x$XMLTO" = xmissing -a "x$enable_docs" = "xyes"; then - AC_MSG_ERROR([xmlto needed to build documentation]) -fi -AC_SUBST([XMLTO]) -fi - -AC_C_TYPEOF -AC_DEFINE([HAVE_STATEMENT_EXPR], 1, [Define to 1 if you have statement expressions.]) - -AC_C_BIGENDIAN( - AC_DEFINE(HAVE_BIG_ENDIAN, 1, [Define to 1 if big-endian-arch]), - AC_DEFINE(HAVE_LITTLE_ENDIAN, 1, [Define to 1 if little-endian-arch]), - [], []) - -AC_ARG_ENABLE([logging], - AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), - [], enable_logging=yes) -AS_IF([test "x$enable_logging" = "xyes"], [ - AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) -]) - -AC_ARG_ENABLE([debug], - AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), - [], [enable_debug=no]) -AS_IF([test "x$enable_debug" = "xyes"], [ - AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) -]) - -AC_ARG_ENABLE([destructive], - AS_HELP_STRING([--enable-destructive], [enable destructive functional tests @<:@default=disabled@:>@]), - [], [enable_destructive=no]) -AS_IF([test "x$enable_destructive" = "xyes"], - [AC_DEFINE([ENABLE_DESTRUCTIVE], [1], [destructive functional tests support])]) -AM_CONDITIONAL([ENABLE_DESTRUCTIVE], [test "x$enable_destructive" = "xyes"]) - -AC_ARG_ENABLE([test], - AS_HELP_STRING([--enable-test], [enable ndctl test command @<:@default=disabled@:>@]), - [], [enable_test=$enable_destructive]) -AS_IF([test "x$enable_test" = "xyes"], - [AC_DEFINE([ENABLE_TEST], [1], [ndctl test support])]) -AM_CONDITIONAL([ENABLE_TEST], [test "x$enable_test" = "xyes"]) - -AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_bus_mc_err=yes], [], [[#include ]]) -AC_CHECK_DECLS([MAP_SHARED_VALIDATE], [kernel_map_shared_validate=yes], [], [[#include ]]) -AC_CHECK_DECLS([MAP_SYNC], [kernel_map_sync=yes], [], [[#include ]]) -AS_UNSET([ac_cv_have_decl_MAP_SHARED_VALIDATE]) -AS_UNSET([ac_cv_have_decl_MAP_SYNC]) -AC_CHECK_DECLS([MAP_SHARED_VALIDATE], [enable_map_shared_validate=yes], [], [[#include ]]) -AC_CHECK_DECLS([MAP_SYNC], [enable_map_sync=yes], [], [[#include ]]) - -if test "x$kernel_map_shared_validate" = "xyes" -a "x$enable_map_shared_validate" != "xyes" ; then - AC_MSG_WARN([MAP_SHARED_VALIDATE supported by kernel but not by , consider installing glibc-2.28 or later.]) -fi -if test "x$kernel_map_shared_validate" != "xyes" -a "x$enable_map_shared_validate" != "xyes" ; then - AC_MSG_WARN([MAP_SHARED_VALIDATE not supported by kernel, consider installing kernel-4.15 or later.]) -fi -if test "x$kernel_map_sync" = "xyes" -a "x$enable_map_sync" != "xyes" ; then - AC_MSG_WARN([MAP_SYNC supported by kernel but not by , consider installing glibc-2.28 or later.]) -fi -if test "x$kernel_map_sync" != "xyes" -a "x$enable_map_sync" != "xyes" ; then - AC_MSG_WARN([MAP_SYNC not supported by kernel or architecture, consider installing kernel-4.15 or later.]) -fi - -AS_IF([test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes" -a "x$enable_map_shared_validate" = "xyes"], - [AC_DEFINE([ENABLE_POISON], [1], [ndctl test poison support])]) -AM_CONDITIONAL([ENABLE_POISON], - [test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes" -a "x$enable_map_shared_validate" = "xyes"]) - -PKG_CHECK_MODULES([KMOD], [libkmod]) -PKG_CHECK_MODULES([UDEV], [libudev]) -PKG_CHECK_MODULES([UUID], [uuid], - [AC_DEFINE([HAVE_UUID], [1], [Define to 1 if using libuuid])]) -PKG_CHECK_MODULES([JSON], [json-c]) - -AC_ARG_WITH([bash], - AS_HELP_STRING([--with-bash], - [Enable bash auto-completion. @<:@default=yes@:>@]), - [], - [with_bash=yes]) - -if test "x$with_bash" = "xyes"; then - PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], - [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)], []) -fi - -AC_SUBST([BASH_COMPLETION_DIR]) -AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash" = "xyes"]) - -AC_ARG_ENABLE([local], - AS_HELP_STRING([--disable-local], [build against kernel ndctl.h @<:@default=system@:>@]), - [], [enable_local=yes]) - -AC_CHECK_HEADERS_ONCE([linux/version.h]) - -AC_CHECK_FUNCS([ \ - __secure_getenv \ - secure_getenv\ -]) - -AC_ARG_WITH([systemd], - AS_HELP_STRING([--with-systemd], - [Enable systemd functionality. @<:@default=yes@:>@]), - [], [with_systemd=yes]) - -if test "x$with_systemd" = "xyes"; then - PKG_CHECK_MODULES([SYSTEMD], [systemd], - [systemd_unitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)], []) -fi - -AC_SUBST([systemd_unitdir]) -AM_CONDITIONAL([ENABLE_SYSTEMD_UNITS], [test "x$with_systemd" = "xyes"]) - -ndctl_confdir=${sysconfdir}/ndctl.conf.d -ndctl_conf=ndctl.conf -ndctl_monitorconf=monitor.conf -AC_SUBST([ndctl_confdir]) -AC_SUBST([ndctl_conf]) -AC_SUBST([ndctl_monitorconf]) - -daxctl_confdir=${sysconfdir}/daxctl.conf.d -AC_SUBST([daxctl_confdir]) - -daxctl_modprobe_datadir=${datadir}/daxctl -daxctl_modprobe_data=daxctl.conf -AC_SUBST([daxctl_modprobe_datadir]) -AC_SUBST([daxctl_modprobe_data]) - -AC_ARG_WITH(udevrulesdir, - [AS_HELP_STRING([--with-udevrulesdir=DIR], [udev rules.d directory])], - [UDEVRULESDIR="$withval"], - [UDEVRULESDIR='${prefix}/lib/udev/rules.d'] -) -AC_SUBST(UDEVRULESDIR) - -AC_ARG_WITH([keyutils], - AS_HELP_STRING([--with-keyutils], - [Enable keyutils functionality (security). @<:@default=yes@:>@]), [], [with_keyutils=yes]) - -if test "x$with_keyutils" = "xyes"; then - AC_CHECK_HEADERS([keyutils.h],,[ - AC_MSG_ERROR([keyutils.h not found, consider installing the keyutils library development package (variously named keyutils-libs-devel, keyutils-devel, or libkeyutils-dev).]) - ]) -fi -AS_IF([test "x$with_keyutils" = "xyes"], - [AC_DEFINE([ENABLE_KEYUTILS], [1], [Enable keyutils support])]) -AM_CONDITIONAL([ENABLE_KEYUTILS], [test "x$with_keyutils" = "xyes"]) - -ndctl_keysdir=${sysconfdir}/ndctl/keys -ndctl_keysreadme=keys.readme -AC_SUBST([ndctl_keysdir]) -AC_SUBST([ndctl_keysreadme]) - -AC_CHECK_HEADERS([iniparser.h],,[ - AC_MSG_ERROR([iniparser.h not found, install iniparser-devel, libiniparser-dev, or so]) - ]) - -my_CFLAGS="\ --Wall \ --Wchar-subscripts \ --Wformat-security \ --Wmissing-declarations \ --Wmissing-prototypes \ --Wnested-externs \ --Wshadow \ --Wsign-compare \ --Wstrict-prototypes \ --Wtype-limits \ --Wmaybe-uninitialized \ --Wdeclaration-after-statement \ --Wunused-result \ --D_FORTIFY_SOURCE=2 \ --O2 -" -AC_SUBST([my_CFLAGS]) - -AC_CONFIG_HEADERS(config.h) -AC_CONFIG_FILES([ - Makefile - daxctl/lib/Makefile - cxl/lib/Makefile - ndctl/lib/Makefile - ndctl/Makefile - daxctl/Makefile - cxl/Makefile - test/Makefile - Documentation/ndctl/Makefile - Documentation/daxctl/Makefile - Documentation/cxl/Makefile - Documentation/cxl/lib/Makefile -]) - -AC_OUTPUT -AC_MSG_RESULT([ - $PACKAGE $VERSION - ===== - - prefix: ${prefix} - sysconfdir: ${sysconfdir} - libdir: ${libdir} - includedir: ${includedir} - - compiler: ${CC} - cflags: ${CFLAGS} - ldflags: ${LDFLAGS} - - logging: ${enable_logging} - debug: ${enable_debug} -]) diff --git a/cxl/Makefile.am b/cxl/Makefile.am deleted file mode 100644 index ee8488900a3b..000000000000 --- a/cxl/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -bin_PROGRAMS = cxl - -DISTCLEANFILES = config.h -BUILT_SOURCES = config.h -config.h: $(srcdir)/Makefile.am - $(AM_V_GEN) echo "/* Autogenerated by cxl/Makefile.am */" >$@ - -cxl_SOURCES =\ - cxl.c \ - list.c \ - memdev.c \ - ../util/json.c \ - json.c \ - filter.c \ - filter.h \ - builtin.h - -cxl_LDADD =\ - lib/libcxl.la \ - ../libutil.a \ - $(UUID_LIBS) \ - $(KMOD_LIBS) \ - $(JSON_LIBS) diff --git a/cxl/lib/Makefile.am b/cxl/lib/Makefile.am deleted file mode 100644 index 72c9ccdc3c49..000000000000 --- a/cxl/lib/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -%.pc: %.pc.in Makefile - $(SED_PROCESS) - -pkginclude_HEADERS = ../libcxl.h ../cxl_mem.h -lib_LTLIBRARIES = libcxl.la - -libcxl_la_SOURCES =\ - ../libcxl.h \ - private.h \ - ../../util/sysfs.c \ - ../../util/sysfs.h \ - ../../util/log.c \ - ../../util/log.h \ - libcxl.c - -libcxl_la_LIBADD =\ - $(UUID_LIBS) \ - $(KMOD_LIBS) - -EXTRA_DIST += libcxl.sym - -libcxl_la_LDFLAGS = $(AM_LDFLAGS) \ - -version-info $(LIBCXL_CURRENT):$(LIBCXL_REVISION):$(LIBCXL_AGE) \ - -Wl,--version-script=$(top_srcdir)/cxl/lib/libcxl.sym -libcxl_la_DEPENDENCIES = libcxl.sym - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libcxl.pc -EXTRA_DIST += libcxl.pc.in -CLEANFILES += libcxl.pc diff --git a/daxctl/Makefile.am b/daxctl/Makefile.am deleted file mode 100644 index bbf764f8081f..000000000000 --- a/daxctl/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -bin_PROGRAMS = daxctl - -DISTCLEANFILES = config.h -BUILT_SOURCES = config.h -config.h: $(srcdir)/Makefile.am - $(AM_V_GEN) echo "/* Autogenerated by daxctl/Makefile.am */" >$@ && \ - echo '#define DAXCTL_MODPROBE_DATA \ - "$(daxctl_modprobe_datadir)/$(daxctl_modprobe_data)"' >>$@ && \ - echo '#define DAXCTL_MODPROBE_INSTALL \ - "$(sysconfdir)/modprobe.d/$(daxctl_modprobe_data)"' >>$@ - -daxctl_SOURCES =\ - daxctl.c \ - acpi.c \ - list.c \ - migrate.c \ - device.c \ - ../util/json.c \ - ../util/json.h \ - json.c \ - json.h \ - filter.c \ - filter.h \ - builtin.h - -daxctl_LDADD =\ - lib/libdaxctl.la \ - ../ndctl/lib/libndctl.la \ - ../libutil.a \ - $(UUID_LIBS) \ - $(KMOD_LIBS) \ - $(JSON_LIBS) \ - -liniparser - -udevrulesdir = $(UDEVRULESDIR) -udevrules_DATA = 90-daxctl-device.rules - -daxctl_configdir = $(daxctl_confdir) -daxctl_config_DATA = daxctl.example.conf - -if ENABLE_SYSTEMD_UNITS -systemd_unit_DATA = daxdev-reconfigure@.service -endif diff --git a/daxctl/lib/Makefile.am b/daxctl/lib/Makefile.am deleted file mode 100644 index 3c47a4bbe580..000000000000 --- a/daxctl/lib/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -%.pc: %.pc.in Makefile - $(SED_PROCESS) - -DISTCLEANFILES = config.h -BUILT_SOURCES = config.h -config.h: $(srcdir)/Makefile.am - $(AM_V_GEN) echo "/* Autogenerated by daxctl/Makefile.am */" >$@ && \ - echo '#define DAXCTL_CONF_DIR "$(daxctl_confdir)"' >>$@ - -pkginclude_HEADERS = ../libdaxctl.h -lib_LTLIBRARIES = libdaxctl.la - -libdaxctl_la_SOURCES =\ - ../libdaxctl.h \ - libdaxctl-private.h \ - ../../util/iomem.c \ - ../../util/iomem.h \ - ../../util/sysfs.c \ - ../../util/sysfs.h \ - ../../util/log.c \ - ../../util/log.h \ - libdaxctl.c - -libdaxctl_la_LIBADD =\ - $(UUID_LIBS) \ - $(KMOD_LIBS) - -daxctl_modprobe_data_DATA = daxctl.conf - -EXTRA_DIST += libdaxctl.sym daxctl.conf - -libdaxctl_la_LDFLAGS = $(AM_LDFLAGS) \ - -version-info $(LIBDAXCTL_CURRENT):$(LIBDAXCTL_REVISION):$(LIBDAXCTL_AGE) \ - -Wl,--version-script=$(top_srcdir)/daxctl/lib/libdaxctl.sym -libdaxctl_la_DEPENDENCIES = libdaxctl.sym - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libdaxctl.pc -EXTRA_DIST += libdaxctl.pc.in -CLEANFILES += libdaxctl.pc diff --git a/ndctl.spec.in b/ndctl.spec.in index 9447267839d2..7e838f4bf199 100644 --- a/ndctl.spec.in +++ b/ndctl.spec.in @@ -6,21 +6,16 @@ License: GPLv2 Url: https://github.com/pmem/ndctl Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -%define with_meson MESON Requires: LNAME%{?_isa} = %{version}-%{release} Requires: DAX_LNAME%{?_isa} = %{version}-%{release} Requires: CXL_LNAME%{?_isa} = %{version}-%{release} BuildRequires: autoconf %if 0%{?rhel} < 9 BuildRequires: asciidoc -%if !%{with_meson} -%define asciidoc --disable-asciidoctor -%endif +%define asciidoctor -Dasciidoctor=disabled %else -%if %{with_meson} -%define asciidoctor -Dasciidoctor=enabled -%endif BuildRequires: rubygem-asciidoctor +%define asciidoctor -Dasciidoctor=enabled %endif BuildRequires: xmlto BuildRequires: automake @@ -35,10 +30,7 @@ BuildRequires: pkgconfig(systemd) BuildRequires: keyutils-libs-devel BuildRequires: systemd-rpm-macros BuildRequires: iniparser-devel - -%if %{with_meson} BuildRequires: meson -%endif %description Utility library for managing the "libnvdimm" subsystem. The "libnvdimm" @@ -127,30 +119,14 @@ libcxl is a library for enumerating and communicating with CXL devices. %setup -q ndctl-%{version} %build -%if %{with_meson} %meson %{?asciidoctor} -Dversion-tag=%{version} %meson_build -%else -echo %{version} > version -./autogen.sh -%configure --disable-static --disable-silent-rules %{?asciidoc} -make %{?_smp_mflags} -%endif %install -%if %{with_meson} %meson_install -%else -%make_install -find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' -%endif %check -%if %{with_meson} %meson_test -%else -make check -%endif %ldconfig_scriptlets -n LNAME diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am deleted file mode 100644 index 5d5b1cacda9d..000000000000 --- a/ndctl/Makefile.am +++ /dev/null @@ -1,86 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -bin_PROGRAMS = ndctl - -DISTCLEANFILES = config.h -BUILT_SOURCES = config.h -config.h: $(srcdir)/Makefile.am - $(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@ && \ - echo '#define NDCTL_CONF_FILE \ - "$(ndctl_confdir)/$(ndctl_monitorconf)"' >>$@ - $(AM_V_GEN) echo '#define NDCTL_KEYS_DIR "$(ndctl_keysdir)"' >>$@ - -ndctl_SOURCES = ndctl.c \ - builtin.h \ - bus.c \ - create-nfit.c \ - namespace.c \ - check.c \ - region.c \ - dimm.c \ - ../util/log.c \ - ../daxctl/filter.c \ - ../daxctl/filter.h \ - filter.c \ - filter.h \ - list.c \ - ../util/json.c \ - ../util/json.h \ - ../daxctl/json.c \ - ../daxctl/json.h \ - json.c \ - json.h \ - json-smart.c \ - keys.h \ - inject-error.c \ - inject-smart.c \ - monitor.c \ - namespace.h \ - action.h \ - ../nfit.h \ - ../test.h \ - firmware-update.h - -if ENABLE_KEYUTILS -ndctl_SOURCES += keys.c \ - load-keys.c -keys_configdir = $(ndctl_keysdir) -keys_config_DATA = $(ndctl_keysreadme) -endif - -EXTRA_DIST += keys.readme monitor.conf ndctl-monitor.service ndctl.conf - -if ENABLE_DESTRUCTIVE -ndctl_SOURCES += ../test/pmem_namespaces.c -ndctl_SOURCES += bat.c -endif - -ndctl_LDADD =\ - lib/libndctl.la \ - ../daxctl/lib/libdaxctl.la \ - ../libutil.a \ - $(UUID_LIBS) \ - $(KMOD_LIBS) \ - $(JSON_LIBS) \ - -liniparser - -if ENABLE_KEYUTILS -ndctl_LDADD += -lkeyutils -endif - -if ENABLE_TEST -ndctl_SOURCES += ../test/libndctl.c \ - ../test/dsm-fail.c \ - ../util/sysfs.c \ - ../test/core.c \ - test.c -endif - -ndctl_configdir = $(ndctl_confdir) -ndctl_config_DATA = $(ndctl_conf) -monitor_configdir = $(ndctl_confdir) -monitor_config_DATA = $(ndctl_monitorconf) - -if ENABLE_SYSTEMD_UNITS -systemd_unit_DATA = ndctl-monitor.service -endif diff --git a/ndctl/lib/Makefile.am b/ndctl/lib/Makefile.am deleted file mode 100644 index 0a52c01da347..000000000000 --- a/ndctl/lib/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -%.pc: %.pc.in Makefile - $(SED_PROCESS) - -DISTCLEANFILES = config.h -BUILT_SOURCES = config.h -config.h: $(srcdir)/Makefile.am - $(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@ && \ - echo '#define NDCTL_CONF_DIR "$(ndctl_confdir)"' >>$@ - -pkginclude_HEADERS = ../libndctl.h ../ndctl.h -lib_LTLIBRARIES = libndctl.la - -libndctl_la_SOURCES =\ - ../libndctl.h \ - private.h \ - ../../util/list.h \ - ../../util/log.c \ - ../../util/log.h \ - ../../util/sysfs.c \ - ../../util/sysfs.h \ - ../../util/fletcher.h \ - dimm.c \ - inject.c \ - nfit.c \ - smart.c \ - intel.c \ - hpe1.c \ - msft.c \ - hyperv.c \ - papr.c \ - ars.c \ - firmware.c \ - libndctl.c \ - intel.h \ - hpe1.h \ - msft.h \ - hyperv.h \ - ../../ndctl/libndctl-nfit.h - -libndctl_la_LIBADD =\ - ../../daxctl/lib/libdaxctl.la \ - $(UDEV_LIBS) \ - $(UUID_LIBS) \ - $(KMOD_LIBS) - -EXTRA_DIST += libndctl.sym - -libndctl_la_LDFLAGS = $(AM_LDFLAGS) \ - -version-info $(LIBNDCTL_CURRENT):$(LIBNDCTL_REVISION):$(LIBNDCTL_AGE) \ - -Wl,--version-script=$(top_srcdir)/ndctl/lib/libndctl.sym -libndctl_la_DEPENDENCIES = libndctl.sym - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libndctl.pc -EXTRA_DIST += libndctl.pc.in -CLEANFILES += libndctl.pc diff --git a/rhel/meson.build b/rhel/meson.build index 8672098d84e1..85b47bcd485a 100644 --- a/rhel/meson.build +++ b/rhel/meson.build @@ -7,8 +7,7 @@ rhel_spec1 = vcs_tag( rhel_spec2 = custom_target('ndctl.spec', command : [ - 'sed', '-e', 's,MESON,1,g', - '-e', 's,DAX_DNAME,daxctl-devel,g', + 'sed', '-e', 's,DAX_DNAME,daxctl-devel,g', '-e', 's,CXL_DNAME,cxl-devel,g', '-e', 's,DNAME,ndctl-devel,g', '-e', '/^%defattr.*/d', diff --git a/sles/meson.build b/sles/meson.build index 21c72cb4f5ec..8512774b6d20 100644 --- a/sles/meson.build +++ b/sles/meson.build @@ -18,8 +18,7 @@ sles_spec2 = custom_target('ndctl.spec.in', sles_spec3 = custom_target('ndctl.spec', command : [ - 'sed', '-e', 's,MESON,1,g', - '-e', 's,DAX_DNAME,libdaxctl-devel,g', + 'sed', '-e', 's,DAX_DNAME,libdaxctl-devel,g', '-e', 's,CXL_DNAME,libcxl-devel,g', '-e', 's,DNAME,libndctl-devel,g', '-e', 's,%license,%doc,g', diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index a2a4ee4a4335..000000000000 --- a/test/Makefile.am +++ /dev/null @@ -1,169 +0,0 @@ -include $(top_srcdir)/Makefile.am.in - -TESTS =\ - libndctl \ - dsm-fail \ - create.sh \ - clear.sh \ - pmem-errors.sh \ - daxdev-errors.sh \ - multi-dax.sh \ - btt-check.sh \ - label-compat.sh \ - sector-mode.sh \ - inject-error.sh \ - btt-errors.sh \ - hugetlb \ - btt-pad-compat.sh \ - firmware-update.sh \ - ack-shutdown-count-set \ - rescan-partitions.sh \ - inject-smart.sh \ - monitor.sh \ - max_available_extent_ns.sh \ - pfn-meta-errors.sh \ - track-uuid.sh - -EXTRA_DIST += $(TESTS) common \ - btt-pad-compat.xxd \ - nmem1.bin nmem2.bin nmem3.bin nmem4.bin - -check_PROGRAMS =\ - libndctl \ - dsm-fail \ - dax-errors \ - smart-notify \ - smart-listen \ - hugetlb \ - daxdev-errors \ - ack-shutdown-count-set \ - list-smart-dimm - -if ENABLE_DESTRUCTIVE -TESTS +=\ - pmem-ns \ - sub-section.sh \ - dax-dev \ - dax-ext4.sh \ - dax-xfs.sh \ - align.sh \ - device-dax \ - revoke-devmem \ - device-dax-fio.sh \ - daxctl-devices.sh \ - daxctl-create.sh \ - dm.sh \ - mmap.sh - -if ENABLE_KEYUTILS -TESTS += security.sh -endif - -check_PROGRAMS +=\ - pmem-ns \ - dax-dev \ - dax-pmd \ - device-dax \ - revoke-devmem \ - mmap -endif - -LIBNDCTL_LIB =\ - ../ndctl/lib/libndctl.la \ - ../daxctl/lib/libdaxctl.la - -testcore =\ - core.c \ - ../util/log.c \ - ../util/sysfs.c - -libndctl_SOURCES = libndctl.c $(testcore) -libndctl_LDADD = $(LIBNDCTL_LIB) $(UUID_LIBS) $(KMOD_LIBS) - -namespace_core =\ - ../ndctl/namespace.c \ - ../ndctl/filter.c \ - ../ndctl/check.c \ - ../util/json.c \ - ../ndctl/json.c \ - ../daxctl/filter.c \ - ../daxctl/json.c - -dsm_fail_SOURCES =\ - dsm-fail.c \ - $(testcore) \ - $(namespace_core) - -dsm_fail_LDADD = $(LIBNDCTL_LIB) \ - $(KMOD_LIBS) \ - $(JSON_LIBS) \ - $(UUID_LIBS) \ - ../libutil.a - -ack_shutdown_count_set_SOURCES =\ - ack-shutdown-count-set.c \ - $(testcore) - -ack_shutdown_count_set_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) - -pmem_ns_SOURCES = pmem_namespaces.c $(testcore) -pmem_ns_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) $(UUID_LIBS) - -dax_dev_SOURCES = dax-dev.c $(testcore) -dax_dev_LDADD = $(LIBNDCTL_LIB) $(KMOD_LIBS) - -dax_pmd_SOURCES = dax-pmd.c \ - $(testcore) - -hugetlb_SOURCES = hugetlb.c \ - dax-pmd.c - -mmap_SOURCES = mmap.c -dax_errors_SOURCES = dax-errors.c -daxdev_errors_SOURCES = daxdev-errors.c \ - ../util/log.c \ - ../util/sysfs.c -daxdev_errors_LDADD = $(LIBNDCTL_LIB) -device_dax_SOURCES = \ - device-dax.c \ - dax-dev.c \ - dax-pmd.c \ - $(testcore) \ - $(namespace_core) - -if ENABLE_POISON -dax_pmd_SOURCES += dax-poison.c -hugetlb_SOURCES += dax-poison.c -device_dax_SOURCES += dax-poison.c -endif - -device_dax_LDADD = \ - $(LIBNDCTL_LIB) \ - $(KMOD_LIBS) \ - $(JSON_LIBS) \ - $(UUID_LIBS) \ - ../libutil.a - -revoke_devmem_SOURCES = \ - revoke-devmem.c \ - dax-dev.c \ - $(testcore) - -revoke_devmem_LDADD = $(LIBNDCTL_LIB) - -smart_notify_SOURCES = smart-notify.c -smart_notify_LDADD = $(LIBNDCTL_LIB) -smart_listen_SOURCES = smart-listen.c -smart_listen_LDADD = $(LIBNDCTL_LIB) - -list_smart_dimm_SOURCES = \ - list-smart-dimm.c \ - ../ndctl/filter.c \ - ../util/json.c \ - ../ndctl/json.c - -list_smart_dimm_LDADD = \ - $(LIBNDCTL_LIB) \ - $(JSON_LIBS) \ - $(UUID_LIBS) \ - ../libutil.a