Skip to content

Commit cef9ecc

Browse files
superm1alexandrebelloni
authored andcommitted
rtc: Extend timeout for waiting for UIP to clear to 1s
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: ec5895c ("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>
1 parent 120931d commit cef9ecc

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

arch/x86/kernel/rtc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void mach_get_cmos_time(struct timespec64 *now)
6767
return;
6868
}
6969

70-
if (mc146818_get_time(&tm, 10)) {
70+
if (mc146818_get_time(&tm, 1000)) {
7171
pr_err("Unable to read current time from RTC\n");
7272
now->tv_sec = now->tv_nsec = 0;
7373
return;

drivers/base/power/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static unsigned int read_magic_time(void)
120120
struct rtc_time time;
121121
unsigned int val;
122122

123-
if (mc146818_get_time(&time, 10) < 0) {
123+
if (mc146818_get_time(&time, 1000) < 0) {
124124
pr_err("Unable to read current time from RTC\n");
125125
return 0;
126126
}

drivers/rtc/rtc-cmos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static int cmos_read_time(struct device *dev, struct rtc_time *t)
231231
if (!pm_trace_rtc_valid())
232232
return -EIO;
233233

234-
ret = mc146818_get_time(t, 10);
234+
ret = mc146818_get_time(t, 1000);
235235
if (ret < 0) {
236236
dev_err_ratelimited(dev, "unable to read current time\n");
237237
return ret;

drivers/rtc/rtc-mc146818-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ EXPORT_SYMBOL_GPL(mc146818_avoid_UIP);
9393
*/
9494
bool mc146818_does_rtc_work(void)
9595
{
96-
return mc146818_avoid_UIP(NULL, 10, NULL);
96+
return mc146818_avoid_UIP(NULL, 1000, NULL);
9797
}
9898
EXPORT_SYMBOL_GPL(mc146818_does_rtc_work);
9999

0 commit comments

Comments
 (0)