Re: [PATCH v16 13/18] cxl: Validate and synchronize HDM ranges around reset

From: Srirangan Madhavan

Date: Thu Nov 05 2026 - 11:36:20 EST


On 10/29/26 8:45 PM, Richard Cheng wrote:
+static int cxl_hdm_ranges_request(struct cxl_hdm_quiesce *q)
+{
+ struct cxl_hdm_range *range;
+
+ lockdep_assert_held_write(&cxl_rwsem.region);
+
+ list_for_each_entry(range, &q->ranges, list) {
+ const struct range *hpa_range = &range->hpa_range;
+
+ range->res = request_mem_region(hpa_range->start, range->len,
+ "cxl_reset");
+ if (!range->res)
+ return -EBUSY;
+ }
+
Hi Srirangan,

The spec explicitly requires no outstanding or new CXL.mem transaction after
the affected HDM ranges are offlined.

For this part, I don't see any guarantee that a successful request_mem_region()
means all outstanding memory access have stopped and no new access can occur.

I see you refuse to reset when resource reservation conflict, but nothing
offline memory or directly stop CXL.mem traffic.

I wonder if the implementation provide enough evidence that when request_mem_region()
success means no new mem access or CXL.mem traffic will pop up ?

Best regards,
Richard Cheng.

Hi Richard,

You are right that a successful request_mem_region() does not show that no CXL.mem traffic can occur. The design expects userspace to offline CXL.mem users before reset, as discussed earlier. The reservation
enforces that for claimed ranges: the reset fails while a conflicting
resource is claimed, and nobody can claim the range during the reset.

It cannot see code that uses the range without claiming it. That case is
also covered by the offline expectation, not by the reservation. I added
this to the patch 13 commit message in v17 instead of leaving it implicit.

--
Regards,
Srirangan