Skip to content

Commit 486f22c

Browse files
authored
patch: armhf 202505: (592)drivers-rtc fix rcu unexp reboot (#255)
sonic-net/sonic-linux-kernel#592 Signed-off-by: Yan Markman <ymarkman@marvell.com>
1 parent 00ee9dd commit 486f22c

3 files changed

Lines changed: 157 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
From 79109e68f377ca7275158b1b7ef974af79467937 Mon Sep 17 00:00:00 2001
2+
From: Yan Markman <ymarkman@marvell.com>
3+
Date: Mon, 15 Jun 2026 17:02:42 +0000
4+
Subject: [PATCH 1/1] drivers/rtc: fix rcu unexpected reboot
5+
6+
Why needed (PROBLEM):
7+
Under 'chrony' configuration or/and further hwrtc change
8+
the RCU on the rtc_timer_do_work() reported and reproduced.
9+
10+
Easy reproduced on armhf Nokia-AC3X.
11+
Not reproduced on SONiC TRIXIE.
12+
13+
How fixed:
14+
drivers/rtc/interface.c: rtc_timer_do_work()
15+
When processing expired RTC events and rearming them, use "now"
16+
instead of "expiry" to prevent endless loops.
17+
18+
Signed-off-by: Elad Nachman <enachman@marvell.com>
19+
Signed-off-by: Yan Markman <ymarkman@marvell.com>
20+
---
21+
...drivers-rtc-handle-OTF-clock-changes.patch | 55 +++++++++++++++++++
22+
patch/series | 1 +
23+
2 files changed, 56 insertions(+)
24+
create mode 100644 patch/0018-drivers-rtc-handle-OTF-clock-changes.patch
25+
26+
diff --git a/patch/0018-drivers-rtc-handle-OTF-clock-changes.patch b/patch/0018-drivers-rtc-handle-OTF-clock-changes.patch
27+
new file mode 100644
28+
index 0000000..7ff5f2c
29+
--- /dev/null
30+
+++ b/patch/0018-drivers-rtc-handle-OTF-clock-changes.patch
31+
@@ -0,0 +1,55 @@
32+
+From 2415aef978513606be09aff401ed4ee32fc2a0df Mon Sep 17 00:00:00 2001
33+
+From: Elad Nachman <enachman@marvell.com>
34+
+Date: Mon, 15 Jun 2026 10:58:42 +0000
35+
+Subject: [PATCH] drivers: rtc: handle OTF clock changes
36+
+
37+
+When processing expired RTC events and rearming them, use now
38+
+instead of expiry to prevent endless loops.
39+
+
40+
+Signed-off-by: Elad Nachman <enachman@marvell.com>
41+
+---
42+
+ drivers/rtc/interface.c | 14 +++++++++++++-
43+
+ 1 file changed, 13 insertions(+), 1 deletion(-)
44+
+
45+
+diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
46+
+index 04ce689da..eb1338b97 100644
47+
+--- a/drivers/rtc/interface.c
48+
++++ b/drivers/rtc/interface.c
49+
+@@ -126,6 +126,7 @@ EXPORT_SYMBOL_GPL(rtc_read_time);
50+
+ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
51+
+ {
52+
+ int err, uie;
53+
++ struct rtc_time new_tm;
54+
+
55+
+ err = rtc_valid_tm(tm);
56+
+ if (err != 0)
57+
+@@ -159,6 +160,17 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
58+
+ else
59+
+ err = -EINVAL;
60+
+
61+
++ if (rtc && rtc->ops && rtc->ops->read_time) {
62+
++ if (!rtc->ops->read_time(rtc->dev.parent, &new_tm)) {
63+
++ pr_err("new rtc tm %d %d %d %d %d %d %d %d %d\n",
64+
++ new_tm.tm_sec, new_tm.tm_min,
65+
++ new_tm.tm_hour, new_tm.tm_mday,
66+
++ new_tm.tm_mon, new_tm.tm_year,
67+
++ new_tm.tm_wday, new_tm.tm_yday,
68+
++ new_tm.tm_isdst);
69+
++ }
70+
++ }
71+
++
72+
+ pm_stay_awake(rtc->dev.parent);
73+
+ mutex_unlock(&rtc->ops_lock);
74+
+ /* A timer might have just expired */
75+
+@@ -932,7 +944,7 @@ void rtc_timer_do_work(struct work_struct *work)
76+
+ trace_rtc_timer_fired(timer);
77+
+ /* Re-add/fwd periodic timers */
78+
+ if (ktime_to_ns(timer->period)) {
79+
+- timer->node.expires = ktime_add(timer->node.expires,
80+
++ timer->node.expires = ktime_add(now/*timer->node.expires*/,
81+
+ timer->period);
82+
+ timer->enabled = 1;
83+
+ timerqueue_add(&rtc->timerqueue, &timer->node);
84+
+--
85+
+2.25.1
86+
+
87+
diff --git a/patch/series b/patch/series
88+
index 9aed86a..0c6c947 100755
89+
--- a/patch/series
90+
+++ b/patch/series
91+
@@ -193,6 +193,7 @@ cisco-npu-disable-other-bars.patch
92+
0015-arm64-dts-marvell-Add-Supermicro-SSE-G3748-board.patch
93+
0016-arm64-dts-marvell-Add-Wistron-ES-1227-54TS-board.patch
94+
0017-Extend-driver-to-support-XMC-XM25QH256C-device.patch
95+
+0018-drivers-rtc-handle-OTF-clock-changes.patch
96+
97+
# amd-pensando elba support
98+
0000-Add-support-for-the-TI-TPS53659.patch
99+
--
100+
2.34.1
101+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 2415aef978513606be09aff401ed4ee32fc2a0df Mon Sep 17 00:00:00 2001
2+
From: Elad Nachman <enachman@marvell.com>
3+
Date: Mon, 15 Jun 2026 10:58:42 +0000
4+
Subject: [PATCH] drivers: rtc: handle OTF clock changes
5+
6+
When processing expired RTC events and rearming them, use "now"
7+
instead of "expiry" to prevent endless loops.
8+
9+
Signed-off-by: Elad Nachman <enachman@marvell.com>
10+
---
11+
drivers/rtc/interface.c | 14 +++++++++++++-
12+
1 file changed, 13 insertions(+), 1 deletion(-)
13+
14+
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
15+
index 04ce689da..eb1338b97 100644
16+
--- a/drivers/rtc/interface.c
17+
+++ b/drivers/rtc/interface.c
18+
@@ -126,6 +126,7 @@ EXPORT_SYMBOL_GPL(rtc_read_time);
19+
int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
20+
{
21+
int err, uie;
22+
+ struct rtc_time new_tm;
23+
24+
err = rtc_valid_tm(tm);
25+
if (err != 0)
26+
@@ -159,6 +160,17 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
27+
else
28+
err = -EINVAL;
29+
30+
+ if (rtc && rtc->ops && rtc->ops->read_time) {
31+
+ if (!rtc->ops->read_time(rtc->dev.parent, &new_tm)) {
32+
+ pr_err("new rtc tm %d %d %d %d %d %d %d %d %d\n",
33+
+ new_tm.tm_sec, new_tm.tm_min,
34+
+ new_tm.tm_hour, new_tm.tm_mday,
35+
+ new_tm.tm_mon, new_tm.tm_year,
36+
+ new_tm.tm_wday, new_tm.tm_yday,
37+
+ new_tm.tm_isdst);
38+
+ }
39+
+ }
40+
+
41+
pm_stay_awake(rtc->dev.parent);
42+
mutex_unlock(&rtc->ops_lock);
43+
/* A timer might have just expired */
44+
@@ -932,7 +944,7 @@ void rtc_timer_do_work(struct work_struct *work)
45+
trace_rtc_timer_fired(timer);
46+
/* Re-add/fwd periodic timers */
47+
if (ktime_to_ns(timer->period)) {
48+
- timer->node.expires = ktime_add(timer->node.expires,
49+
+ timer->node.expires = ktime_add(now/*timer->node.expires*/,
50+
timer->period);
51+
timer->enabled = 1;
52+
timerqueue_add(&rtc->timerqueue, &timer->node);
53+
--
54+
2.25.1
55+

files/202505/series_marvell-prestera_armhf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
0001-platform-marvell-prestera-fw_setenv-with-without-f.patch|sonic-buildimage
44
0012-utilities-restart-mgmt-over-usb-interface-if-not-RUN.patch|src/sonic-utilities
55
0001-Remove-unsupported-marvell-board-x86_64-marvell_rd98.patch|sonic-buildimage
6+
592-drivers-rtc-fix-rcu-kseries.patch|src/sonic-linux-kernel

0 commit comments

Comments
 (0)