diff mbox series

[1/2] Revert "PCI/IOV: Serialize sysfs sriov_numvfs reads vs writes"

Message ID 170311309712.2826.11254260046040224092.stgit@bgt-140510-bm01.eng.stellus.in (mailing list archive)
State Changes Requested
Delegated to: Bjorn Helgaas
Headers show
Series pci/iov: avoid device_lock() when reading sriov_numvfs | expand

Commit Message

Jim Harris Dec. 20, 2023, 10:58 p.m. UTC
The proper way to detect a change to the num_VFs value is to listen for a
sysfs event, not to add a device_lock() on the attribute _show() in the
kernel.

This reverts commit 35ff867b76576e32f34c698ccd11343f7d616204.
Revert had a small conflict, the sprintf() is now changed to sysfs_emit().

Suggested-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jim Harris <jim.harris@samsung.com>
---
 drivers/pci/iov.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Leon Romanovsky Dec. 25, 2023, 11:20 a.m. UTC | #1
On Wed, Dec 20, 2023 at 10:58:17PM +0000, Jim Harris wrote:
> The proper way to detect a change to the num_VFs value is to listen for a
> sysfs event, not to add a device_lock() on the attribute _show() in the
> kernel.
> 
> This reverts commit 35ff867b76576e32f34c698ccd11343f7d616204.
> Revert had a small conflict, the sprintf() is now changed to sysfs_emit().
> 
> Suggested-by: Leon Romanovsky <leonro@nvidia.com>
> Signed-off-by: Jim Harris <jim.harris@samsung.com>
> ---
>  drivers/pci/iov.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 25dbe85c4217..d4646bdcd887 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -395,14 +395,8 @@  static ssize_t sriov_numvfs_show(struct device *dev,
 				 char *buf)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
-	u16 num_vfs;
-
-	/* Serialize vs sriov_numvfs_store() so readers see valid num_VFs */
-	device_lock(&pdev->dev);
-	num_vfs = pdev->sriov->num_VFs;
-	device_unlock(&pdev->dev);
 
-	return sysfs_emit(buf, "%u\n", num_vfs);
+	return sysfs_emit(buf, "%u\n", pdev->sriov->num_VFs);
 }
 
 /*