Skip to contentSkip to conversation

rtc: efi: Avoid spamming the log on RTC read failure

PATCH Applied Ard Biesheuvel 2 participants 2 messages Feb 17, 2023 – Feb 22, 2023

Subsystems (2)
lore
Share & tools
lore

Ard Biesheuvel

author maintainer
#0 lore raw

PATCH 1/1 rtc: efi: Avoid spamming the log on RTC read failure

There are cases where the EFI runtime services may end up in a funny state, e.g., due to a crash in the variable services, and this affects other EFI runtime services as well.

That means that, even though GetTime() should not return an error, there are cases where it might, and there is no point in logging such an occurrence multiple times.

This works around an issue where user space -apparently- keeps hitting on /dev/rtc if it fails to read the h/w clock, resulting in a tsunami of log spam and a non-responsive system as a result.

---
 drivers/rtc/rtc-efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-efi.c +1 -1
index e991cccdb6e9cee4..174959f783b8309b 100644
@@ -164,7 +164,7 @@ static int efi_read_time(struct device *dev, struct rtc_time *tm)
 
 	if (status != EFI_SUCCESS) {
 		/* should never happen */
-		dev_err(dev, "can't read time\n");
+		dev_err_once(dev, "can't read time\n");
 		return -EINVAL;
 	}
 
Signature · 1 line
2.39.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Ard Biesheuvel

There are cases where the EFI runtime services may end up in a funny state, e.g., due to a crash in the variable services, and this affects other EFI runtime services as well.

That means that, even though GetTime() should not return an error, there are cases where it might, and there is no point in logging such an occurrence multiple times.

[...]

Applied, thanks!

[1/1] rtc: efi: Avoid spamming the log on RTC read failure

      commit: 668a2abf91143caa226b3ccd0bd4d79ea85935a6

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com