From: Bjorn Helgaas <helgaas@kernel.org>
To: Jim Harris <jim.harris@samsung.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Leon Romanovsky <leonro@nvidia.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [PATCH] pci/iov: fix kobject_uevent() ordering in sriov_enable()
Date: Wed, 13 Dec 2023 13:26:52 -0600 [thread overview]
Message-ID: <20231213192652.GA1054534@bhelgaas> (raw)
In-Reply-To: <170249390826.436889.13896090394795622449.stgit@bgt-140510-bm01.eng.stellus.in>
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;
>
>
next prev parent reply other threads:[~2023-12-13 19:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
2023-12-15 22:11 ` Jim Harris
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=20231213192652.GA1054534@bhelgaas \
--to=helgaas@kernel.org \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=jgg@nvidia.com \
--cc=jim.harris@samsung.com \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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