Public bug reported:
[Impact]
Deleting an unused, incomplete CXL region after automatic region discovery has
failed triggers a kernel WARNING and leaves the region's target metadata
inconsistent.
cxl_region_sort_targets() assigns the return value of
cxl_calc_interleave_pos() directly into cxled->pos and never restores it from
the member's slot in the sorted ->targets[] array. When auto-discovery cannot
place a member, find_pos_and_ways() returns -ENXIO and that -6 remains in
cxled->pos. Deleting the region then runs unregister_region() ->
detach_target() -> __cxl_decoder_detach(), which finds pos < 0, fails the
target-array invariant check and warns:
cxl region0: expected mem0:decoder2.0 at position -6
WARNING: drivers/cxl/core/region.c:2367 at __cxl_decoder_detach+0x258/0x320
__cxl_decoder_detach+0x258/0x320 (P)
cxl_decoder_detach+0x84/0x120
unregister_region+0x6c/0xe8
cxl_region_release_action+0x38/0x118
delete_region_store+0xc8/0x148
The sysfs write returns 0, so userspace sees the deletion succeed. Because the
guard returns early, the detach also skips clearing p->targets[pos], skips
decrementing p->nr_targets, does not reset the endpoint decoder's hpa_range,
and never calls device_release_driver() on the region.
A decoder committed by firmware behind a switch whose own decoders were not
committed for the range is sufficient to reach this state. It taints the
kernel, which obscures unrelated analysis on affected systems.
Affected: linux-nvidia-bos, arm64. Confirmed on 7.0.0-2024-nvidia-bos-64k
(package 7.0.0-2024.25) and still present at 7.0.0-2025.26.
[Fix]
Upstream commit 1731c729762b54e41965a822415dd35b91570b81
("cxl/region: Restore a target's position from its slot after sorting"),
merged via cxl-fixes-7.4-rc4 and first tagged in v7.4-rc4.
It restores cxled->pos from the member's ->targets[] slot after the sort, so
follow-on code can rely on p->targets[cxled->pos] naming the member whether or
not the sort succeeded:
+ for (i = 0; i < p->nr_targets; i++)
+ p->targets[i]->pos = i;
The regression was introduced by 0cf36a85c140 ("cxl/region: Use
cxl_calc_interleave_pos() for auto-discovery"), which dropped that restore.
The upstream fix carries a Fixes: tag for it but no Cc: stable, so it does not
reach this kernel automatically.
The commit cherry-picks cleanly with no conflict. One file changed,
8 insertions.
** Affects: linux-nvidia-bos (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2190797
Title:
cxl/region: WARN at __cxl_decoder_detach() when deleting a region
after failed auto-discovery
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-nvidia-bos/+bug/2190797/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs