From: Leon Romanovsky <leonro@nvidia.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Kuppuswamy Sathyanarayanan"
<sathyanarayanan.kuppuswamy@linux.intel.com>,
"Jim Harris" <jim.harris@samsung.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Pierre Crégut" <pierre.cregut@orange.com>
Subject: Re: [PATCH v2 1/2] PCI/IOV: Revert "PCI/IOV: Serialize sysfs sriov_numvfs reads vs writes"
Date: Wed, 14 Feb 2024 09:16:18 +0200 [thread overview]
Message-ID: <20240214071618.GE52640@unreal> (raw)
In-Reply-To: <20240213194556.GA1219770@bhelgaas>
On Tue, Feb 13, 2024 at 01:45:56PM -0600, Bjorn Helgaas wrote:
> On Tue, Feb 13, 2024 at 07:46:02PM +0200, Leon Romanovsky wrote:
> > On Tue, Feb 13, 2024 at 09:59:54AM -0600, Bjorn Helgaas wrote:
> > ...
>
> > > I guess that means that if we apply this revert, the problem Pierre
> > > reported will return. Obviously the deadlock is more important than
> > > the inconsistency Pierre observed, but from the user's point of view
> > > this will look like a regression.
> > >
> > > Maybe listening to netlink and then looking at sysfs isn't the
> > > "correct" way to do this, but I don't want to just casually break
> > > existing user code. If we do contemplate doing the revert, at the
> > > very least we should include specific details about what the user code
> > > *should* do instead, at the level of the actual commands to use
> > > instead of "ip monitor dev; cat ${path}/device/sriov_numvfs".
> >
> > udevadm monitor will do the trick.
> >
> > Another possible solution is to refactor the code to make sure that
> > .probe on VFs happens only after sriov_numvfs is updated.
>
> I like the idea of refactoring it so as to preserve the existing
> ordering while also fixing the deadlock.
I think something like this will be enough (not tested). It will et the number of VFs
before we make VFs visible to probe:
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index aaa33e8dc4c9..0cdfaae80594 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -679,12 +679,14 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
msleep(100);
pci_cfg_access_unlock(dev);
+ iov->num_VFs = nr_virtfn;
rc = sriov_add_vfs(dev, initial);
- if (rc)
+ if (rc) {
+ iov->num_VFs = 0;
goto err_pcibios;
+ }
kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
- iov->num_VFs = nr_virtfn;
return 0;
next prev parent reply other threads:[~2024-02-14 7:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240209235208uscas1p26c658c64cc85711cd3aa6312224164fc@uscas1p2.samsung.com>
2024-02-09 23:52 ` [PATCH v2 0/2] PCI/IOV: sriov_numvfs bug fixes Jim Harris
2024-02-09 23:52 ` [PATCH v2 1/2] PCI/IOV: Revert "PCI/IOV: Serialize sysfs sriov_numvfs reads vs writes" Jim Harris
2024-02-10 3:20 ` Kuppuswamy Sathyanarayanan
2024-02-11 8:48 ` Leon Romanovsky
2024-02-11 19:15 ` Kuppuswamy Sathyanarayanan
2024-02-12 9:31 ` Leon Romanovsky
2024-02-12 20:27 ` Bjorn Helgaas
2024-02-12 22:59 ` Jim Harris
2024-02-13 7:37 ` Leon Romanovsky
2024-02-13 9:40 ` pierre.cregut
2024-02-13 14:59 ` Jason Gunthorpe
2024-02-13 7:34 ` Leon Romanovsky
2024-02-13 15:59 ` Bjorn Helgaas
2024-02-13 17:46 ` Leon Romanovsky
2024-02-13 18:00 ` Kuppuswamy Sathyanarayanan
2024-02-13 19:45 ` Bjorn Helgaas
2024-02-14 7:16 ` Leon Romanovsky [this message]
2024-02-14 17:04 ` Jim Harris
2024-02-14 17:50 ` Bjorn Helgaas
2024-02-14 22:55 ` Jim Harris
2024-02-09 23:52 ` [PATCH v2 2/2] pci/iov: fix kobject_uevent() ordering in sriov_enable() Jim Harris
2024-02-10 3:22 ` Kuppuswamy Sathyanarayanan
2024-02-12 15:17 ` Keith Busch
2024-02-12 15:29 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240214071618.GE52640@unreal \
--to=leonro@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=jgg@nvidia.com \
--cc=jim.harris@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=pierre.cregut@orange.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox