[PATCH v2 0/3] PCI: endpoint: Rework the EPC to EPF notification
From: Manivannan Sadhasivam
Date: Sat Sep 10 2022 - 05:05:35 EST
During the review of the patch that fixes DBI access in PCI EP, Rob
suggested  using a fixed interface for passing the events from EPC to
EPF instead of the in-kernel notifiers.
This series introduces a simple callback based mechanism for passing the
events from EPC to EPF. This interface is chosen for satisfying the below
1. The notification has to reach the EPF drivers without any additional
2. The context of the caller (EPC) needs to be preserved while passing the
With the existing notifier mechanism, the 1st case can be satisfied since
notifiers aren't adding any huge overhead. But the 2nd case is clearly not
satisfied, because the current atomic notifiers forces the EPF
notification context to be atomic even though the caller (EPC) may not be
in atomic context. In the notification function, the EPF drivers are
required to call several EPC APIs that might sleep and this triggers a
sleeping in atomic bug during runtime.
The above issue could be fixed by using a blocking notifier instead of
atomic, but that proposal was not accepted either .
So instead of working around the issues within the notifiers, let's get rid
of it and use the callback mechanism.
Changes in v2:
* Introduced a new "list_lock" for protecting the epc->pci_epf list and
used it in the callback mechanism.
Manivannan Sadhasivam (3):
PCI: endpoint: Use a separate lock for protecting epc->pci_epf list
PCI: endpoint: Use callback mechanism for passing events from EPC to
PCI: endpoint: Use link_up() callback in place of LINK_UP notifier
drivers/pci/endpoint/functions/pci-epf-test.c | 38 ++++++-------------
drivers/pci/endpoint/pci-epc-core.c | 32 ++++++++++++----
include/linux/pci-epc.h | 10 +----
include/linux/pci-epf.h | 19 ++++++----
4 files changed, 51 insertions(+), 48 deletions(-)