]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI: Add schedule point in pci_read_config()
authorJiang Biao <benbjiang@tencent.com>
Mon, 24 Aug 2020 05:20:25 +0000 (13:20 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 17 Sep 2020 17:21:46 +0000 (12:21 -0500)
The PCI sysfs "config" file allows large reads, and the resulting PCI
config reads can take several milliseconds to complete.  Testing with the
cyclictest [1] benchmark showed 5ms+ latencies.

Add a schedule point in pci_read_config() to reduce the maximum latency.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git/

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20200824052025.48362-1-benbjiang@tencent.com
Reported-by: Bin Lai <robinlai@tencent.com>
Signed-off-by: Jiang Biao <benbjiang@tencent.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-sysfs.c

index 6d78df981d41a1bf888b537feefbe44fc100cf8a..3b9f63d3cad6172a9c5e6fb4fe54800f2df859a2 100644 (file)
@@ -708,6 +708,7 @@ static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
                data[off - init_off + 3] = (val >> 24) & 0xff;
                off += 4;
                size -= 4;
+               cond_resched();
        }
 
        if (size >= 2) {