From patchwork Thu Mar 11 07:46:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Sivaraj X-Patchwork-Id: 12130557 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C0ECC433E0 for ; Thu, 11 Mar 2021 07:48:51 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 936A764FB6 for ; Thu, 11 Mar 2021 07:48:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 936A764FB6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E6A94100EBB86; Wed, 10 Mar 2021 23:48:49 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::633; helo=mail-pl1-x633.google.com; envelope-from=santosh@fossix.org; receiver= Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 87034100EC1CF for ; Wed, 10 Mar 2021 23:48:47 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id w7so6312170pll.8 for ; Wed, 10 Mar 2021 23:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mzqNvkUHxoue4dx77KS8Amr+l5ruh8G1Jw6Gyh8awu4=; b=H9eA4yzkYd0X8PaoIW46UnjUc7Fkh3WhYUkRWZn0qtURKkuvv3ydBneNDsTLWbF7Em vrWwcItgcCMJfPPyU5iKQJAOk+zI4q6HkfR4bZ35Qh6ghKuZOdwLqdwkKJDeDRkqc6h/ 9/FHn4FwD/glDWtgO75MLRNBQc3iQ/Ul9dMenv0Lk/OIjz3moLMsz7RICvZG0iXcP5bE R7OnC5uoOsJaIjxwA6flNsJTP4jFbuJSbLF04CwPesupSvaFLhuAnsUK99NUv92AFJVL XJ/o1v/sPkoR1xlvjdGLgv4Z7uQVilwVoBMHlpQ7/m64ZWJPOZn0wyvUBRfEZ5i9zZQ0 EHlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mzqNvkUHxoue4dx77KS8Amr+l5ruh8G1Jw6Gyh8awu4=; b=FQaHK9889N2Yuxfneb3B48pHpHDfYiqvltbEjwXIzUul+7EsAlIfhGlySWvMOOZtB1 8c3z4VKUmOIfg9EfXZF3K571y0AWQ+Jc1qfiFcHfbBYmbqa2PuUWMVzAUVGj7mUGu7By 9hyuSvpnv21bMh37YFzVvJ4BYm0oZxVkagNQD7TYVA4Cu6dPDXK4usy2hfBes2yo+A5I ZWI3o8SqDQlYBRZzBeGGBSK228zvo6yYcUhvYeJImXhhq7Bi1jQRT2k1jbNBPKu+/uAi Q/jF+KMYTjwXy6w3pBNsanwhJZ+F5w44v3h4Ooa5yE2Q9T2EA7+0SbEsoSgNkdDsakda Zwrg== X-Gm-Message-State: AOAM531eUbKfrHQPuYW6FZOXdWLzrkyzp7Aog1WjKdz56FZx6HuH8+YA L/UKPtPavg/oLhg7gnZYxLIdbD4NZA5Tww== X-Google-Smtp-Source: ABdhPJxM2Vs+GMkQA8mgb13+2x73hSg7f1RL6COqMPgDaQAmH7eLTCbbgZnsLtX+Ql+R1/0xMYjn4g== X-Received: by 2002:a17:90a:64c7:: with SMTP id i7mr7564116pjm.95.1615448926071; Wed, 10 Mar 2021 23:48:46 -0800 (PST) Received: from localhost.localdomain ([103.21.79.4]) by smtp.gmail.com with ESMTPSA id t13sm1528580pfe.161.2021.03.10.23.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 23:48:45 -0800 (PST) From: Santosh Sivaraj To: Linux NVDIMM , Vishal Verma , Vaibhav Jain , Shivaprasad G Bhat , Harish Sriram , Dan Williams Cc: Santosh Sivaraj Subject: [ndctl PATCH v3 1/4] libndctl: test enablement for non-nfit devices Date: Thu, 11 Mar 2021 13:16:49 +0530 Message-Id: <20210311074652.2783560-1-santosh@fossix.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Message-ID-Hash: N2RCNQEDLPYDBU4RW76EMQET6VYUW3XM X-Message-ID-Hash: N2RCNQEDLPYDBU4RW76EMQET6VYUW3XM X-MailFrom: santosh@fossix.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Unify adding dimms for papr and nfit families, this will help in adding all attributes needed for the unit tests too. We don't fail adding a dimm if some of the dimm attributes are missing, so this will work fine on PAPR platforms where most dimm attributes are provided. Signed-off-by: Santosh Sivaraj --- ndctl/lib/libndctl.c | 103 ++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 65 deletions(-) v3: * Drop patch which skips SMART tests, smart test enablement will be posted soon. v2: * Patch 2: Fix a bug, I skip erroring out if PAPR family, but condition had INTEL family instead. That change was there to test the same code on x86, but accidently committed. Now have a environment variable to force test PAPR family on x86. * Patch 4: Remove stray code, artifact of refactoring in patch 1. diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 36fb6fe..26b9317 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -1646,41 +1646,9 @@ static int ndctl_bind(struct ndctl_ctx *ctx, struct kmod_module *module, static int ndctl_unbind(struct ndctl_ctx *ctx, const char *devpath); static struct kmod_module *to_module(struct ndctl_ctx *ctx, const char *alias); -static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base) -{ - int rc = -ENODEV; - char buf[SYSFS_ATTR_SIZE]; - struct ndctl_ctx *ctx = dimm->bus->ctx; - char *path = calloc(1, strlen(dimm_base) + 100); - const char * const devname = ndctl_dimm_get_devname(dimm); - - dbg(ctx, "%s: Probing of_pmem dimm at %s\n", devname, dimm_base); - - if (!path) - return -ENOMEM; - - /* construct path to the papr compatible dimm flags file */ - sprintf(path, "%s/papr/flags", dimm_base); - - if (ndctl_bus_is_papr_scm(dimm->bus) && - sysfs_read_attr(ctx, path, buf) == 0) { - - dbg(ctx, "%s: Adding papr-scm dimm flags:\"%s\"\n", devname, buf); - dimm->cmd_family = NVDIMM_FAMILY_PAPR; - - /* Parse dimm flags */ - parse_papr_flags(dimm, buf); - - /* Allocate monitor mode fd */ - dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC); - rc = 0; - } - - free(path); - return rc; -} - -static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base) +static int populate_dimm_attributes(struct ndctl_dimm *dimm, + const char *dimm_base, + const char *bus_prefix) { int i, rc = -1; char buf[SYSFS_ATTR_SIZE]; @@ -1694,7 +1662,7 @@ static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base) * 'unique_id' may not be available on older kernels, so don't * fail if the read fails. */ - sprintf(path, "%s/nfit/id", dimm_base); + sprintf(path, "%s/%s/id", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) { unsigned int b[9]; @@ -1709,68 +1677,74 @@ static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base) } } - sprintf(path, "%s/nfit/handle", dimm_base); + sprintf(path, "%s/%s/handle", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) < 0) goto err_read; dimm->handle = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/phys_id", dimm_base); + sprintf(path, "%s/%s/phys_id", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) < 0) goto err_read; dimm->phys_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/serial", dimm_base); + sprintf(path, "%s/%s/serial", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->serial = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/vendor", dimm_base); + sprintf(path, "%s/%s/vendor", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->vendor_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/device", dimm_base); + sprintf(path, "%s/%s/device", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->device_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/rev_id", dimm_base); + sprintf(path, "%s/%s/rev_id", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->revision_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/dirty_shutdown", dimm_base); + sprintf(path, "%s/%s/dirty_shutdown", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->dirty_shutdown = strtoll(buf, NULL, 0); - sprintf(path, "%s/nfit/subsystem_vendor", dimm_base); + sprintf(path, "%s/%s/subsystem_vendor", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->subsystem_vendor_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/subsystem_device", dimm_base); + sprintf(path, "%s/%s/subsystem_device", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->subsystem_device_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/subsystem_rev_id", dimm_base); + sprintf(path, "%s/%s/subsystem_rev_id", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->subsystem_revision_id = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/family", dimm_base); + sprintf(path, "%s/%s/family", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->cmd_family = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/dsm_mask", dimm_base); + sprintf(path, "%s/%s/dsm_mask", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->nfit_dsm_mask = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/format", dimm_base); + sprintf(path, "%s/%s/format", dimm_base, bus_prefix); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->format[0] = strtoul(buf, NULL, 0); for (i = 1; i < dimm->formats; i++) { - sprintf(path, "%s/nfit/format%d", dimm_base, i); + sprintf(path, "%s/%s/format%d", dimm_base, bus_prefix, i); if (sysfs_read_attr(ctx, path, buf) == 0) dimm->format[i] = strtoul(buf, NULL, 0); } - sprintf(path, "%s/nfit/flags", dimm_base); - if (sysfs_read_attr(ctx, path, buf) == 0) - parse_nfit_mem_flags(dimm, buf); + sprintf(path, "%s/%s/flags", dimm_base, bus_prefix); + if (sysfs_read_attr(ctx, path, buf) == 0) { + if (ndctl_bus_has_nfit(dimm->bus)) + parse_nfit_mem_flags(dimm, buf); + else if (ndctl_bus_is_papr_scm(dimm->bus)) { + dimm->cmd_family = NVDIMM_FAMILY_PAPR; + parse_papr_flags(dimm, buf); + } + } dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC); rc = 0; @@ -1792,7 +1766,8 @@ static void *add_dimm(void *parent, int id, const char *dimm_base) if (!path) return NULL; - sprintf(path, "%s/nfit/formats", dimm_base); + sprintf(path, "%s/%s/formats", dimm_base, + ndctl_bus_has_nfit(bus) ? "nfit" : "papr"); if (sysfs_read_attr(ctx, path, buf) < 0) formats = 1; else @@ -1866,13 +1841,12 @@ static void *add_dimm(void *parent, int id, const char *dimm_base) else dimm->fwa_result = fwa_result_to_result(buf); + dimm->formats = formats; /* Check if the given dimm supports nfit */ if (ndctl_bus_has_nfit(bus)) { - dimm->formats = formats; - rc = add_nfit_dimm(dimm, dimm_base); - } else if (ndctl_bus_has_of_node(bus)) { - rc = add_papr_dimm(dimm, dimm_base); - } + rc = populate_dimm_attributes(dimm, dimm_base, "nfit"); + } else if (ndctl_bus_has_of_node(bus)) + rc = populate_dimm_attributes(dimm, dimm_base, "papr"); if (rc == -ENODEV) { /* Unprobed dimm with no family */ @@ -2531,13 +2505,12 @@ static void *add_region(void *parent, int id, const char *region_base) goto err_read; region->num_mappings = strtoul(buf, NULL, 0); - sprintf(path, "%s/nfit/range_index", region_base); - if (ndctl_bus_has_nfit(bus)) { - if (sysfs_read_attr(ctx, path, buf) < 0) - goto err_read; - region->range_index = strtoul(buf, NULL, 0); - } else + sprintf(path, "%s/%s/range_index", region_base, + ndctl_bus_has_nfit(bus) ? "nfit": "papr"); + if (sysfs_read_attr(ctx, path, buf) < 0) region->range_index = -1; + else + region->range_index = strtoul(buf, NULL, 0); sprintf(path, "%s/read_only", region_base); if (sysfs_read_attr(ctx, path, buf) < 0) From patchwork Thu Mar 11 07:46:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Sivaraj X-Patchwork-Id: 12130559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 958C7C433DB for ; Thu, 11 Mar 2021 07:48:54 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C91664FB6 for ; Thu, 11 Mar 2021 07:48:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C91664FB6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1D702100F225C; Wed, 10 Mar 2021 23:48:53 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::52b; helo=mail-pg1-x52b.google.com; envelope-from=santosh@fossix.org; receiver= Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 26114100F2253 for ; Wed, 10 Mar 2021 23:48:50 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id p21so13149558pgl.12 for ; Wed, 10 Mar 2021 23:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XsQcKFUHnT+e9tJa0fXwky3kSM9G3uLObTgz2UIALwk=; b=AvdIe/kWIezhiWgSUf57lcmHUxPzAiaz4Z3Xq/pWDSv97BlTd4BeuGUCeKjfGCiPPY T1UmgtDv2Q/w3Ps94CBXH/k7AY/3ITV6jgyYllaLk0Te4Jvh3vISZSOdW3RLVVhx3UE0 108DDX3N24MgxdLSSb3kh1qA22VKi0lQLWh84EU38P+89wc/yoqjOismItkwjxEvH0K3 L97GJupMmmugxYw84cG5n/SzeDpLHPRS2OMsuMbvDuanjckb9wMlwtJASUQcff2B7Not Ts4zWjueYpHG+vOef4/wsGHubORinJRtpmDekoGlEEBPzDYEI6ZKlAK9/BPDlBeQ08Uz qPFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XsQcKFUHnT+e9tJa0fXwky3kSM9G3uLObTgz2UIALwk=; b=Fh5ojQ0AuPfe+DXDjYV5QAuYHpqQK9IajZOLK1fXSG0AZe0RkxlkXECH3Wz2wHpIfP H1P8aqQKVSdK0yZLlxRJCPKdh93pxATVIfwUkHJx6FwtSc4L0aPcTy+avmPwMpu0TnvN XnrOrlXjUO/Pa3sC0+toRDnStu5dDTM94kEvbEyNM+E06fjEwv3zxQVOFi6deMJ9s1RA SOb4Rwuj3VlY1XtPw1wbKv4/dq11KzsY0iB+he0RfAWhtKuMLapxsvJhBa+qlLEDxbOE jrsHx9f7mvWCBPs2Cr4QfV0j3hCLBRAjD7zz8kYR/4VCAtjQvKDMRLTrS/nvKxUCifaD 5roA== X-Gm-Message-State: AOAM533ZJBf72CScC70SgK0eSvlcNxDuuKOpwI3gVtI+FcxY2+e8PvDO bBc919Fiimoi4VD+ZM2aGhfJoMTljfUcbQ== X-Google-Smtp-Source: ABdhPJymRBfngJh1VcdJks100AnzJn/Abb9rnuT9j+lTx9JTai45Jco5aj+Cy1JCKwGWEw+VtG+0ZQ== X-Received: by 2002:a63:1a51:: with SMTP id a17mr3299588pgm.125.1615448929326; Wed, 10 Mar 2021 23:48:49 -0800 (PST) Received: from localhost.localdomain ([103.21.79.4]) by smtp.gmail.com with ESMTPSA id t13sm1528580pfe.161.2021.03.10.23.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 23:48:49 -0800 (PST) From: Santosh Sivaraj To: Linux NVDIMM , Vishal Verma , Vaibhav Jain , Shivaprasad G Bhat , Harish Sriram , Dan Williams Cc: Santosh Sivaraj Subject: [ndctl PATCH v3 2/4] test: Don't skip tests if nfit modules are missing Date: Thu, 11 Mar 2021 13:16:50 +0530 Message-Id: <20210311074652.2783560-2-santosh@fossix.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311074652.2783560-1-santosh@fossix.org> References: <20210311074652.2783560-1-santosh@fossix.org> MIME-Version: 1.0 Message-ID-Hash: MM6IKZTY75SV4PAYKOGZFGCUAFPBTZ6X X-Message-ID-Hash: MM6IKZTY75SV4PAYKOGZFGCUAFPBTZ6X X-MailFrom: santosh@fossix.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: For NFIT to be available ACPI is a must, so don't fail when nfit modules are missing on a platform that doesn't support ACPI. Signed-off-by: Santosh Sivaraj --- test.h | 2 +- test/ack-shutdown-count-set.c | 2 +- test/blk_namespaces.c | 2 +- test/core.c | 23 +++++++++++++++++++++-- test/dpa-alloc.c | 2 +- test/dsm-fail.c | 2 +- test/libndctl.c | 2 +- test/multi-pmem.c | 2 +- test/parent-uuid.c | 2 +- test/pmem_namespaces.c | 2 +- 10 files changed, 30 insertions(+), 11 deletions(-) diff --git a/test.h b/test.h index cba8d41..7de13fe 100644 --- a/test.h +++ b/test.h @@ -20,7 +20,7 @@ void builtin_xaction_namespace_reset(void); struct kmod_ctx; struct kmod_module; -int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, +int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, struct ndctl_ctx *nd_ctx, int log_level, struct ndctl_test *test); diff --git a/test/ack-shutdown-count-set.c b/test/ack-shutdown-count-set.c index fb1d82b..c561ff3 100644 --- a/test/ack-shutdown-count-set.c +++ b/test/ack-shutdown-count-set.c @@ -99,7 +99,7 @@ static int test_ack_shutdown_count_set(int loglevel, struct ndctl_test *test, int result = EXIT_FAILURE, err; ndctl_set_log_priority(ctx, loglevel); - err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test); + err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test); if (err < 0) { result = 77; ndctl_test_skip(test); diff --git a/test/blk_namespaces.c b/test/blk_namespaces.c index d7f00cb..f076e85 100644 --- a/test/blk_namespaces.c +++ b/test/blk_namespaces.c @@ -228,7 +228,7 @@ int test_blk_namespaces(int log_level, struct ndctl_test *test, if (!bus) { fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n"); - rc = nfit_test_init(&kmod_ctx, &mod, NULL, log_level, test); + 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) { diff --git a/test/core.c b/test/core.c index cc7d8d9..903034a 100644 --- a/test/core.c +++ b/test/core.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #define KVER_STRLEN 20 @@ -106,11 +107,11 @@ int ndctl_test_get_skipped(struct ndctl_test *test) return test->skip; } -int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, +int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, struct ndctl_ctx *nd_ctx, int log_level, struct ndctl_test *test) { - int rc; + int rc, family = NVDIMM_FAMILY_INTEL; unsigned int i; const char *name; struct ndctl_bus *bus; @@ -127,6 +128,19 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod, "nd_e820", "nd_pmem", }; + char *test_env; + + /* Do we want to force test PAPR? */ + test_env = getenv("NDCTL_TEST_FAMILY"); + if (test_env && strcmp(test_env, "PAPR") == 0) + family = NVDIMM_FAMILY_PAPR; + + /* ACPI is a must for nfit, so if ACPI is not available let's default to + * PAPR */ + if (access("/sys/bus/acpi", F_OK) == -1) { + if (errno == ENOENT) + family = NVDIMM_FAMILY_PAPR; + } log_init(&log_ctx, "test/init", "NDCTL_TEST"); log_ctx.log_priority = log_level; @@ -185,6 +199,11 @@ retry: path = kmod_module_get_path(*mod); if (!path) { + if (family == NVDIMM_FAMILY_PAPR && + (strcmp(name, "nfit") == 0 || + strcmp(name, "nd_e820") == 0)) + continue; + log_err(&log_ctx, "%s.ko: failed to get path\n", name); break; } diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c index e922009..0b3bb7a 100644 --- a/test/dpa-alloc.c +++ b/test/dpa-alloc.c @@ -289,7 +289,7 @@ int test_dpa_alloc(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) return 77; ndctl_set_log_priority(ctx, loglevel); - err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test); + 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"); diff --git a/test/dsm-fail.c b/test/dsm-fail.c index 9dfd8b0..0a6383d 100644 --- a/test/dsm-fail.c +++ b/test/dsm-fail.c @@ -346,7 +346,7 @@ int test_dsm_fail(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) int result = EXIT_FAILURE, err; ndctl_set_log_priority(ctx, loglevel); - err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test); + err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test); if (err < 0) { result = 77; ndctl_test_skip(test); diff --git a/test/libndctl.c b/test/libndctl.c index 24d72b3..0e88fce 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -2692,7 +2692,7 @@ int test_libndctl(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx) daxctl_set_log_priority(daxctl_ctx, loglevel); ndctl_set_private_data(ctx, test); - err = nfit_test_init(&kmod_ctx, &mod, ctx, loglevel, test); + err = ndctl_test_init(&kmod_ctx, &mod, ctx, loglevel, test); if (err < 0) { ndctl_test_skip(test); fprintf(stderr, "nfit_test unavailable skipping tests\n"); diff --git a/test/multi-pmem.c b/test/multi-pmem.c index 3d10952..3ea08cc 100644 --- a/test/multi-pmem.c +++ b/test/multi-pmem.c @@ -249,7 +249,7 @@ int test_multi_pmem(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx ndctl_set_log_priority(ctx, loglevel); - err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test); + err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test); if (err < 0) { result = 77; ndctl_test_skip(test); diff --git a/test/parent-uuid.c b/test/parent-uuid.c index 6424e9f..bded33a 100644 --- a/test/parent-uuid.c +++ b/test/parent-uuid.c @@ -218,7 +218,7 @@ int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ct return 77; ndctl_set_log_priority(ctx, loglevel); - err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test); + 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"); diff --git a/test/pmem_namespaces.c b/test/pmem_namespaces.c index f0f2edd..a4db1ae 100644 --- a/test/pmem_namespaces.c +++ b/test/pmem_namespaces.c @@ -191,7 +191,7 @@ int test_pmem_namespaces(int log_level, struct ndctl_test *test, if (!bus) { fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n"); - rc = nfit_test_init(&kmod_ctx, &mod, NULL, log_level, test); + 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) { From patchwork Thu Mar 11 07:46:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Sivaraj X-Patchwork-Id: 12130561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06229C433E6 for ; Thu, 11 Mar 2021 07:48:55 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B18264F74 for ; Thu, 11 Mar 2021 07:48:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B18264F74 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3235E100F225D; Wed, 10 Mar 2021 23:48:54 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.google.com; envelope-from=santosh@fossix.org; receiver= Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 71508100F2255 for ; Wed, 10 Mar 2021 23:48:52 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id lr10-20020a17090b4b8ab02900dd61b95c5eso6400179pjb.4 for ; Wed, 10 Mar 2021 23:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AJyJaAot47MG4PJfNO9pFZfOa0ecfqouA9e2QJYVsEA=; b=kmpgBSqF9Su/0kICrfwjIRWT/Mk+5hjQgjmug9xNRa7yRlWcHoVz22Mxetr42aDlNk LAeDjwek7eYBhoOLkidLUVaDYr9LqYNfzwGLop4D0HmgO4q7jWlnGR4cVIQeNzMyadi2 o6379Tl870Bp6Voc7CFu6nq2jtXM3ddvIQNnZBL6bfTp9T4b4uRF76hkdNhB2rtOlTAQ KYFp4Zv1G1dxsk9XZDqHaJFRkvSOHoH6uXX7dtY6ruxXb4h2dIuzurwQP7eOqLpgQ7Eh 6bGJzb/YqOgDRg/6dp1eAI5VdspzuX5DOTbUBv5TANZNSBxlSY+f0JsaKNvw8IUJGOTb k1Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AJyJaAot47MG4PJfNO9pFZfOa0ecfqouA9e2QJYVsEA=; b=NkPifo5HmX9bjkNKQtLSsjz4kiNfkHnAaf/y57TDdMAEUDFMapWWineLqzr2HuVoDX pEv+qLMdftA6gPjieitcJ4I3rzK7y25JoPcIODaeJKpjMC4Ln81NwFGrS1PvRZbQCyZJ mJFzFh/Ht7NJVRmyEARAP5Uv+nDwXD7arO4F3geyiGIUNKKUIt8N1blYGvCPbUGxhKYO +XXIlokqTa8/sav9LPTp0Mia3iCrDyfEsInnVJqyIDaLtIXTakolQvjjzj1i5crIyAVt 8PyN4E6pMv76bSvpQgs/PPAaFLpaFy7gmrJkalMapfNiWhxCrRPd/U/9Z3+UQ93lZSis ZQrg== X-Gm-Message-State: AOAM530dLgBFJP0um6ZngpttBUswNp0Qi++oLw88pSVeIOpKmoNPFf0U yWKKobzO2MI2Q3/Uz0pwvhNevBC7F/heMw== X-Google-Smtp-Source: ABdhPJzWSHlh1fktG0IoI+9L7+/sL6V9ukGX9fFb6ZhQxtam/7zIPotZwMp17efhijE8Lb8i4QBk1g== X-Received: by 2002:a17:90a:ce92:: with SMTP id g18mr7816943pju.52.1615448931909; Wed, 10 Mar 2021 23:48:51 -0800 (PST) Received: from localhost.localdomain ([103.21.79.4]) by smtp.gmail.com with ESMTPSA id t13sm1528580pfe.161.2021.03.10.23.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 23:48:51 -0800 (PST) From: Santosh Sivaraj To: Linux NVDIMM , Vishal Verma , Vaibhav Jain , Shivaprasad G Bhat , Harish Sriram , Dan Williams Cc: Santosh Sivaraj Subject: [ndctl PATCH v3 3/4] papr: Add support to parse save_fail flag for dimm Date: Thu, 11 Mar 2021 13:16:51 +0530 Message-Id: <20210311074652.2783560-3-santosh@fossix.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311074652.2783560-1-santosh@fossix.org> References: <20210311074652.2783560-1-santosh@fossix.org> MIME-Version: 1.0 Message-ID-Hash: XDFH3YKBQLPNSLSLS33EO4WPIKQLFLPZ X-Message-ID-Hash: XDFH3YKBQLPNSLSLS33EO4WPIKQLFLPZ X-MailFrom: santosh@fossix.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: This will help in getting the dimm fail tests to run on papr family too. Also add nvdimm_test compatibility string for recognizing the test module. Signed-off-by: Santosh Sivaraj --- ndctl/lib/libndctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 26b9317..dd1a5fc 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -805,6 +805,8 @@ static void parse_papr_flags(struct ndctl_dimm *dimm, char *flags) dimm->flags.f_restore = 1; else if (strcmp(start, "smart_notify") == 0) dimm->flags.f_smart = 1; + else if (strcmp(start, "save_fail") == 0) + dimm->flags.f_save = 1; start = end + 1; } if (end != start) @@ -1035,7 +1037,8 @@ NDCTL_EXPORT int ndctl_bus_is_papr_scm(struct ndctl_bus *bus) if (sysfs_read_attr(bus->ctx, bus->bus_buf, buf) < 0) return 0; - return (strcmp(buf, "ibm,pmemory") == 0); + return (strcmp(buf, "ibm,pmemory") == 0 || + strcmp(buf, "nvdimm_test") == 0); } /** From patchwork Thu Mar 11 07:46:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Sivaraj X-Patchwork-Id: 12130563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A413C433DB for ; Thu, 11 Mar 2021 07:48:59 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C613C64FB6 for ; Thu, 11 Mar 2021 07:48:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C613C64FB6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4DA4A100F2263; Wed, 10 Mar 2021 23:48:58 -0800 (PST) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::1035; helo=mail-pj1-x1035.google.com; envelope-from=santosh@fossix.org; receiver= Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 696CA100F225F for ; Wed, 10 Mar 2021 23:48:55 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id x7-20020a17090a2b07b02900c0ea793940so8655927pjc.2 for ; Wed, 10 Mar 2021 23:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z/02gceZ1C0cKDMZLMP47TLUCBsj2Ofi71U1k6wsKoE=; b=fxRd38LLh52gOvdvKxCvxSVrhgYAAMW0uljTpuLcMJI16zB6CW5gnuzn7oAwB5crOg 1yJ/kczVZUQR9NFSg6dJIYsGDCVMs1r1cXsrXkvngfHm18BYb3FhAdJB7a9Oyq3qOzhE 5ERswLCF0f8Pl7IlGYOI2y/k9E0x/ZOG6zDC5uvH9cflUs6Af2hhuqNh1t1m5DAKjFuj NhM0lNd1R3cPpAmj+v13j6n8Erl7kny7Kz0+uvU4OEl//PH+SxnC/JGbVNHfCR63+Lyn bHZyvWnRs7dYdeQK+GeH+LPUAcwFDxOTnN97OPsocuCTOfpBHZwVRLbgvDw246X6sNQB vgeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z/02gceZ1C0cKDMZLMP47TLUCBsj2Ofi71U1k6wsKoE=; b=EKXZWfgsyVoFBUMFjs6zXS42DsCarErXcitwx5z0BqZOKGh1+d3x9yhxgqecBeWZTM I16StwT5dahZJ/TllAXedQFiTVnx1DNeSZ7KB2eZOAQbeSLRkgGG7X7ajoDSUb4LhNde Iw9f607kxcS5/K6dqsLvUVhA0DxcwteRN/IdCwUhnice1W/9Er60Fdk2Gwa8Rz0riLdu 6cRdcLDyBW3JodZ3R7tTQhS6RoVcgN1Z48XoJ23/1gsZGNnPTtQ73TXBbMc6zEgvsXKr RwBk36ad3aLNLjjqjRVDM8cHVVq8DxSbO38I8ehKpSNJDBV9502t7d+j9WXxuFXzq7NI fAOw== X-Gm-Message-State: AOAM531A1YSEVZqCRfmWf+6XPWpQxENw3NLbgABk+1w78QEI1RB8K7pn YxNbgNKZz49v+q13wQTJ4QS1r8Mr6QYsOw== X-Google-Smtp-Source: ABdhPJxM4vTJpu5uJFoIZjTQL8CgZpSGMuhXxJFfpBGbiT3d8xur54Cv9th2C84q/9S/EG1yUas0HA== X-Received: by 2002:a17:902:8c97:b029:e2:8c58:153f with SMTP id t23-20020a1709028c97b02900e28c58153fmr6904755plo.79.1615448934494; Wed, 10 Mar 2021 23:48:54 -0800 (PST) Received: from localhost.localdomain ([103.21.79.4]) by smtp.gmail.com with ESMTPSA id t13sm1528580pfe.161.2021.03.10.23.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 23:48:54 -0800 (PST) From: Santosh Sivaraj To: Linux NVDIMM , Vishal Verma , Vaibhav Jain , Shivaprasad G Bhat , Harish Sriram , Dan Williams Cc: Santosh Sivaraj Subject: [ndctl PATCH v3 4/4] Use page size as alignment value Date: Thu, 11 Mar 2021 13:16:52 +0530 Message-Id: <20210311074652.2783560-4-santosh@fossix.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311074652.2783560-1-santosh@fossix.org> References: <20210311074652.2783560-1-santosh@fossix.org> MIME-Version: 1.0 Message-ID-Hash: K7UTQVUT2MKKJOLY5P4BK7CKKEEVQ6NA X-Message-ID-Hash: K7UTQVUT2MKKJOLY5P4BK7CKKEEVQ6NA X-MailFrom: santosh@fossix.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: The alignment sizes passed to ndctl in the tests are all hardcoded to 4k, the default page size on x86. Change those to the default page size on that architecture (sysconf/getconf). No functional changes otherwise. Signed-off-by: Santosh Sivaraj --- test/dpa-alloc.c | 15 ++++++++------- test/multi-dax.sh | 6 ++++-- test/sector-mode.sh | 4 +++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c index 0b3bb7a..59185cf 100644 --- a/test/dpa-alloc.c +++ b/test/dpa-alloc.c @@ -38,12 +38,13 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) struct ndctl_region *region, *blk_region = NULL; struct ndctl_namespace *ndns; struct ndctl_dimm *dimm; - unsigned long size; + 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) @@ -124,11 +125,11 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) return rc; } ndctl_namespace_disable_invalidate(ndns); - rc = ndctl_namespace_set_size(ndns, SZ_4K); + rc = ndctl_namespace_set_size(ndns, page_size); if (rc) { - fprintf(stderr, "failed to init %s to size: %d\n", + fprintf(stderr, "failed to init %s to size: %lu\n", ndctl_namespace_get_devname(ndns), - SZ_4K); + page_size); return rc; } namespaces[i].ndns = ndns; @@ -150,7 +151,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns; if (i % ARRAY_SIZE(namespaces) == 0) round++; - size = SZ_4K * round; + size = page_size * round; rc = ndctl_namespace_set_size(ndns, size); if (rc) { fprintf(stderr, "%s: set_size: %lx failed: %d\n", @@ -166,7 +167,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) i--; round++; ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns; - size = SZ_4K * round; + size = page_size * round; rc = ndctl_namespace_set_size(ndns, size); if (rc) { fprintf(stderr, "%s failed to update while labels full\n", @@ -175,7 +176,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) } round--; - size = SZ_4K * 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", diff --git a/test/multi-dax.sh b/test/multi-dax.sh index e932569..9451ed0 100755 --- a/test/multi-dax.sh +++ b/test/multi-dax.sh @@ -12,6 +12,8 @@ check_min_kver "4.13" || do_skip "may lack multi-dax support" trap 'err $LINENO' ERR +ALIGN_SIZE=`getconf PAGESIZE` + # setup (reset nfit_test dimms) modprobe nfit_test $NDCTL disable-region -b $NFIT_TEST_BUS0 all @@ -22,9 +24,9 @@ rc=1 query=". | sort_by(.available_size) | reverse | .[0].dev" region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query") -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) +json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M) chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M) +json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M) chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev") _cleanup diff --git a/test/sector-mode.sh b/test/sector-mode.sh index dd7013e..d03c0ca 100755 --- a/test/sector-mode.sh +++ b/test/sector-mode.sh @@ -9,6 +9,8 @@ rc=77 set -e trap 'err $LINENO' ERR +ALIGN_SIZE=`getconf PAGESIZE` + # setup (reset nfit_test dimms) modprobe nfit_test $NDCTL disable-region -b $NFIT_TEST_BUS0 all @@ -25,7 +27,7 @@ NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query") REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev") echo 0 > /sys/bus/nd/devices/$REGION/read_only $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K -$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a 4K +$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 _cleanup