]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI: endpoint: pci-epf-vntb: Defer pci_epc_raise_irq() out of atomic context
authorKoichiro Den <den@valinux.co.jp>
Wed, 13 May 2026 02:49:13 +0000 (11:49 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 22 Jun 2026 20:31:11 +0000 (15:31 -0500)
commit18355c1e986582aaff2c488b1a2ce79bac8f3cf9
treec8e2eb0125180e51f87772a620e390a2b71294bd
parent6a7db4fcc6c23b1d25e676400d764bdcb7dc1ccb
PCI: endpoint: pci-epf-vntb: Defer pci_epc_raise_irq() out of atomic context

The NTB .peer_db_set() callback may be invoked from atomic context.
pci-epf-vntb currently calls pci_epc_raise_irq() directly, but
pci_epc_raise_irq() may sleep (it takes epc->lock).

Avoid sleeping in atomic context by coalescing doorbell bits into an
atomic64 pending mask and raising MSIs from a work item. Limit the
amount of work per run to avoid monopolizing the workqueue under a
doorbell storm.

Clear stale pending bits before enabling the work item and after disabling
it during cleanup. Also mask requested doorbells against the currently
valid doorbell mask before queueing work, and iterate the pending u64 with
__ffs64() so high doorbell bits are handled correctly.

Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260513024923.451765-3-den@valinux.co.jp
drivers/pci/endpoint/functions/pci-epf-vntb.c