diff mbox series

PCI: Allow scheduling to take place in proc_bus_pci_read()

Message ID 20210815150824.96773-1-kw@linux.com (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series PCI: Allow scheduling to take place in proc_bus_pci_read() | expand

Commit Message

Krzysztof Wilczyński Aug. 15, 2021, 3:08 p.m. UTC
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(+)

Comments

Bjorn Helgaas Aug. 20, 2021, 9:23 p.m. UTC | #1
On Sun, Aug 15, 2021 at 03:08:24PM +0000, Krzysztof Wilczyński wrote:
> 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>

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

> ---
>  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
>
diff mbox series

Patch

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) {