From: alison.schofield@intel.com
To: Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: [PATCH 0/3] cxl/region: Autodiscovery position repair
Date: Thu, 5 Oct 2023 17:43:10 -0700 [thread overview]
Message-ID: <cover.1696550786.git.alison.schofield@intel.com> (raw)
From: Alison Schofield <alison.schofield@intel.com>
Some region configurations fail to assemble through the auto-discovered
region path. These are valid region configurations that can be assembled
correctly if presented as user defined regions.
The difference being that user defined regions arrive at the driver
with their targets in interleave order, whereas with autodiscovered
regions, the driver needs to assign each target in the interleave
set a correct position. And, in some cases, that fails.
cxl_region_sort_targets() uses the kernel sort() function to put the
targets in relative order. Once the relative ordering is complete,
positions are assigned based on each targets index in the sorted list.
That relative sort doesn't consider the offset of a port into its
parent port. In the failure case, a 2 + 2 config (2 host bridges each
with 2 endpoints), this causes the sort to put all targets of one port
ahead of another port, when they were expected to be interleaved.
While examining the problem and weighing the option of repairing the
existing sort algorithm with assigning positions another way, I chose
the latter. Each endpoint can be examined individually to discover its
position in the region interleave.
The presentation of this patchset was a challenge. While the changes
are essentially a replacement the resulting diff is horrible. (I did
try multiple git diff algs). So, after a simple preparation patch,
its presented like this:
Patch 2:The new method, calc_interleave_pos(), is introduced and used
in a dev_dbg() exercise on user defined regions.
Patch 3:Calc_interleave_pos() replaces the relative sort() in
cxl_region_sort_targets() for auto-discoverd regions
and the now obsolete sort helpers are removed.
The only function that seems useful for a side by side diff viewing
is cxl_region_sort_targets() and it is in Patch 3.
To test this, I've been able to validate that a previously failing 2+2
autodiscovered config now works. Also, using the dev_dbg() selftest
hook in Patch 2, proved the new calculation against all regions created
during the execution of the CXL unit test suite.
For example:
# meson test -C build cxl-xor-region.sh
# dmesg | grep Interleave
[ 177.223243] cxl_core:cxl_region_attach:1765: cxl decoder8.1: Interleave calc match Success test_pos:0 cxled->pos:0
[ 177.788170] cxl_core:cxl_region_attach:1765: cxl decoder8.1: Interleave calc match Success test_pos:0 cxled->pos:0
[ 177.790720] cxl_core:cxl_region_attach:1765: cxl decoder10.0: Interleave calc match Success test_pos:1 cxled->pos:1
[ 178.711246] cxl_core:cxl_region_attach:1765: cxl decoder8.1: Interleave calc match Success test_pos:0 cxled->pos:0
[ 178.714015] cxl_core:cxl_region_attach:1765: cxl decoder16.0: Interleave calc match Success test_pos:1 cxled->pos:1
[ 178.716846] cxl_core:cxl_region_attach:1765: cxl decoder17.0: Interleave calc match Success test_pos:2 cxled->pos:2
[ 178.719660] cxl_core:cxl_region_attach:1765: cxl decoder18.0: Interleave calc match Success test_pos:3 cxled->pos:3
Alison Schofield (3):
cxl/region: Prepare the decoder match range helper for reuse
cxl/region: Calculate a target position in a region interleave
cxl/region: Use calc_interleave_pos() with autodiscovered regions
drivers/cxl/core/region.c | 205 ++++++++++++++++++++------------------
1 file changed, 106 insertions(+), 99 deletions(-)
base-commit: 8a749fd1a8720d4619c91c8b6e7528c0a355c0aa
--
2.37.3
next reply other threads:[~2023-10-06 0:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 0:43 alison.schofield [this message]
2023-10-06 0:43 ` [PATCH 1/3] cxl/region: Prepare the decoder match range helper for reuse alison.schofield
2023-10-12 11:29 ` Jonathan Cameron
2023-10-12 23:35 ` Dave Jiang
2023-10-06 0:43 ` [PATCH 2/3] cxl/region: Calculate a target position in a region interleave alison.schofield
2023-10-12 23:49 ` Dave Jiang
2023-10-16 5:19 ` Alison Schofield
2023-10-06 0:43 ` [PATCH 3/3] cxl/region: Use calc_interleave_pos() with autodiscovered regions alison.schofield
2023-10-13 16:48 ` Dave Jiang
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=cover.1696550786.git.alison.schofield@intel.com \
--to=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox