* [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
` (3 more replies)
0 siblings, 4 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
` (2 subsequent siblings)
3 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 related [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-10 22:02 ` sashiko-bot
2026-11-10 21:56 ` [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds Yazen Ghannam
2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam
3 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 related [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-10 22:00 ` sashiko-bot
2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam
3 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 related [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-10 22:00 ` sashiko-bot
3 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
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 related [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-10 22:00 ` sashiko-bot
0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-10 22:00 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
> 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>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110215614.3931232-1-yazen.ghannam@amd.com?part=3
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER
2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam
@ 2026-11-10 22:00 ` sashiko-bot
0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-10 22:00 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
> 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>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110215614.3931232-1-yazen.ghannam@amd.com?part=4
^ 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-10 22:02 ` sashiko-bot
2026-11-10 22:11 ` Yazen Ghannam
0 siblings, 1 reply; 9+ messages in thread
From: sashiko-bot @ 2026-11-10 22:02 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] PCI/AER: incorrect unit scaling in
aer_ratelimit_interval_attr() [1]
--
commit 3e212613eb554aa7ec8ef93c898bf101c6bb444e
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI/AER: Clamp negative ratelimit burst to zero
This commit clamps negative values written to the AER ratelimit burst sysfs
attributes to zero and updates the ABI documentation accordingly.
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 6f24602314225..401cd3a1b3d0e 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; \
[Severity: Medium]
This problem wasn't introduced by this patch, but shouldn't the companion
aer_ratelimit_interval_attr() macro convert pdev->aer_info->ratelimit.interval
back with jiffies_to_msecs() in name##_show() [1]?
drivers/pci/pcie/aer.c:aer_ratelimit_interval_attr() {
static ssize_t \
name##_show(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct pci_dev *pdev = to_pci_dev(dev); \
\
return sysfs_emit(buf, "%d\n", \
pdev->aer_info->ratelimit.interval); \
} \
...
if (interval <= 0) \
interval = 0; \
else \
interval = msecs_to_jiffies(interval); \
\
pdev->aer_info->ratelimit.interval = interval; \
}
name##_store() converts the millisecond value into jiffies before storing it,
so reading *_ratelimit_interval_ms back emits raw jiffies instead of
milliseconds when HZ != 1000.
[1] https://sashiko.dev/#/bug/linux-3e0972eb-98a1-4365-b40e-82736dd85f13
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110215614.3931232-1-yazen.ghannam@amd.com?part=2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero
2026-11-10 22:02 ` sashiko-bot
@ 2026-11-10 22:11 ` Yazen Ghannam
0 siblings, 0 replies; 9+ messages in thread
From: Yazen Ghannam @ 2026-11-10 22:11 UTC (permalink / raw)
To: sashiko-reviews; +Cc: linux-pci
On Tue, Nov 10, 2026 at 10:02:27PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found no new issues
> in this patch, but noticed 1 related pre-existing issue it does not
> introduce:
> - [Medium] PCI/AER: incorrect unit scaling in
> aer_ratelimit_interval_attr() [1]
> --
>
> commit 3e212613eb554aa7ec8ef93c898bf101c6bb444e
> Author: Yazen Ghannam <yazen.ghannam@amd.com>
>
> PCI/AER: Clamp negative ratelimit burst to zero
>
> This commit clamps negative values written to the AER ratelimit burst sysfs
> attributes to zero and updates the ABI documentation accordingly.
>
> > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> > index 6f24602314225..401cd3a1b3d0e 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; \
>
> [Severity: Medium]
> This problem wasn't introduced by this patch, but shouldn't the companion
> aer_ratelimit_interval_attr() macro convert pdev->aer_info->ratelimit.interval
> back with jiffies_to_msecs() in name##_show() [1]?
>
> drivers/pci/pcie/aer.c:aer_ratelimit_interval_attr() {
> static ssize_t \
> name##_show(struct device *dev, struct device_attribute *attr, \
> char *buf) \
> { \
> struct pci_dev *pdev = to_pci_dev(dev); \
> \
> return sysfs_emit(buf, "%d\n", \
> pdev->aer_info->ratelimit.interval); \
> } \
> ...
> if (interval <= 0) \
> interval = 0; \
> else \
> interval = msecs_to_jiffies(interval); \
> \
> pdev->aer_info->ratelimit.interval = interval; \
> }
>
> name##_store() converts the millisecond value into jiffies before storing it,
> so reading *_ratelimit_interval_ms back emits raw jiffies instead of
> milliseconds when HZ != 1000.
>
> [1] https://sashiko.dev/#/bug/linux-3e0972eb-98a1-4365-b40e-82736dd85f13
>
This is fixed in patch 3 of this set.
Thanks,
Yazen
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-10 22:12 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-10 22:02 ` sashiko-bot
2026-11-10 22:11 ` Yazen Ghannam
2026-11-10 21:56 ` [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds Yazen Ghannam
2026-11-10 22:00 ` sashiko-bot
2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam
2026-11-10 22:00 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox