]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rtc: Extend timeout for waiting for UIP to clear to 1s
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 28 Nov 2023 05:36:53 +0000 (23:36 -0600)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 17 Dec 2023 21:33:55 +0000 (22:33 +0100)
Specs don't say anything about UIP being cleared within 10ms. They
only say that UIP won't occur for another 244uS. If a long NMI occurs
while UIP is still updating it might not be possible to get valid
data in 10ms.

This has been observed in the wild that around s2idle some calls can
take up to 480ms before UIP is clear.

Adjust callers from outside an interrupt context to wait for up to a
1s instead of 10ms.

Cc: <stable@vger.kernel.org> # 6.1.y
Fixes: ec5895c0f2d8 ("rtc: mc146818-lib: extract mc146818_avoid_UIP")
Reported-by: Carsten Hatger <xmb8dsv4@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217626
Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20231128053653.101798-5-mario.limonciello@amd.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
arch/x86/kernel/rtc.c
drivers/base/power/trace.c
drivers/rtc/rtc-cmos.c
drivers/rtc/rtc-mc146818-lib.c

index 961ebc7f18723ea8d9903af6c6092a307dcb7b89..2e7066980f3e8bf665613ab4fd2f9ccb03ad7627 100644 (file)
@@ -67,7 +67,7 @@ void mach_get_cmos_time(struct timespec64 *now)
                return;
        }
 
-       if (mc146818_get_time(&tm, 10)) {
+       if (mc146818_get_time(&tm, 1000)) {
                pr_err("Unable to read current time from RTC\n");
                now->tv_sec = now->tv_nsec = 0;
                return;
index c2e9253574748f2b5795f5fde01ac08423c3d89e..cd6e559648b21bd3661caed21573238f61038401 100644 (file)
@@ -120,7 +120,7 @@ static unsigned int read_magic_time(void)
        struct rtc_time time;
        unsigned int val;
 
-       if (mc146818_get_time(&time, 10) < 0) {
+       if (mc146818_get_time(&time, 1000) < 0) {
                pr_err("Unable to read current time from RTC\n");
                return 0;
        }
index 468ccd99f218c45d5ea396fcd8e2f9598d67035c..7d99cd2c37a0ba87c06beb2c7dcbe0f560d26bb9 100644 (file)
@@ -231,7 +231,7 @@ static int cmos_read_time(struct device *dev, struct rtc_time *t)
        if (!pm_trace_rtc_valid())
                return -EIO;
 
-       ret = mc146818_get_time(t, 10);
+       ret = mc146818_get_time(t, 1000);
        if (ret < 0) {
                dev_err_ratelimited(dev, "unable to read current time\n");
                return ret;
index 4c17b3cef11ea85a2b405059fbd44139a6d29e36..651bf3c279c7462151096cf8565a56fffab9052d 100644 (file)
@@ -93,7 +93,7 @@ EXPORT_SYMBOL_GPL(mc146818_avoid_UIP);
  */
 bool mc146818_does_rtc_work(void)
 {
-       return mc146818_avoid_UIP(NULL, 10, NULL);
+       return mc146818_avoid_UIP(NULL, 1000, NULL);
 }
 EXPORT_SYMBOL_GPL(mc146818_does_rtc_work);