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: 13222537 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 63CE6C7618E for ; Mon, 24 Apr 2023 20:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbjDXT77 (ORCPT ); Mon, 24 Apr 2023 15:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbjDXT7j (ORCPT ); Mon, 24 Apr 2023 15:59:39 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B101A8 for ; Mon, 24 Apr 2023 12:59:38 -0700 (PDT) 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="335442139" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="335442139" 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 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org 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: 13222539 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 B7107C77B7F for ; Mon, 24 Apr 2023 20:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbjDXUAA (ORCPT ); Mon, 24 Apr 2023 16:00:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232253AbjDXT7p (ORCPT ); Mon, 24 Apr 2023 15:59:45 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69CA1AA for ; Mon, 24 Apr 2023 12:59:44 -0700 (PDT) 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="326157355" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326157355" 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 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org 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: 13222540 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 1C13BC7EE20 for ; Mon, 24 Apr 2023 20:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231814AbjDXUAA (ORCPT ); Mon, 24 Apr 2023 16:00:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232648AbjDXT7t (ORCPT ); Mon, 24 Apr 2023 15:59:49 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41A26AA for ; Mon, 24 Apr 2023 12:59:49 -0700 (PDT) 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="326157375" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326157375" 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 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org 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: 13222541 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 A8AA5C77B7E for ; Mon, 24 Apr 2023 20:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231938AbjDXUAB (ORCPT ); Mon, 24 Apr 2023 16:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232982AbjDXT74 (ORCPT ); Mon, 24 Apr 2023 15:59:56 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9AAB1AE for ; Mon, 24 Apr 2023 12:59:54 -0700 (PDT) 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="326157397" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326157397" 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 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org 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)