Re: [PATCH v15 11/16] cxl: Validate and synchronize HDM ranges around reset

From: Alison Schofield

Date: Mon Oct 26 2026 - 23:26:54 EST


On Sun, Oct 11, 2026 at 02:14:17AM +0000, Srirangan Madhavan wrote:
> Refuse reset unless enabled system-physical HDM ranges can be reserved
> exclusively and CPU-cache invalidation is available. Invalidate before
> reset and again before ending IOMMU exclusion, holding range reservations
> until the second invalidation completes. A later patch places state
> restoration before the second invalidation.
>
> Reject normalized-addressing decoders because their cached ranges are not
> system physical addresses. Ignore zero-size decoders because they map no
> address range. Refuse reset when the device decodes memory through its
> DVSEC ranges instead of HDM decoders, since the cache holds no range to
> reserve for that memory.
>
> Provide the range handling as a region quiesce in built-in CXL code. The
> quiesce lock blocks region commit and teardown for the whole reset, and
> the HDM state copy taken under it supplies both the reserved ranges and,
> later, the state to restore.

Hi Srirangan,

Is above statement underselling the potential impact? The quiesce is
cxl_rwsem.region held for write, so for the whole reset it also blocks
region and decoder sysfs, region probe, poison list/inject/clear, sanitize
and event record tracing, on every CXL device.

Can the changelog say what it blocks and for how long?

more below on the 'how long' ?

snip


> +static int cxl_reset_execute(struct pci_dev *pdev, int dvsec, u16 cap)
> +{
> + int rc;
> +
> + cxl_region_quiesce_lock();
> + rc = cxl_reset_quiesced(pdev, dvsec, cap);
> + cxl_region_quiesce_unlock();

IIUC, this cxl_rwsem.region for write for the whole reset, including the
Memory Clear wait, which can run to CXL_RESET_MAX_WAIT_MS (20 seconds) plus
the cache flushes. That blocks all region activity, on every CXL device in
the system, not just the one being reset. Does resetting one device need
to stop all of it?

snip


> +/**
> + * struct cxl_hdm_range - HPA range held exclusively across a reset
> + * @list: entry in &cxl_hdm_quiesce.ranges
> + * @dev: device for error messages
> + * @hpa_range: system physical address range decoded by the device
> + * @len: length of @hpa_range
> + * @res: reservation of @hpa_range, once requested
> + */
> +struct cxl_hdm_range {
> + struct list_head list;
> + struct device *dev;

Can these range helpers return the error and leave the reporting to
cxl_reset_quiesced()? That was the v14 ask. v15 swaps struct pci_dev for
struct device, but the device is still passed down through
cxl_hdm_quiesce_prepare() and stored here only for dev_err().

-- Alison