* [PATCH 0/4] AER sysfs fixes
@ 2026-11-10 21:56 Yazen Ghannam
2026-11-10 21:56 ` [PATCH 1/4] MAINTAINERS: Add the AER sysfs ABI file to PCI SUBSYSTEM Yazen Ghannam
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Yazen Ghannam @ 2026-11-10 21:56 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, bhelgaas
Hi all,
This series includes fixes for issues reported by Sashiko on the Flit
logging v1 set and were included in v2 of that set. But I figured it
might be better to send these separately since these are independent of
the Flit logging capability feature.
Thanks,
Yazen
Link:
https://lore.kernel.org/20260918145619.3016889-1-yazen.ghannam@amd.com
Yazen Ghannam (4):
MAINTAINERS: Add the AER sysfs ABI file to PCI SUBSYSTEM
PCI/AER: Clamp negative ratelimit burst to zero
PCI/AER: Report the ratelimit interval in milliseconds
PCI/AER: Hide the "aer" sysfs directory on devices without AER
.../ABI/testing/sysfs-bus-pci-devices-aer | 21 ++++++++++++------
MAINTAINERS | 1 +
drivers/pci/pcie/aer.c | 22 +++++++++----------
3 files changed, 26 insertions(+), 18 deletions(-)
base-commit: 6d69eeae8966bc3bea0facbd550f45ef9de41cc4
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/4] MAINTAINERS: Add the AER sysfs ABI file to PCI SUBSYSTEM 2026-11-10 21:56 [PATCH 0/4] AER sysfs fixes Yazen Ghannam @ 2026-11-10 21:56 ` Yazen Ghannam 2026-11-10 21:56 ` [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero Yazen Ghannam ` (3 subsequent siblings) 4 siblings, 0 replies; 9+ messages in thread From: Yazen Ghannam @ 2026-11-10 21:56 UTC (permalink / raw) To: linux-pci; +Cc: linux-kernel, bhelgaas, Yazen Ghannam get_maintainer.pl returns only the LKML catch-all for Documentation/ABI/testing/sysfs-bus-pci-devices-aer, so changes to the documented AER sysfs interface do not reach linux-pci. Add the file to the PCI SUBSYSTEM entry. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 93abbb315065..b109c9f8aad6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21609,6 +21609,7 @@ Q: https://patchwork.kernel.org/project/linux-pci/list/ B: https://bugzilla.kernel.org C: irc://irc.oftc.net/linux-pci T: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git +F: Documentation/ABI/testing/sysfs-bus-pci-devices-aer F: Documentation/ABI/testing/sysfs-devices-pci-host-bridge F: Documentation/PCI/ F: Documentation/devicetree/bindings/pci/ -- 2.55.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero 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 ` Yazen Ghannam 2026-11-20 18:10 ` Bjorn Helgaas 2026-11-10 21:56 ` [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds Yazen Ghannam ` (2 subsequent siblings) 4 siblings, 1 reply; 9+ messages in thread From: Yazen Ghannam @ 2026-11-10 21:56 UTC (permalink / raw) To: linux-pci; +Cc: linux-kernel, bhelgaas, Yazen Ghannam The correctable and nonfatal "_ratelimit_burst" attributes store whatever kstrtoint() parses, so a negative value lands directly in ratelimit_state.burst. ___ratelimit() reads a negative burst as an uninitialized ratelimit_state and gives a WARNing. Clamp negative values to zero and document the clamping behavior. 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> --- .../ABI/testing/sysfs-bus-pci-devices-aer | 21 ++++++++++++------- drivers/pci/pcie/aer.c | 3 +++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer index 5ed284523956..215cf8bd4c30 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer @@ -130,9 +130,10 @@ What: /sys/bus/pci/devices/<dev>/aer/correctable_ratelimit_interval_ms Date: May 2025 KernelVersion: 6.16.0 Contact: linux-pci@vger.kernel.org -Description: Writing 0 disables AER correctable error log ratelimiting. - Writing a positive value sets the ratelimit interval in ms. - Default is DEFAULT_RATELIMIT_INTERVAL (5000 ms). +Description: Writing 0, or any negative value, disables AER correctable + error log ratelimiting. Writing a positive value sets the + ratelimit interval in ms. Default is + DEFAULT_RATELIMIT_INTERVAL (5000 ms). What: /sys/bus/pci/devices/<dev>/aer/correctable_ratelimit_burst Date: May 2025 @@ -143,14 +144,17 @@ Description: Ratelimit burst for correctable error logs. Writing a value before ratelimiting. Reading gets the current ratelimit burst. Default is DEFAULT_RATELIMIT_BURST (10). + Writing 0, or any negative value, suppresses all logs + unless the interval attribute is also 0. + What: /sys/bus/pci/devices/<dev>/aer/nonfatal_ratelimit_interval_ms Date: May 2025 KernelVersion: 6.16.0 Contact: linux-pci@vger.kernel.org -Description: Writing 0 disables AER non-fatal uncorrectable error log - ratelimiting. Writing a positive value sets the ratelimit - interval in ms. Default is DEFAULT_RATELIMIT_INTERVAL - (5000 ms). +Description: Writing 0, or any negative value, disables AER non-fatal + uncorrectable error log ratelimiting. Writing a positive + value sets the ratelimit interval in ms. Default is + DEFAULT_RATELIMIT_INTERVAL (5000 ms). What: /sys/bus/pci/devices/<dev>/aer/nonfatal_ratelimit_burst Date: May 2025 @@ -161,3 +165,6 @@ Description: Ratelimit burst for non-fatal uncorrectable error logs. allowed per interval before ratelimiting. Reading gets the current ratelimit burst. Default is DEFAULT_RATELIMIT_BURST (10). + + Writing 0, or any negative value, suppresses all logs + unless the interval attribute is also 0. diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 6f2460231422..401cd3a1b3d0 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -752,6 +752,9 @@ const struct attribute_group aer_stats_attr_group = { if (kstrtoint(buf, 0, &burst) < 0) \ return -EINVAL; \ \ + if (burst < 0) \ + burst = 0; \ + \ pdev->aer_info->ratelimit.burst = burst; \ \ return count; \ -- 2.55.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero 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 0 siblings, 1 reply; 9+ messages in thread From: Bjorn Helgaas @ 2026-11-20 18:10 UTC (permalink / raw) To: Yazen Ghannam Cc: linux-pci, linux-kernel, bhelgaas, Lukas Wunner, Kuppuswamy Sathyanarayanan, Jon Pan-Doh [+cc Lukas, Sathya, Jon] On Tue, Nov 10, 2026 at 03:56:12PM -0600, Yazen Ghannam wrote: > The correctable and nonfatal "_ratelimit_burst" attributes store > whatever kstrtoint() parses, so a negative value lands directly in > ratelimit_state.burst. > > ___ratelimit() reads a negative burst as an uninitialized > ratelimit_state and gives a WARNing. > > Clamp negative values to zero and document the clamping behavior. > ... > 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> > --- > .../ABI/testing/sysfs-bus-pci-devices-aer | 21 ++++++++++++------- > drivers/pci/pcie/aer.c | 3 +++ > 2 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer > index 5ed284523956..215cf8bd4c30 100644 > --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer > +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer > @@ -130,9 +130,10 @@ What: /sys/bus/pci/devices/<dev>/aer/correctable_ratelimit_interval_ms > Date: May 2025 > KernelVersion: 6.16.0 > Contact: linux-pci@vger.kernel.org > -Description: Writing 0 disables AER correctable error log ratelimiting. > - Writing a positive value sets the ratelimit interval in ms. > - Default is DEFAULT_RATELIMIT_INTERVAL (5000 ms). > +Description: Writing 0, or any negative value, disables AER correctable > + error log ratelimiting. Writing a positive value sets the > + ratelimit interval in ms. Default is > + DEFAULT_RATELIMIT_INTERVAL (5000 ms). > > What: /sys/bus/pci/devices/<dev>/aer/correctable_ratelimit_burst > Date: May 2025 > @@ -143,14 +144,17 @@ Description: Ratelimit burst for correctable error logs. Writing a value > before ratelimiting. Reading gets the current ratelimit > burst. Default is DEFAULT_RATELIMIT_BURST (10). > > + Writing 0, or any negative value, suppresses all logs > + unless the interval attribute is also 0. > + > What: /sys/bus/pci/devices/<dev>/aer/nonfatal_ratelimit_interval_ms > Date: May 2025 > KernelVersion: 6.16.0 > Contact: linux-pci@vger.kernel.org > -Description: Writing 0 disables AER non-fatal uncorrectable error log > - ratelimiting. Writing a positive value sets the ratelimit > - interval in ms. Default is DEFAULT_RATELIMIT_INTERVAL > - (5000 ms). > +Description: Writing 0, or any negative value, disables AER non-fatal > + uncorrectable error log ratelimiting. Writing a positive > + value sets the ratelimit interval in ms. Default is > + DEFAULT_RATELIMIT_INTERVAL (5000 ms). > > What: /sys/bus/pci/devices/<dev>/aer/nonfatal_ratelimit_burst > Date: May 2025 > @@ -161,3 +165,6 @@ Description: Ratelimit burst for non-fatal uncorrectable error logs. > allowed per interval before ratelimiting. Reading gets the > current ratelimit burst. Default is DEFAULT_RATELIMIT_BURST > (10). > + > + Writing 0, or any negative value, suppresses all logs > + unless the interval attribute is also 0. > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index 6f2460231422..401cd3a1b3d0 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -752,6 +752,9 @@ const struct attribute_group aer_stats_attr_group = { > if (kstrtoint(buf, 0, &burst) < 0) \ > return -EINVAL; \ > \ > + if (burst < 0) \ > + burst = 0; \ Why don't we just return -EINVAL if the user writes a negative value to either *_ratelimit_interval_ms or *_ratelimit_burst? I don't think there's any reasonable interpretation of negative values in either case. Any non-negative value for the interval makes sense (0 disables). Any positive value makes sense for burst; I don't know what a 0 burst value could mean, so maybe that should be an error too? > pdev->aer_info->ratelimit.burst = burst; \ > \ > return count; \ > -- > 2.55.0 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero 2026-11-20 18:10 ` Bjorn Helgaas @ 2026-11-20 21:13 ` Yazen Ghannam 0 siblings, 0 replies; 9+ messages in thread From: Yazen Ghannam @ 2026-11-20 21:13 UTC (permalink / raw) To: Bjorn Helgaas Cc: linux-pci, linux-kernel, bhelgaas, Lukas Wunner, Kuppuswamy Sathyanarayanan, Jon Pan-Doh On Fri, Nov 20, 2026 at 12:10:43PM -0600, Bjorn Helgaas wrote: > [+cc Lukas, Sathya, Jon] > > On Tue, Nov 10, 2026 at 03:56:12PM -0600, Yazen Ghannam wrote: > > The correctable and nonfatal "_ratelimit_burst" attributes store > > whatever kstrtoint() parses, so a negative value lands directly in > > ratelimit_state.burst. > > > > ___ratelimit() reads a negative burst as an uninitialized > > ratelimit_state and gives a WARNing. > > > > Clamp negative values to zero and document the clamping behavior. > > ... > > > 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> > > --- > > .../ABI/testing/sysfs-bus-pci-devices-aer | 21 ++++++++++++------- > > drivers/pci/pcie/aer.c | 3 +++ > > 2 files changed, 17 insertions(+), 7 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer > > index 5ed284523956..215cf8bd4c30 100644 > > --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer > > +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer > > @@ -130,9 +130,10 @@ What: /sys/bus/pci/devices/<dev>/aer/correctable_ratelimit_interval_ms > > Date: May 2025 > > KernelVersion: 6.16.0 > > Contact: linux-pci@vger.kernel.org > > -Description: Writing 0 disables AER correctable error log ratelimiting. > > - Writing a positive value sets the ratelimit interval in ms. > > - Default is DEFAULT_RATELIMIT_INTERVAL (5000 ms). > > +Description: Writing 0, or any negative value, disables AER correctable > > + error log ratelimiting. Writing a positive value sets the > > + ratelimit interval in ms. Default is > > + DEFAULT_RATELIMIT_INTERVAL (5000 ms). > > > > What: /sys/bus/pci/devices/<dev>/aer/correctable_ratelimit_burst > > Date: May 2025 > > @@ -143,14 +144,17 @@ Description: Ratelimit burst for correctable error logs. Writing a value > > before ratelimiting. Reading gets the current ratelimit > > burst. Default is DEFAULT_RATELIMIT_BURST (10). > > > > + Writing 0, or any negative value, suppresses all logs > > + unless the interval attribute is also 0. > > + > > What: /sys/bus/pci/devices/<dev>/aer/nonfatal_ratelimit_interval_ms > > Date: May 2025 > > KernelVersion: 6.16.0 > > Contact: linux-pci@vger.kernel.org > > -Description: Writing 0 disables AER non-fatal uncorrectable error log > > - ratelimiting. Writing a positive value sets the ratelimit > > - interval in ms. Default is DEFAULT_RATELIMIT_INTERVAL > > - (5000 ms). > > +Description: Writing 0, or any negative value, disables AER non-fatal > > + uncorrectable error log ratelimiting. Writing a positive > > + value sets the ratelimit interval in ms. Default is > > + DEFAULT_RATELIMIT_INTERVAL (5000 ms). > > > > What: /sys/bus/pci/devices/<dev>/aer/nonfatal_ratelimit_burst > > Date: May 2025 > > @@ -161,3 +165,6 @@ Description: Ratelimit burst for non-fatal uncorrectable error logs. > > allowed per interval before ratelimiting. Reading gets the > > current ratelimit burst. Default is DEFAULT_RATELIMIT_BURST > > (10). > > + > > + Writing 0, or any negative value, suppresses all logs > > + unless the interval attribute is also 0. > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > > index 6f2460231422..401cd3a1b3d0 100644 > > --- a/drivers/pci/pcie/aer.c > > +++ b/drivers/pci/pcie/aer.c > > @@ -752,6 +752,9 @@ const struct attribute_group aer_stats_attr_group = { > > if (kstrtoint(buf, 0, &burst) < 0) \ > > return -EINVAL; \ > > \ > > + if (burst < 0) \ > > + burst = 0; \ > > Why don't we just return -EINVAL if the user writes a negative value > to either *_ratelimit_interval_ms or *_ratelimit_burst? > > I don't think there's any reasonable interpretation of negative > values in either case. > Right, that's fair. I think the reason to clamp was to be consistent with the current code. Would you like a follow up patch? > Any non-negative value for the interval makes sense (0 disables). > > Any positive value makes sense for burst; I don't know what a 0 burst > value could mean, so maybe that should be an error too? > "burst == 0" came from here: 084a990ded63 ("ratelimit: Allow zero ->burst to disable ratelimiting") IIUC, the goal is to **always** hide/disable the messages. IOW, keep logging the errors internally based on the interval, but don't print any kernel messages for them. The user can still get the error logs from the trace event and leave the kernel buffer alone. Thanks, Yazen ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds 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-10 21:56 ` 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-19 0:02 ` [PATCH 0/4] AER sysfs fixes Bjorn Helgaas 4 siblings, 1 reply; 9+ messages in thread From: Yazen Ghannam @ 2026-11-10 21:56 UTC (permalink / raw) To: linux-pci; +Cc: linux-kernel, bhelgaas, Yazen Ghannam The "*_ratelimit_interval_ms" attributes convert milliseconds to jiffies when storing. But they don't convert jiffies to milliseconds when showing. So the user is presented with the raw jiffies value. Do the jiffies to milliseconds conversion when showing the value. Fixes: b4fe7398def6 ("PCI/AER: Add sysfs attributes for log ratelimits") Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> --- drivers/pci/pcie/aer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 401cd3a1b3d0..32a4c9101946 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -699,9 +699,9 @@ const struct attribute_group aer_stats_attr_group = { char *buf) \ { \ struct pci_dev *pdev = to_pci_dev(dev); \ + unsigned long iv = pdev->aer_info->ratelimit.interval; \ \ - return sysfs_emit(buf, "%d\n", \ - pdev->aer_info->ratelimit.interval); \ + return sysfs_emit(buf, "%u\n", jiffies_to_msecs(iv)); \ } \ \ static ssize_t \ -- 2.55.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds 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 0 siblings, 0 replies; 9+ messages in thread From: Sang-Heon Jeon @ 2026-11-18 16:39 UTC (permalink / raw) To: Yazen Ghannam; +Cc: linux-pci, linux-kernel, bhelgaas On Tue, Nov 10, 2026 at 03:56:13PM -0600, Yazen Ghannam wrote: > The "*_ratelimit_interval_ms" attributes convert milliseconds to jiffies > when storing. But they don't convert jiffies to milliseconds when > showing. So the user is presented with the raw jiffies value. > > Do the jiffies to milliseconds conversion when showing the value. > > Fixes: b4fe7398def6 ("PCI/AER: Add sysfs attributes for log ratelimits") > Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> > --- > drivers/pci/pcie/aer.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index 401cd3a1b3d0..32a4c9101946 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -699,9 +699,9 @@ const struct attribute_group aer_stats_attr_group = { > char *buf) \ > { \ > struct pci_dev *pdev = to_pci_dev(dev); \ > + unsigned long iv = pdev->aer_info->ratelimit.interval; \ > \ > - return sysfs_emit(buf, "%d\n", \ > - pdev->aer_info->ratelimit.interval); \ > + return sysfs_emit(buf, "%u\n", jiffies_to_msecs(iv)); \ > } \ > \ > static ssize_t \ I found a similar issue in other subsystems, and this looks good to me. Reviewed-by: Sang-Heon Jeon <ekffu200098@gmail.com> Best Regards, Sang-Heon Jeon ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER 2026-11-10 21:56 [PATCH 0/4] AER sysfs fixes Yazen Ghannam ` (2 preceding siblings ...) 2026-11-10 21:56 ` [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds Yazen Ghannam @ 2026-11-10 21:56 ` Yazen Ghannam 2026-11-19 0:02 ` [PATCH 0/4] AER sysfs fixes Bjorn Helgaas 4 siblings, 0 replies; 9+ messages in thread From: Yazen Ghannam @ 2026-11-10 21:56 UTC (permalink / raw) To: linux-pci; +Cc: linux-kernel, bhelgaas, Yazen Ghannam 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. 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] AER sysfs fixes 2026-11-10 21:56 [PATCH 0/4] AER sysfs fixes Yazen Ghannam ` (3 preceding siblings ...) 2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam @ 2026-11-19 0:02 ` Bjorn Helgaas 4 siblings, 0 replies; 9+ messages in thread From: Bjorn Helgaas @ 2026-11-19 0:02 UTC (permalink / raw) To: Yazen Ghannam; +Cc: linux-pci, linux-kernel, bhelgaas On Tue, Nov 10, 2026 at 03:56:10PM -0600, Yazen Ghannam wrote: > Hi all, > > This series includes fixes for issues reported by Sashiko on the Flit > logging v1 set and were included in v2 of that set. But I figured it > might be better to send these separately since these are independent of > the Flit logging capability feature. > > Thanks, > Yazen > > Link: > https://lore.kernel.org/20260918145619.3016889-1-yazen.ghannam@amd.com > > Yazen Ghannam (4): > MAINTAINERS: Add the AER sysfs ABI file to PCI SUBSYSTEM > PCI/AER: Clamp negative ratelimit burst to zero > PCI/AER: Report the ratelimit interval in milliseconds > PCI/AER: Hide the "aer" sysfs directory on devices without AER > > .../ABI/testing/sysfs-bus-pci-devices-aer | 21 ++++++++++++------ > MAINTAINERS | 1 + > drivers/pci/pcie/aer.c | 22 +++++++++---------- > 3 files changed, 26 insertions(+), 18 deletions(-) Looks nice, applied to pci/aer for v7.5, thank you! ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-20 21:13 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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-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-19 0:02 ` [PATCH 0/4] AER sysfs fixes Bjorn Helgaas
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®