Skip to content

Commit 8d1e810

Browse files
AlisonSchofielddavejiang
authored andcommitted
cxl/pci: Replace mutex_lock_io() w mutex_lock() for mailbox access
mutex_lock_io() differs from mutex_lock() in that it may call io_schedule() when a task must sleep waiting for the lock. This distinction only makes sense in block I/O or memory reclaim paths, where giving I/O a chance to make progress is useful. At this call site, cxl_pci_mbox_send(), the mutex protects an MMIO mailbox. The task holding the lock is not blocking I/O progress, so calling io_schedule(), as mutex_lock_io() may do, has no practical effect. Although there is no functional change, using the correct locking primitive, that more accurately reflects the semantics and intended use of the lock, improves code clarity and avoids misleading readers and tools. [ dj: Dropped fixes tag, no need to backport ] Reported-by: Alok Tiwari <[email protected]> Closes: https://lore.kernel.org/linux-cxl/[email protected]/ Suggested-by: Dan Williams <[email protected]> Signed-off-by: Alison Schofield <[email protected]> Reviewed-by: Davidlohr Bueso <[email protected]> Reviewed-by: Dan Williams <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent 11f4014 commit 8d1e810

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/cxl/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static int cxl_pci_mbox_send(struct cxl_mailbox *cxl_mbox,
379379
{
380380
int rc;
381381

382-
mutex_lock_io(&cxl_mbox->mbox_mutex);
382+
mutex_lock(&cxl_mbox->mbox_mutex);
383383
rc = __cxl_pci_mbox_send_cmd(cxl_mbox, cmd);
384384
mutex_unlock(&cxl_mbox->mbox_mutex);
385385

0 commit comments

Comments
 (0)