From: Jonathan Cameron <jic23@kernel.org>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
Dave Jiang <dave.jiang@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <iweiny@kernel.org>, Li Ming <ming.li@zohomail.com>,
Richard Cheng <icheng@nvidia.com>,
linux-cxl@vger.kernel.org
Subject: Re: [PATCH v4 4/9] cxl/region: Calculate peer distance only for reused targets
Date: Tue, 20 Oct 2026 02:24:23 +0100 [thread overview]
Message-ID: <20261020022423.2d5ffeb5@jic23-hlaptop> (raw)
In-Reply-To: <6ac7f8fae75f7cd29b5d530a552aec2b6c6169b5.1792263750.git.alison.schofield@intel.com>
On Sat, 17 Oct 2026 12:19:49 -0700
Alison Schofield <alison.schofield@intel.com> wrote:
> From: Richard Cheng <icheng@nvidia.com>
>
> cxl_switch_port_setup_targets() calculates peer distance before
> searching the existing targets. When the endpoint needs a new target,
> the calculated distance is never used.
>
> Move cxl_port_peer_distance() into the matching-target branch,
> immediately before check_last_peer(). This avoids unnecessary ancestor
> walks and per-port region lookups when adding distinct targets.
>
> Signed-off-by: Richard Cheng <icheng@nvidia.com>
> Tested-by: Alison Schofield <alison.schofield@intel.com>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
I'm assuming the commit message change Alison just posted or
something along those lines.
> ---
> drivers/cxl/core/region.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 4ab5a1d025a9..8bfebe3e1025 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1485,10 +1485,10 @@ static int cxl_switch_port_setup_targets(struct cxl_switch_decoder *cxlsd,
> }
>
> if (cxl_rr->nr_targets_set) {
> - int distance = cxl_port_peer_distance(port, cxlr);
> -
> for (int i = 0; i < cxl_rr->nr_targets_set; i++)
> if (ep->dport == cxlsd->target[i]) {
> + int distance = cxl_port_peer_distance(port, cxlr);
> +
> rc = check_last_peer(cxled, ep, cxl_rr,
> distance);
> if (rc)
next prev parent reply other threads:[~2026-10-20 1:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 19:19 [PATCH v4 0/9] cxl/region: Refactor cxl_port_setup_targets() Alison Schofield
2026-10-17 19:19 ` [PATCH v4 1/9] cxl: Add interleave encoding validity helpers Alison Schofield
2026-10-17 19:19 ` [PATCH v4 2/9] cxl/region: Rename cxl_port_setup_targets() to cxl_switch_port_setup_targets() Alison Schofield
2026-10-17 19:19 ` [PATCH v4 3/9] cxl/region: Factor out cxl_port_peer_distance() Alison Schofield
2026-10-17 19:19 ` [PATCH v4 4/9] cxl/region: Calculate peer distance only for reused targets Alison Schofield
2026-10-19 7:31 ` Richard Cheng
2026-10-19 19:53 ` Alison Schofield
2026-10-20 1:24 ` Jonathan Cameron [this message]
2026-10-20 2:29 ` Li Ming
2026-10-17 19:19 ` [PATCH v4 5/9] cxl/region: Factor out cxl_port_parent_interleave() Alison Schofield
2026-10-17 19:19 ` [PATCH v4 6/9] cxl/region: Factor out cxl_port_calc_interleave() Alison Schofield
2026-10-17 19:28 ` [PATCH v4 7/9] cxl/region: Factor out cxl_port_setup_decoder() Alison Schofield
2026-10-20 1:26 ` Jonathan Cameron
2026-10-17 19:28 ` [PATCH v4 8/9] cxl/region: Simplify switch port target setup control flow Alison Schofield
2026-10-20 1:27 ` Jonathan Cameron
2026-10-20 2:33 ` Li Ming
2026-10-17 19:28 ` [PATCH v4 9/9] cxl/region: Factor out cxl_switch_port_add_target() Alison Schofield
2026-10-20 1:28 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261020022423.2d5ffeb5@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=icheng@nvidia.com \
--cc=iweiny@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.