1
linux/drivers/cxl/core
Dan Williams 105b6235ad cxl/port: Prevent out-of-order decoder allocation
With the recent change to allow out-of-order decoder de-commit it
highlights a need to strengthen the in-order decoder commit guarantees.
As it stands match_free_decoder() ensures that if 2 regions are racing
decoder allocations the one that wins the race will get the lower id
decoder, but that still leaves the race to *commit* the decoder.

Rather than have this complicated case of "reserved in-order, but may
still commit out-of-order", just arrange for the reservation order to
match the commit-order. In other words, prevent subsequent allocations
until the last reservation is committed.

This precludes overlapping region creation events and requires the
previous regionN to either move forward to the decoder commit stage or
drop its reservation before regionN+1 can move forward. That is,
provided that regionN and regionN+1 decode through the same switch port.

As a side effect this allows match_free_decoder() to drop its dependency
on needing write access to the device_find_child() @data parameter [1].

Reported-by: Zijun Hu <quic_zijuhu@quicinc.com>
Closes: http://lore.kernel.org/20240905-const_dfc_prepare-v4-0-4180e1d5a244@quicinc.com
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://patch.msgid.link/172964783668.81806.14962699553881333486.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
2024-10-25 16:07:03 -05:00
..
cdat.c cxl/core: Return error when cxl_endpoint_gather_bandwidth() handles a non-PCI device 2024-10-24 16:05:52 -05:00
core.h cxl: Calculate region bandwidth of targets with shared upstream link 2024-09-22 21:05:16 -07:00
hdm.c cxl/port: Fix use-after-free, permit out-of-order decoder shutdown 2024-10-25 16:07:03 -05:00
Makefile cxl: Add callback to parse the DSMAS subtables from CDAT 2023-12-22 14:33:10 -08:00
mbox.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
memdev.c cxl: Convert cxl_internal_send_cmd() to use 'struct cxl_mailbox' as input 2024-09-12 08:39:10 -07:00
pci.c cxl: Calculate region bandwidth of targets with shared upstream link 2024-09-22 21:05:16 -07:00
pmem.c cxl/mem: Fix no cxl_nvd during pmem region auto-assembling 2024-06-18 16:56:50 -07:00
pmu.c cxl/pmu: Ensure put_device on pmu devices 2023-12-14 21:54:45 -08:00
port.c cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices() 2024-10-25 16:07:03 -05:00
region.c cxl/port: Prevent out-of-order decoder allocation 2024-10-25 16:07:03 -05:00
regs.c pci-v6.10-changes 2024-05-21 10:09:28 -07:00
suspend.c
trace.c cxl/region: Move cxl_trace_hpa() work to the region driver 2024-04-30 12:24:42 -07:00
trace.h cxl/events: Fix Trace DRAM Event Record 2024-10-25 11:23:26 -05:00