From: Bjorn Helgaas <helgaas@kernel.org>
To: Yazen Ghannam <yazen.ghannam@amd.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
bhelgaas@google.com, Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER
Date: Fri, 20 Nov 2026 19:31:25 -0600 [thread overview]
Message-ID: <20261121013125.GA934416@bhelgaas> (raw)
In-Reply-To: <20261110215614.3931232-5-yazen.ghannam@amd.com>
[+cc Lukas]
On Tue, Nov 10, 2026 at 03:56:14PM -0600, Yazen Ghannam wrote:
> aer_attr_group is a named group, so sysfs creates an "aer" directory for
> every PCI device. aer_attrs_are_visible() hides the attributes when the
> device has no aer_info.
>
> But this doesn't apply to the entire "aer" group. So devices without AER
> end up having an empty "aer" directory.
This applies specifically to the ratelimit-related things in the "aer"
directory, right? If so I might amend this commit log to mention
that, since Lukas's subsequent "PCI/AER: Enable baseline capability
error reporting" enables aer_dev_correctable, aer_dev_fatal, etc even
for non-AER PCIe devices.
"aer_attrs" and "aer_attr_group" are kind of unfortunate names since
they're specific to ratelimiting. But that's material for future
work.
At least they're internal so they're easier to change than
"aer_dev_correctable" etc, which are even more unfortunate now.
> Switch to DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE() which can use a single
> check for all the AER attributes.
>
> Fixes: b4fe7398def6 ("PCI/AER: Add sysfs attributes for log ratelimits")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/linux-pci/20260714191826.BA81E1F000E9@smtp.kernel.org/
> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> ---
> drivers/pci/pcie/aer.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 32a4c9101946..5ea81a506a06 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -778,22 +778,19 @@ static struct attribute *aer_attrs[] = {
> NULL
> };
>
> -static umode_t aer_attrs_are_visible(struct kobject *kobj,
> - struct attribute *a, int n)
> +static bool aer_group_visible(struct kobject *kobj)
> {
> - struct device *dev = kobj_to_dev(kobj);
> - struct pci_dev *pdev = to_pci_dev(dev);
> + struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
>
> - if (!pdev->aer_info)
> - return 0;
> -
> - return a->mode;
> + return !!pdev->aer_info;
> }
>
> +DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(aer);
> +
> const struct attribute_group aer_attr_group = {
> .name = "aer",
> .attrs = aer_attrs,
> - .is_visible = aer_attrs_are_visible,
> + .is_visible = SYSFS_GROUP_VISIBLE(aer),
> };
>
> static void pci_dev_aer_stats_incr(struct pci_dev *pdev,
> --
> 2.55.0
>
next prev parent reply other threads:[~2026-11-21 1:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 21:56 [PATCH 0/4] AER sysfs fixes Yazen Ghannam
2026-11-10 21:56 ` [PATCH 1/4] MAINTAINERS: Add the AER sysfs ABI file to PCI SUBSYSTEM Yazen Ghannam
2026-11-10 21:56 ` [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero Yazen Ghannam
2026-11-20 18:10 ` Bjorn Helgaas
2026-11-20 21:13 ` Yazen Ghannam
2026-11-21 0:12 ` Bjorn Helgaas
2026-11-10 21:56 ` [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds Yazen Ghannam
2026-11-18 16:39 ` Sang-Heon Jeon
2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam
2026-11-21 1:31 ` Bjorn Helgaas [this message]
2026-11-19 0:02 ` [PATCH 0/4] AER sysfs fixes Bjorn Helgaas
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=20261121013125.GA934416@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=yazen.ghannam@amd.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
all inboxes | Powered by JetHome®