From patchwork Thu Dec 8 21:28:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13068941 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 6C3FFC4332F for ; Thu, 8 Dec 2022 21:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbiLHV2a (ORCPT ); Thu, 8 Dec 2022 16:28:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiLHV2a (ORCPT ); Thu, 8 Dec 2022 16:28:30 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF3258424A for ; Thu, 8 Dec 2022 13:28:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670534908; x=1702070908; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OSg3tRXeh2ljbNLBilzvesOZ52kfpIGevHWDmk6y0Dk=; b=DYCLI+YTma/f0tGd5Nvf8y9utIFso24KwAKzjND4sbV3bQoEr+kUEge9 ehb8P7AqEoiNND/cOV1mQKTrZSiwhgiZlBaWAjN5Jx2Y+OGRjSJc/K3Oz GPf2ZybSaJGcztpm9xzIHXpGooa5wVqniitvAyd4ey4XaGrgHDDFZQgz4 BYIM0hhNQ2UCUGhWVM9Mx4xZTdcUoVQVePp/6HODDhbBycG5KXYKu0jQ5 IT8nD2Ne8DBWJpS2O1y4I0Qiy/9/hQehTKUOZFLxqPvswMjsVHzrjRjFR RTcvG3jUt/UjzrIddJdQGusFeG9HKbd7uGRgA92YehgToTMkKsMi74YR6 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="318458793" X-IronPort-AV: E=Sophos;i="5.96,228,1665471600"; d="scan'208";a="318458793" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 13:28:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="976047130" X-IronPort-AV: E=Sophos;i="5.96,228,1665471600"; d="scan'208";a="976047130" Received: from kputnam-mobl1.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.251.25.149]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 13:28:27 -0800 Subject: [ndctl PATCH v2 05/18] cxl/list: Always attempt to collect child objects From: Dan Williams To: linux-cxl@vger.kernel.org Cc: Vishal Verma , alison.schofield@intel.com, nvdimm@lists.linux.dev, vishal.l.verma@intel.com Date: Thu, 08 Dec 2022 13:28:27 -0800 Message-ID: <167053490730.582963.12731194244577097943.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <167053487710.582963.17616889985000817682.stgit@dwillia2-xfh.jf.intel.com> References: <167053487710.582963.17616889985000817682.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 The evolution of the hierarchical listing left warts like the following: if (p->memdevs && !p->ports && !p->endpoints) { jchilddevs = json_object_new_array(); ...whereby it tried to avoid creating a container for child devices if another container deeper in the hierarchy might supersede the upper-level containers. I.e. if endpoints are included in the listing then there will be nothing to report at the bus level. The protection is unnnecessary because cond_add_put_array_suffix() already handles the case of dropping empty containers when a lower level container subsumes all the objects. Moreover, it's a broken check when adding objects at new levels of the topology. CXL devices attached to an RCH cause memdevs to appear directly beneath a bus object, and not an intervening port. So in preparation for that change, delete all the unnecessary special casing for "jchildobj" container creation. Reported-by: Vishal Verma Fixes: 41d6769393f4 ("cxl/list: Move enabled memdevs underneath their endpoint") Signed-off-by: Dan Williams --- cxl/filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cxl/filter.c b/cxl/filter.c index 56c659965891..040e7deefb3e 100644 --- a/cxl/filter.c +++ b/cxl/filter.c @@ -971,7 +971,7 @@ walk_child_ports(struct cxl_port *parent_port, struct cxl_filter_params *p, continue; } - if (p->memdevs && !p->endpoints) { + if (p->memdevs) { jchilddevs = json_object_new_array(); if (!jchilddevs) { err(p, @@ -1151,7 +1151,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p) } } - if (p->memdevs && !p->ports && !p->endpoints) { + if (p->memdevs) { jchilddevs = json_object_new_array(); if (!jchilddevs) { err(p, @@ -1169,7 +1169,7 @@ int cxl_filter_walk(struct cxl_ctx *ctx, struct cxl_filter_params *p) continue; } } - if (p->regions && !p->decoders) { + if (p->regions) { jchildregions = json_object_new_array(); if (!jchildregions) { err(p,