* [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable() [not found] <CGME20231213185829uscas1p2fc3ee6a9c92bff3cc9a043a9ff93bd27@uscas1p2.samsung.com> @ 2023-12-13 18:58 ` Jim Harris 2023-12-13 19:26 ` Bjorn Helgaas 0 siblings, 1 reply; 3+ messages in thread From: Jim Harris @ 2023-12-13 18:58 UTC (permalink / raw) To: Bjorn Helgaas, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Leon Romanovsky, Jason Gunthorpe, Alex Williamson Wait to call kobject_uevent() until all of the associated changes are done, including updating the num_VFs value. Suggested by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jim Harris <jim.harris@samsung.com> --- drivers/pci/iov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 25dbe85c4217..3b768e20c7ab 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -683,8 +683,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) if (rc) goto err_pcibios; - kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); iov->num_VFs = nr_virtfn; + kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); return 0; ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable() 2023-12-13 18:58 ` [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable() Jim Harris @ 2023-12-13 19:26 ` Bjorn Helgaas [not found] ` <CGME20231215221118uscas1p1b407f67deb53a75ae03d67247653b30b@uscas1p1.samsung.com> 0 siblings, 1 reply; 3+ messages in thread From: Bjorn Helgaas @ 2023-12-13 19:26 UTC (permalink / raw) To: Jim Harris Cc: Bjorn Helgaas, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Leon Romanovsky, Jason Gunthorpe, Alex Williamson On Wed, Dec 13, 2023 at 06:58:28PM +0000, Jim Harris wrote: > Wait to call kobject_uevent() until all of the associated changes are done, > including updating the num_VFs value. This seems right to me. Can we add a little rationale to the commit log? E.g., something about how num_VFs is visible to userspace via sysfs and we don't want a race between (a) userspace reading num_VFs because of KOBJ_CHANGE and (b) the kernel updating num_VFs? (If that's the actual reason.) If there's a problem report about this, include that reference as well. > Suggested by: Leon Romanovsky <leonro@nvidia.com> > Signed-off-by: Jim Harris <jim.harris@samsung.com> > --- > drivers/pci/iov.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c > index 25dbe85c4217..3b768e20c7ab 100644 > --- a/drivers/pci/iov.c > +++ b/drivers/pci/iov.c > @@ -683,8 +683,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) > if (rc) > goto err_pcibios; > > - kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); > iov->num_VFs = nr_virtfn; > + kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); > > return 0; > > ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CGME20231215221118uscas1p1b407f67deb53a75ae03d67247653b30b@uscas1p1.samsung.com>]
* Re: [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable() [not found] ` <CGME20231215221118uscas1p1b407f67deb53a75ae03d67247653b30b@uscas1p1.samsung.com> @ 2023-12-15 22:11 ` Jim Harris 0 siblings, 0 replies; 3+ messages in thread From: Jim Harris @ 2023-12-15 22:11 UTC (permalink / raw) To: Bjorn Helgaas Cc: Bjorn Helgaas, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Leon Romanovsky, Jason Gunthorpe, Alex Williamson On Wed, Dec 13, 2023 at 01:26:52PM -0600, Bjorn Helgaas wrote: > On Wed, Dec 13, 2023 at 06:58:28PM +0000, Jim Harris wrote: > > Wait to call kobject_uevent() until all of the associated changes are done, > > including updating the num_VFs value. > > This seems right to me. Can we add a little rationale to the commit > log? E.g., something about how num_VFs is visible to userspace via > sysfs and we don't want a race between (a) userspace reading num_VFs > because of KOBJ_CHANGE and (b) the kernel updating num_VFs? (If > that's the actual reason.) > > If there's a problem report about this, include that reference as > well. There's a second patch that I haven't pushed yet that has more of the rationale that led to this suggestion from Leon - see thread "Locking between vfio hot-remove..." I'll push the two patches as a series. The second patch will effectively revert 35ff867b7, since Leon felt the reasoning behind that patch was incorrect. I'll tie all of that into the cover letter. -Jim > > > Suggested by: Leon Romanovsky <leonro@nvidia.com> > > Signed-off-by: Jim Harris <jim.harris@samsung.com> > > --- > > drivers/pci/iov.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c > > index 25dbe85c4217..3b768e20c7ab 100644 > > --- a/drivers/pci/iov.c > > +++ b/drivers/pci/iov.c > > @@ -683,8 +683,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) > > if (rc) > > goto err_pcibios; > > > > - kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); > > iov->num_VFs = nr_virtfn; > > + kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); > > > > return 0; > > > > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-15 22:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20231213185829uscas1p2fc3ee6a9c92bff3cc9a043a9ff93bd27@uscas1p2.samsung.com>
2023-12-13 18:58 ` [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable() Jim Harris
2023-12-13 19:26 ` Bjorn Helgaas
[not found] ` <CGME20231215221118uscas1p1b407f67deb53a75ae03d67247653b30b@uscas1p1.samsung.com>
2023-12-15 22:11 ` Jim Harris
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).