From: Lukas Wunner <lukas@wunner.de>
To: Alistair Francis <alistair23@gmail.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
Jonathan.Cameron@huawei.com, alex.williamson@redhat.com,
christian.koenig@amd.com, kch@nvidia.com,
gregkh@linuxfoundation.org, logang@deltatee.com,
linux-kernel@vger.kernel.org,
Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH v3] PCI/DOE: Expose the DOE protocols via sysfs
Date: Sat, 12 Aug 2023 10:15:26 +0200 [thread overview]
Message-ID: <20230812081526.GC9469@wunner.de> (raw)
In-Reply-To: <CAKmqyKPm_BFnNxVLXCO_PVRDJaVb+XOj=kEEzXd+MgkwDiZhXA@mail.gmail.com>
On Thu, Aug 10, 2023 at 11:34:11AM -0400, Alistair Francis wrote:
> On Thu, Aug 10, 2023 at 3:34???AM Lukas Wunner <lukas@wunner.de> wrote:
> > On Wed, Aug 09, 2023 at 07:28:51PM -0400, Alistair Francis wrote:
> > > --- a/drivers/pci/pci-sysfs.c
> > > +++ b/drivers/pci/pci-sysfs.c
> > > @@ -1226,6 +1227,12 @@ static int pci_create_resource_files(struct pci_dev *pdev)
> > > int i;
> > > int retval;
> > >
> > > +#ifdef CONFIG_PCI_DOE
> > > + retval = doe_sysfs_init(pdev);
> > > + if (retval)
> > > + return retval;
> > > +#endif
> > > +
> >
> > The preferred way to expose PCI sysfs attributes nowadays is to add them
> > to pci_dev_attr_groups[] and use the ->is_visible callback to check
> > whether they're applicable to a particular pci_dev. The alternative
> > via pci_create_resource_files() has race conditions which I think
> > still haven't been fixed. Bjorn recommended the ->is_visible approach
> > in response to the most recent attempt to fix the race:
> >
> > https://lore.kernel.org/linux-pci/20230427161458.GA249886@bhelgaas/
>
> The is_visible doen't seem to work in this case.
>
> AFAIK is_visible only applies to the attributes under the group. Which
> means that every PCIe device will see a `doe_protos` directory, no
> matter if DOE is supported.
internal_create_group() in fs/sysfs/group.c does this:
if (grp->name) {
...
kn = kernfs_create_dir_ns(kobj->sd, grp->name, ...
So I'm under the impression that if you set the ->name member of
struct attribute_group, the attributes in that group appear under
a directory of that name.
In fact, the kernel-doc for struct attribute_group claims as much:
* struct attribute_group - data structure used to declare an attribute group.
* @name: Optional: Attribute group name
* If specified, the attribute group will be created in
* a new subdirectory with this name.
So I don't quite understand why you think that "every PCIe device will
see a `doe_protos` directory, no matter if DOE is supported"?
Am I missing something?
Thanks,
Lukas
next prev parent reply other threads:[~2023-08-12 8:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 23:28 [PATCH v3] PCI/DOE: Expose the DOE protocols via sysfs Alistair Francis
2023-08-09 23:43 ` Randy Dunlap
2023-08-10 0:13 ` Chaitanya Kulkarni
2023-08-10 5:05 ` Greg KH
2023-08-10 7:44 ` Lukas Wunner
2023-08-10 7:48 ` Greg KH
2023-08-10 7:34 ` Lukas Wunner
2023-08-10 15:34 ` Alistair Francis
2023-08-12 8:15 ` Lukas Wunner [this message]
2023-08-12 8:26 ` Greg KH
2023-08-15 13:44 ` Alistair Francis
2023-08-15 15:11 ` Greg KH
2023-08-15 19:50 ` Alistair Francis
2023-08-15 20:10 ` Greg KH
2023-08-17 19:41 ` Alistair Francis
2023-08-17 20:21 ` Greg KH
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=20230812081526.GC9469@wunner.de \
--to=lukas@wunner.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=alex.williamson@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.