linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Allow scheduling to take place in proc_bus_pci_read()
@ 2021-08-15 15:08 Krzysztof Wilczyński
  2021-08-20 21:23 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Wilczyński @ 2021-08-15 15:08 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Bin Lai, Jiang Biao, linux-pci

PCI configuration space reads from the /proc/bus/pci for a particular
device, depending on the underlying hardware, can often take several
milliseconds to complete.

Thus, add a schedule point in proc_bus_pci_read() to reduce the maximum
latency.

A similar change has already been completed in the past for the sysfs
counterpart in the commit 2ce02a864ac1 ("PCI: Add schedule point in
pci_read_config()").

Link: https://lore.kernel.org/r/20200824052025.48362-1-benbjiang@tencent.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/proc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index d32fbfc93ea9..cb18f8a13ab6 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -83,6 +83,7 @@ static ssize_t proc_bus_pci_read(struct file *file, char __user *buf,
 		buf += 4;
 		pos += 4;
 		cnt -= 4;
+		cond_resched();
 	}
 
 	if (cnt >= 2) {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-20 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-15 15:08 [PATCH] PCI: Allow scheduling to take place in proc_bus_pci_read() Krzysztof Wilczyński
2021-08-20 21:23 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).