Skip to contentSkip to conversation

PCI: Allow scheduling to take place in proc_bus_pci_read()

PATCH Applied Krzysztof Wilczyński 2 participants 2 messages Aug 15, 2021 – Aug 20, 2021 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Allow scheduling to take place in proc_bus_pci_read()

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()").

---
 drivers/pci/proc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/proc.c +1 -0
index d32fbfc93ea9..cb18f8a13ab6 100644
@@ -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) {
Signature · 1 line
2.32.0
#1 lore raw
Quoted 7 lines · Krzysztof Wilczyński

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.

Quoted 6 lines

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()").

Applied to pci/misc for v5.15, thanks!

I tweaked your subject line to match 2ce02a864ac1:

PCI: Add schedule point in proc_bus_pci_read()

Quoted 19 lines
---
 drivers/pci/proc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/proc.c +1 -0
index d32fbfc93ea9..cb18f8a13ab6 100644
@@ -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) {
Signature · 1 line
2.32.0