Skip to content

drivers/rtc: fix rcu unexpected reboot#592

Open
yanmarkman wants to merge 1 commit into
sonic-net:202505from
yanmarkman:yanm-drivers-rtc-fix-rcu-unexp-reboot-202505
Open

drivers/rtc: fix rcu unexpected reboot#592
yanmarkman wants to merge 1 commit into
sonic-net:202505from
yanmarkman:yanm-drivers-rtc-fix-rcu-unexp-reboot-202505

Conversation

@yanmarkman

Copy link
Copy Markdown
Contributor

Why needed (PROBLEM):
Under 'chrony' configuration or/and further hwrtc change the RCU on the rtc_timer_do_work() reported and reproduced.

How fixed:
drivers/rtc/interface.c: rtc_timer_do_work()
When processing expired RTC events and rearming them, use "now"
instead of "expiry" to prevent endless loops.

Why needed (PROBLEM):
Under 'chrony' configuration or/and further hwrtc change
the RCU on the rtc_timer_do_work() reported and reproduced.

Easy reproduced on armhf Nokia-AC3X.
Not reproduced on SONiC TRIXIE.

How fixed:
drivers/rtc/interface.c: rtc_timer_do_work()
  When processing expired RTC events and rearming them, use "now"
  instead of "expiry" to prevent endless loops.

Signed-off-by: Elad Nachman <enachman@marvell.com>
Signed-off-by: Yan Markman <ymarkman@marvell.com>
@yanmarkman yanmarkman requested a review from a team as a code owner June 22, 2026 16:00
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@paulmenzel paulmenzel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also send this upstream for review.


When processing expired RTC events and rearming them, use now
instead of expiry to prevent endless loops.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Fixes: tag, and also list the devices in the commit message.


+ if (rtc && rtc->ops && rtc->ops->read_time) {
+ if (!rtc->ops->read_time(rtc->dev.parent, &new_tm)) {
+ pr_err("new rtc tm %d %d %d %d %d %d %d %d %d\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-write. Currently it’s more like a debug message. (Which is good to have.)

/* Re-add/fwd periodic timers */
if (ktime_to_ns(timer->period)) {
- timer->node.expires = ktime_add(timer->node.expires,
+ timer->node.expires = ktime_add(now/*timer->node.expires*/,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have git, so commenting this out is not useful.

@yanmarkman

yanmarkman commented Jun 22, 2026 via email

Copy link
Copy Markdown
Contributor Author

yanmarkman added a commit to Marvell-switching/sonic-scripts that referenced this pull request Jun 23, 2026
@yanmarkman

Copy link
Copy Markdown
Contributor Author

HI @paulmenzel
@eladnachman has posted https://lkml.org/lkml/2026/6/24/888 to the Kernel-upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants