Skip to content

Commit 36a1c2e

Browse files
davejiangdjbw
authored andcommitted
cxl/hdm: Fix a benign lockdep splat
The new helper "cxl_num_decoders_committed()" added a lockdep assertion to validate that port->commit_end is protected against modification. That assertion fires in init_hdm_decoder() where it is initializing port->commit_end. Given that it is both accessing and writing that property it obstensibly needs the lock. In practice, CXL decoder commit rules (must commit in order) and the in-order discovery of device decoders makes the manipulation of ->commit_end in init_hdm_decoder() safe. However, rather than rely on the subtle rules of CXL hardware, just make the implementation obviously correct from a software perspective. The Fixes: tag is only for cleaning up a lockdep splat, there is no functional issue addressed by this fix. Fixes: 458ba81 ("cxl: Add cxl_decoders_committed() helper") Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/170025232811.2147250.16376901801315194121.stgit@djiang5-mobl3 Acked-by: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 98b1cc8 commit 36a1c2e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/cxl/core/hdm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,8 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
839839
cxld->target_type = CXL_DECODER_HOSTONLYMEM;
840840
else
841841
cxld->target_type = CXL_DECODER_DEVMEM;
842+
843+
guard(rwsem_write)(&cxl_region_rwsem);
842844
if (cxld->id != cxl_num_decoders_committed(port)) {
843845
dev_warn(&port->dev,
844846
"decoder%d.%d: Committed out of order\n",

0 commit comments

Comments
 (0)