From patchwork Mon Apr 24 19:59:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13222533 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7D8363AD for ; Mon, 24 Apr 2023 19:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682366378; x=1713902378; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P2ooNdPDxUeEi5VnnIXUPzDHClIKyt6TVSaGBLvg6Z8=; b=GboMc6OJlcBcYZAokVQenvbDpq3OXkBmnz4Iy8HAkjQs1Mc9w4EaH8cc 6wEe9nV+r9WkdF4x1iQNYX422WnzmnqaC9oUT4uiu4KR0PcCAwwHOocdr kfABxHwC+L1CAfN6v0ncy2FfdxH5q9QtjS7D6jJ1j8lUrcVCj4MKtg4eY elIha18KaTFOkXTVE06dyV1nwIldF3TfzqvmhbI+godOtJSIZYDNRxvFV sJ29rviTPigRGGpKBolT//QVvH90UGnTbM8L5xWhKmKBCSV53y8wg8Crk flsg6oo/j5+P6yvthDDPEmaccDNkDLWsBxZ3qQ6jYYK8BkDsCXLaIP6Ag A==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="335442140" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="335442140" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="804759831" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="804759831" Received: from fbirang-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.88.12]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:37 -0700 Subject: [PATCH 1/4] cxl/list: Fix filtering RCDs From: Dan Williams To: vishal.l.verma@intel.com Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Date: Mon, 24 Apr 2023 12:59:37 -0700 Message-ID: <168236637746.1027628.14674251843014155022.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> References: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Attempts to filter by memdev fail when the memdev is an RCD (RCH topology): # cxl list -BEM -m 11 Warning: no matching devices found [ ] This is caused by VH topology assumption where an intervening host-bridge port is expected between the root CXL port and the endpoint. In an RCH topology an endpoint is integrated in the host-bridge. Search for endpoints directly attached to the root: # cxl list -BEMu -m 11 { "bus":"root3", "provider":"cxl_test", "endpoints:root3":[ { "endpoint":"endpoint22", "host":"mem11", "depth":1, "memdev":{ "memdev":"mem11", "ram_size":"2.00 GiB (2.15 GB)", "serial":"0xa", "numa_node":0, "host":"cxl_rcd.10" } } ] } Signed-off-by: Dan Williams Reviewed-by: Dave Jiang --- cxl/lib/libcxl.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c index 59e5bdbcc750..e6c94d623303 100644 --- a/cxl/lib/libcxl.c +++ b/cxl/lib/libcxl.c @@ -1457,8 +1457,9 @@ CXL_EXPORT int cxl_memdev_enable(struct cxl_memdev *memdev) return 0; } -static struct cxl_endpoint *cxl_port_find_endpoint(struct cxl_port *parent_port, - struct cxl_memdev *memdev) +static struct cxl_endpoint * +cxl_port_recurse_endpoint(struct cxl_port *parent_port, + struct cxl_memdev *memdev) { struct cxl_endpoint *endpoint; struct cxl_port *port; @@ -1468,7 +1469,7 @@ static struct cxl_endpoint *cxl_port_find_endpoint(struct cxl_port *parent_port, if (strcmp(cxl_endpoint_get_host(endpoint), cxl_memdev_get_devname(memdev)) == 0) return endpoint; - endpoint = cxl_port_find_endpoint(port, memdev); + endpoint = cxl_port_recurse_endpoint(port, memdev); if (endpoint) return endpoint; } @@ -1476,6 +1477,18 @@ static struct cxl_endpoint *cxl_port_find_endpoint(struct cxl_port *parent_port, return NULL; } +static struct cxl_endpoint *cxl_port_find_endpoint(struct cxl_port *parent_port, + struct cxl_memdev *memdev) +{ + struct cxl_endpoint *endpoint; + + cxl_endpoint_foreach(parent_port, endpoint) + if (strcmp(cxl_endpoint_get_host(endpoint), + cxl_memdev_get_devname(memdev)) == 0) + return endpoint; + return cxl_port_recurse_endpoint(parent_port, memdev); +} + CXL_EXPORT struct cxl_endpoint * cxl_memdev_get_endpoint(struct cxl_memdev *memdev) { From patchwork Mon Apr 24 19:59:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13222534 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6FEE63AD for ; Mon, 24 Apr 2023 19:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682366384; x=1713902384; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Faw8xP/k7KDSo+QDpEupmd/VRIE/HwlIRSmiJdGJIig=; b=h//zSPDKSbsXiw/SWtYZKXznHW+BdhmXda1YXv1BdpEPmZmjqt844RZu YioYGAqEkFfac5cADZ5REesEBmfj19Y7p4kVlAG7x3DVW67hI36heiaEH Hhi976CysIpDJz9MsT/poNnzL4RGdxKVqXc+uuiTWSU3RaL6G4uQGQ+lU 9wTsvsp98Dky7fdHeVfhKR7BoFctzdK1HMJoX0AANVtnwRp9uDBXEjHN1 E1adVdbfx9tWc14iXQdPoXK4ZStH0wdjW+J8+w2CGN5mMClxrF1AnbwuJ fAr7u5pS4fo48tIAaWUT6Ip8Tx52cOTBL89sSIPwrce8MUknqA3dCN79N A==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="326157356" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326157356" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="670622081" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="670622081" Received: from fbirang-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.88.12]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:43 -0700 Subject: [PATCH 2/4] cxl/list: Filter root decoders by region From: Dan Williams To: vishal.l.verma@intel.com Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Date: Mon, 24 Apr 2023 12:59:43 -0700 Message-ID: <168236638318.1027628.17234728660914767074.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> References: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Arrange for util_cxl_decoder_filter_by_region() to consider that root decoders host multiple regions, unlike switch and endpoint decoders that have a 1:1 relationship. Before: (list the root decoders hosting region4 and region9) # cxl list -Du -d root -r 4,9 Warning: no matching devices found [ ] After: # cxl list -Du -d root -r 4,9 [ { "decoder":"decoder3.0", "resource":"0xf010000000", "size":"1024.00 MiB (1073.74 MB)", "interleave_ways":1, "max_available_extent":"512.00 MiB (536.87 MB)", "volatile_capable":true, "nr_targets":1 }, { "decoder":"decoder3.5", "resource":"0xf1d0000000", "size":"256.00 MiB (268.44 MB)", "interleave_ways":1, "accelmem_capable":true, "nr_targets":1 } ] Signed-off-by: Dan Williams Reviewed-by: Dave Jiang --- cxl/filter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cxl/filter.c b/cxl/filter.c index 90b13be79d9c..6e8d42165205 100644 --- a/cxl/filter.c +++ b/cxl/filter.c @@ -661,6 +661,12 @@ util_cxl_decoder_filter_by_region(struct cxl_decoder *decoder, if (!__ident) return decoder; + /* root decoders filter by children */ + cxl_region_foreach(decoder, region) + if (util_cxl_region_filter(region, __ident)) + return decoder; + + /* switch and endpoint decoders have a 1:1 association with a region */ region = cxl_decoder_get_region(decoder); if (!region) return NULL; From patchwork Mon Apr 24 19:59:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13222535 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59A2563AD for ; Mon, 24 Apr 2023 19:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682366389; x=1713902389; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/hYsZFVbuB7rXLCiq+RG514NSTK5FRfnbKf2UZYDzDA=; b=c/qjsd5yoRLdrLLAdYpHltqXG9IppXyGt0ugNqZbz+9AvE46YcHrW1gr +h/oDkPdZQyaAwIO0hGWV+WvsqbLw0Z+nkIS7S6YsnixRwFee8Lvr5cIs mVpNwWbbZttw+siMkWYdkHLcEzR/poSjCKAkRu8GjFjD67zDfIZYAZvvp hemgN7uRMEZOnMpD+ENlmL4F6m9R2U3cKfKjN1fKY5l7w8bRCKdgRjqTr 9/lYWwRpCk0LiQw9qQOUoXuuHwYBF75Cthkao6X4ub9iDfJk+bpyGq/dg SsH+EcJ0Skez8X8mXAGbMGre/LKIYceC8ZP5z1aEsW9gVHfFGyvPndnEy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="326157376" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326157376" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="670622085" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="670622085" Received: from fbirang-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.88.12]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:48 -0700 Subject: [PATCH 3/4] test: Support test modules located in 'updates' instead of 'extra' From: Dan Williams To: vishal.l.verma@intel.com Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Date: Mon, 24 Apr 2023 12:59:48 -0700 Message-ID: <168236638863.1027628.11883188611397194858.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> References: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since kernel commit: b74d7bb7ca24 ("kbuild: Modify default INSTALL_MOD_DIR from extra to updates") ...the kernel build process deposits the nfit_test can cxl_test modules in /lib/modules/$KVER/updates. This is more widely supported across multiple distributions as a default override for modules that ship in their native directory. Signed-off-by: Dan Williams Reviewed-by: Dave Jiang --- test/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core.c b/test/core.c index 5d1aa23723f1..a354f41dcba0 100644 --- a/test/core.c +++ b/test/core.c @@ -209,7 +209,7 @@ retry: break; } - if (!strstr(path, "/extra/")) { + if (!strstr(path, "/extra/") && !strstr(path, "/updates/")) { log_err(&log_ctx, "%s.ko: appears to be production version: %s\n", name, path); break; From patchwork Mon Apr 24 19:59:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13222536 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0F5063AD for ; Mon, 24 Apr 2023 19:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682366394; x=1713902394; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N+pnJfgGcGHjw+ULGWkSTJiaCsI/Hrj1Roxt/t3wLLU=; b=iGznIUlYn7FYzoqaBFPhuBvzZouBRUas/q3EOdcehuFtcvaM0zmCcCj0 pq4l0sZwDHCkD/45QHbkFmvxcaajTOwksMBPkzqF17s9mQEDhNuT57ZHX y811zrIo8zlu/unBWNlryInPsOZpn/S7z2xoaWBAWgi0rP7i5s87MZHNU JdUdCiMVLeQgME7FPCALPv9QJ7BoTc8Pbp2y3r3OHYOjxMLbz15fQBNbN Uetn9COY9JFSgLhwqY7XijbonD3Inzvit9KdOtCPtgFp5AS6Qv8bgvRJv NbvVeApwr6t0+BirkCBBpIhXLhmM5bI3p0uuI0mW2lecz9voXDBEHxUe6 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="326157396" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326157396" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="670622089" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="670622089" Received: from fbirang-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.88.12]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 12:59:54 -0700 Subject: [PATCH 4/4] test: Fix dangling pointer warning From: Dan Williams To: vishal.l.verma@intel.com Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Date: Mon, 24 Apr 2023 12:59:54 -0700 Message-ID: <168236639399.1027628.5866455518934998684.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> References: <168236637159.1027628.7560967008080605819.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 gcc (13.0.1 20230421 (Red Hat 13.0.1-0)) complains: ../test/libndctl.c: In function ‘check_commands’: ../test/libndctl.c:2313:20: warning: storing the address of local variable ‘__check_dimm_cmds’ in ‘check_cmds’ [-Wdangling-poiter=] ...fix it by showing the compiler that the local setting does not escape the function. Signed-off-by: Dan Williams Reviewed-by: Dave Jiang --- test/libndctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/libndctl.c b/test/libndctl.c index 51245cf4ea98..858110c4dbc1 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -2322,7 +2322,8 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm, ndctl_bus_get_provider(bus), ndctl_dimm_get_id(dimm), ndctl_dimm_get_cmd_name(dimm, i)); - return -ENXIO; + rc = -ENXIO; + break; } if (!check->check_fn) @@ -2331,6 +2332,7 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm, if (rc) break; } + check_cmds = NULL; for (i = 0; i < ARRAY_SIZE(__check_dimm_cmds); i++) { if (__check_dimm_cmds[i].cmd)