Linux ACPI
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: GHES: Poll error sources at their poll interval
@ 2026-11-19 18:36 Ahmed Abdelfattah via B4 Relay
  2026-11-23 16:16 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmed Abdelfattah via B4 Relay @ 2026-11-19 18:36 UTC (permalink / raw)
  To: Rafael J. Wysocki, Tony Luck, Borislav Petkov, Hanjun Guo,
	Mauro Carvalho Chehab, Shuai Xue, Len Brown, Ying Huang,
	Andi Kleen
  Cc: linux-acpi, linux-kernel, Ahmed Abdelfattah

From: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>

ghes_add_timer() passes an absolute time to round_jiffies_relative(),
which takes a delay:

	expire = jiffies + msecs_to_jiffies(g->notify.poll_interval);
	ghes->timer.expires = round_jiffies_relative(expire);

round_jiffies_relative(j) rounds jiffies + j to a whole second and
subtracts jiffies again, so what gets rounded here is 2 * jiffies plus
the interval, and the timer fires up to a second away from the Poll
Interval in the HEST. With a 1000 ms interval, on some boots the polls
come every 1.5 s on average, for seconds or for minutes, and the rest
of the time they are anywhere from 0.75 s to 1.95 s apart. A 250 ms
source settles at one poll a second.

Rounding the delay instead would still move every interval that is not
a whole number of seconds; a 250 ms source would still be polled once a
second. Drop the rounding and use the interval as it is.

Fixes: 81e88fdc432a ("ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification type support")
Signed-off-by: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
---
I found this while timing a polled GHES in a QEMU guest, with a HEST
built for the test (one polled GHESv2) and given to the guest as an
extra ACPI table.

Tested on v7.4-rc3+ (4405c18c95d2) at HZ=300, tracing ghes_poll_func()
with a kprobe. With a 1000 ms Poll Interval and without the patch, the
intervals on three 10-minute boots ranged from 0.77 s to 1.95 s: one
boot averaged 1.5 s for its first two minutes, and the others
alternated between 280 and 320 jiffies, and between 240 and 360. With
the patch, every interval on three 3-minute boots was 304 jiffies
(1.013 s). With a 250 ms Poll Interval, the polls settled at about one
a second within the first minute without the patch; with it they come
every 80 jiffies (267 ms). The extra 4 and 5 jiffies are the timer
wheel's granularity at those timeouts.
---
 drivers/acpi/apei/ghes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 5d888c82efea..92d54c6b209a 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -1276,7 +1276,7 @@ static void ghes_add_timer(struct ghes *ghes)
 		return;
 	}
 	expire = jiffies + msecs_to_jiffies(g->notify.poll_interval);
-	ghes->timer.expires = round_jiffies_relative(expire);
+	ghes->timer.expires = expire;
 	add_timer(&ghes->timer);
 }
 

---
base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
change-id: 20261119-acpi-ghes-poll-interval-b7291834d9a3

Best regards,
--  
Ahmed Abdelfattah <me@ahmedabdelfattah.dev>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI: APEI: GHES: Poll error sources at their poll interval
  2026-11-19 18:36 [PATCH] ACPI: APEI: GHES: Poll error sources at their poll interval Ahmed Abdelfattah via B4 Relay
@ 2026-11-23 16:16 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2026-11-23 16:16 UTC (permalink / raw)
  To: me
  Cc: Rafael J. Wysocki, Tony Luck, Borislav Petkov, Hanjun Guo,
	Mauro Carvalho Chehab, Shuai Xue, Len Brown, Ying Huang,
	linux-acpi, linux-kernel

> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index 5d888c82efea..92d54c6b209a 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -1276,7 +1276,7 @@ static void ghes_add_timer(struct ghes *ghes)
>  		return;
>  	}
>  	expire = jiffies + msecs_to_jiffies(g->notify.poll_interval);
> -	ghes->timer.expires = round_jiffies_relative(expire);
> +	ghes->timer.expires = expire;
>  	add_timer(&ghes->timer);

Makes sense. I guess at these long intervals rounding isn't very
useful anyways because the power impact is already low. It's more
for stuff that runs every few seconds.

Reviewed-by: Andi Kleen <ak@linux.intel.com>

-Andi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 18:36 [PATCH] ACPI: APEI: GHES: Poll error sources at their poll interval Ahmed Abdelfattah via B4 Relay
2026-11-23 16:16 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox