|
| 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 | + |
0 commit comments