Re: [PATCH 2/2] cxl/core: Hold grandparent port lock while dport adding

From: dan.j.williams

Date: Tue Feb 03 2026 - 16:14:49 EST


Li Ming wrote:
[..]
> > > - scoped_guard(device, &port->dev) {
> > > + scoped_guard(device, &parent_port_of(port)->dev) {
> > I'm nervous about whether this is the right lock. For unregister_port()
> > (which is easier to track down that the add path locking) the lock
> > taken depends on where the port is that is being unregistered.
> > Specifically root ports are unregistered under parent->uport_dev, not
> > parent->dev.
> You are right.
> When cxl acpi driver attempts to add a cxl host bridge port, it will hold cxl_root->uport_dev.
> Otherwide, hold parent_port->dev lock for the new port addition.
> So I think it is possible that memdev can observe a cxl host bridge port but it has not been attach yet.
> Maybe I should hold the lock of the new port's host.
> Let's see if other reviewers have more comments on that.

So, I think current code is ok, if cxl_mem_probe() races
cxl_acpi_probe() in the same way that case is already caught by the
cxl_bus_rescan() at the end of cxl_acpi_probe().