From: Alison Schofield <alison.schofield@intel.com>
To: Li Ming <ming.li@zohomail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jic23@kernel.org>,
Dave Jiang <dave.jiang@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>, Dan Williams <djbw@kernel.org>,
<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] cxl/region: Fill first free targets[] slot during auto-discovery
Date: Thu, 11 Jun 2026 18:20:40 -0700 [thread overview]
Message-ID: <aite6BrA77D1AL5f@aschofie-mobl2.lan> (raw)
In-Reply-To: <20260606-fix_two_issues_introduced_by_cxl_cancel_auto_attach-v1-2-5d94ca06c4e4@zohomail.com>
On Sat, Jun 06, 2026 at 03:51:01PM +0800, Li Ming wrote:
> Any invalid endpoint decoder pointer in the target array of an active
> region is not allowed by cxl driver. This means cxl driver always
> assumes the first p->nr_targets entries of the target array in an
> auto-assembly region are valid. However, there are scenarios that could
> leave NULL endpoint decoder pointer holes in the target array.
>
> 1. When cxl_cancel_auto_attach() removes an endpoint decoder from a
> target array, the target slot is set to NULL. If the removed endpoint
> decoder is not the last element in the target array, the target array
> will contain a NULL hole.
>
> 2. When a auto-assembly region removes an assigned endpoint decoder, if
> the removed endpoint decoder is not the last element in the target
> array, always remains a NULL hole in the target array.
>
> When a NULL pointer hole exists in a region's target array, it
> introduces two potential problems:
> 1. Access an endpoint decoder via a NULL pointer. it always trigger
> calltrace like that.
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000008: 0000 [#1] SMP KASAN PTI
> RIP: 0010:cxl_calc_interleave_pos+0x26/0x810 [cxl_core]
> Call Trace:
> <TASK>
> cxl_region_attach+0xc50/0x2140 [cxl_core]
> cxl_add_to_region+0x321/0x2330 [cxl_core]
> discover_region+0x92/0x150 [cxl_port]
> device_for_each_child+0xf3/0x170
> cxl_port_probe+0x150/0x200 [cxl_port]
> cxl_bus_probe+0x4f/0xa0 [cxl_core]
> really_probe+0x1c8/0x960
> __driver_probe_device+0x323/0x450
> driver_probe_device+0x45/0x120
> __device_attach_driver+0x15d/0x280
> bus_for_each_drv+0x10f/0x190
>
> 2. Not having enough valid endpoint decoders attached to an
> auto-assembly region. if an auto-assembly region is created with lock
> flag or assigned endpoint decoder with lock flag, which means
> assigned endpoint decoder will not be reset during detaching, they
> could re-attach to the auto-assembly region again. But cxl region
> driver relies on p->nr_targets to verify whether the required number
> of endpoint decoders has been attached, and NULL endpoint decoder
> pointers are still counted in that case.
>
> To fix above issues, adjust cxl_region_attach_auto() logic to find the
> first free target slot for endpoint decoder attachment, this ensures
> NULL holes in the target array are filled, rather than adding new
> endpoint decoders at the tail of the target array.
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
next prev parent reply other threads:[~2026-06-12 1:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-06 7:50 [PATCH 0/2] cxl/region: Fix two decoder attach/detach issues for auto-assembly region Li Ming
2026-06-06 7:51 ` [PATCH 1/2] cxl/region: Fix out-of-bounds access in cxl_cancel_auto_attach() Li Ming
2026-06-12 1:19 ` Alison Schofield
2026-06-06 7:51 ` [PATCH 2/2] cxl/region: Fill first free targets[] slot during auto-discovery Li Ming
2026-06-12 1:20 ` Alison Schofield [this message]
2026-06-12 16:40 ` [PATCH 0/2] cxl/region: Fix two decoder attach/detach issues for auto-assembly region 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=aite6BrA77D1AL5f@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=ira.weiny@intel.com \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®