drivers/rtc: fix rcu unexpected reboot#592
Conversation
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>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
paulmenzel
left a comment
There was a problem hiding this comment.
Please also send this upstream for review.
|
|
||
| When processing expired RTC events and rearming them, use now | ||
| instead of expiry to prevent endless loops. | ||
|
|
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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*/, |
There was a problem hiding this comment.
We have git, so commenting this out is not useful.
sonic-net/sonic-linux-kernel#592 Signed-off-by: Yan Markman <ymarkman@marvell.com>
|
HI @paulmenzel |
|
I'm inclined to agree with the comments on the mailing list. What is special about your hardware that common code needs to be changed here? |
The HW is not special, the test added that changes the clock back and forth constantly is special, and apparently no other SONIC HW uses RTC as the main clock. |
No. I have done RTC time jumps back and forth on other hardware running SONiC. None of them leads to an expected reboot. |
The question is whether those HW's RTC support PIE/UIE, whether it was enabled and rtc_timer_do_work() was actually called. Can you list these HW it was tested on, plus link to a HW diagram of the board and SOC, and finally a link to the dts or for x86_64 lspci -k ? Thanks... |
|
On amd64, I have two physical systems (a laptop and a desktop) where Chrony is managing the RTC; neither have run into CPU hangs. For arm64 specifically, there is one hardware that I have access to that has an RTC with UIE enabled: The patch that adds support for this hardware is here. |
|
Thanks Saikrishna.
I’m just a proxy in this case. The author is Elad Nachman ***@***.******@***.***> (added).
Best regards
Yan
From: Saikrishna Arcot ***@***.***>
Sent: Wednesday, July 8, 2026 8:28 PM
To: sonic-net/sonic-linux-kernel ***@***.***>
Cc: Yan Markman ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [sonic-net/sonic-linux-kernel] drivers/rtc: fix rcu unexpected reboot (PR #592)
saiarcot895 left a comment (sonic-net/sonic-linux-kernel#592) @eladnachman On amd64, I have two physical systems (a laptop and a desktop) where Chrony is managing the RTC; neither have run into CPU hangs. lspci -k output from a Framework AMD
ZjQcmQRYFpfptBannerStart
Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments
Report Suspicious <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/CRVmXkqW!t-3R_hSfiBZxPqc_UbaxpSD7iZUc1juzZge4D4tMm5lgAp5uV6xy1_LM24Rxjv3GTq8ZgmCIYWyF0ycY0yAcLsxHnUQXYvXRorKPgtoEI-ZA_Q4zGhO_$>
ZjQcmQRYFpfptBannerEnd
[https://avatars.githubusercontent.com/u/5923875?s=20&v=4]saiarcot895 left a comment (sonic-net/sonic-linux-kernel#592)<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sonic-2Dnet_sonic-2Dlinux-2Dkernel_pull_592-23issuecomment-2D4917453796&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=GMS9MxDfkM1zfUKO_dNqR9OIJKknzJghcVIL9KyrFTg&e=>
@eladnachman<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_eladnachman&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=KUvi7xyYHCwJNSjzeTki8jtn8HxnpOZkS1Ku5WbW2mc&e=>
On amd64, I have two physical systems (a laptop and a desktop) where Chrony is managing the RTC; neither have run into CPU hangs. lspci -k output from a Framework AMD laptop (the RTC hardware doesn't appear to show up here):
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Root Complex
Subsystem: Framework Computer Inc. Device 0006
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Phoenix IOMMU
Subsystem: Framework Computer Inc. Device 0006
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Host Bridge
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Host Bridge
00:02.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Phoenix GPP Bridge
Subsystem: Advanced Micro Devices, Inc. [AMD] Device 1453
Kernel driver in use: pcieport
Kernel modules: shpchp
00:02.4 PCI bridge: Advanced Micro Devices, Inc. [AMD] Phoenix GPP Bridge
Subsystem: Advanced Micro Devices, Inc. [AMD] Device 1453
Kernel driver in use: pcieport
Kernel modules: shpchp
00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Host Bridge
00:03.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 19h USB4/Thunderbolt PCIe tunnel
Subsystem: Advanced Micro Devices, Inc. [AMD] Device 1453
Kernel driver in use: pcieport
Kernel modules: shpchp
00:04.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Host Bridge
00:04.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 19h USB4/Thunderbolt PCIe tunnel
Subsystem: Advanced Micro Devices, Inc. [AMD] Device 1453
Kernel driver in use: pcieport
Kernel modules: shpchp
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Host Bridge
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Internal GPP Bridge to Bus [C:A]
Subsystem: Device 0006:f111
Kernel driver in use: pcieport
Kernel modules: shpchp
00:08.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Internal GPP Bridge to Bus [C:A]
Subsystem: Device 0006:f111
Kernel driver in use: pcieport
Kernel modules: shpchp
00:08.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Internal GPP Bridge to Bus [C:A]
pcilib: Error reading /sys/bus/pci/devices/0000:00:08.3/label: Operation not permitted
Subsystem: Device 0006:f111
Kernel driver in use: pcieport
Kernel modules: shpchp
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 71)
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: piix4_smbus
Kernel modules: i2c_piix4, sp5100_tco
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
Subsystem: Framework Computer Inc. Device 0006
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 3
Kernel driver in use: k10temp
Kernel modules: k10temp
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Data Fabric; Function 7
01:00.0 Network controller: Qualcomm Technologies, Inc WCN785x Wi-Fi 7(802.11be) 320MHz 2x2 [FastConnect 7800] (rev 01)
Subsystem: Quectel Wireless Solutions Co., Ltd. Device 8000
Kernel driver in use: ath12k_wifi7_pci
Kernel modules: ath12k_wifi7
02:00.0 Non-Volatile memory controller: Sandisk Corp SanDisk Extreme Pro / WD Black SN750 / PC SN730 / Red SN700 NVMe SSD
Subsystem: Sandisk Corp SanDisk Extreme Pro / WD Black SN750 / PC SN730 / Red SN700 NVMe SSD
Kernel driver in use: nvme
Kernel modules: nvme
03:00.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)
DeviceName: Realtek
Subsystem: Device 1b45:1114
Kernel driver in use: pcieport
Kernel modules: shpchp
04:00.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)
Subsystem: Device 1b45:1114
Kernel driver in use: pcieport
Kernel modules: shpchp
04:01.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)
Subsystem: Device 1b45:1114
Kernel driver in use: pcieport
Kernel modules: shpchp
04:02.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)
Subsystem: Device 1b45:1114
Kernel driver in use: pcieport
Kernel modules: shpchp
04:04.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)
Subsystem: Device 1b45:1114
Kernel driver in use: pcieport
Kernel modules: shpchp
05:00.0 USB controller: Fresco Logic FL1100 USB 3.0 Host Controller (rev 10)
Subsystem: Device 1b45:0005
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
06:00.0 USB controller: Fresco Logic FL1100 USB 3.0 Host Controller (rev 10)
Subsystem: Device 1b45:0006
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
07:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
Subsystem: Device 1b45:0007
Kernel driver in use: igb
Kernel modules: igb
c1:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev cb)
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: amdgpu
Kernel modules: amdgpu
c1:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Radeon High Definition Audio Controller
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
c1:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Phoenix CCP/PSP 3.0 Device
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: ccp
Kernel modules: ccp
c1:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15b9
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
c1:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15ba
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
c1:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] Audio Coprocessor (rev 63)
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: snd_pci_ps
Kernel modules: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x, snd_pci_acp6x, snd_acp_pci, snd_pci_ps
c1:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Ryzen HD Audio Controller
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
c2:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Function
Subsystem: Framework Computer Inc. Device 0006
c2:00.1 Signal processing controller: Advanced Micro Devices, Inc. [AMD] AMD IPU Device
Subsystem: Framework Computer Inc. Device 0006
c3:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Phoenix Dummy Function
Subsystem: Framework Computer Inc. Device 0006
c3:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15c0
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
c3:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15c1
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
c3:00.5 USB controller: Advanced Micro Devices, Inc. [AMD] Pink Sardine USB4/Thunderbolt NHI controller #1
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: thunderbolt
Kernel modules: thunderbolt
c3:00.6 USB controller: Advanced Micro Devices, Inc. [AMD] Pink Sardine USB4/Thunderbolt NHI controller #2
Subsystem: Framework Computer Inc. Device 0006
Kernel driver in use: thunderbolt
Kernel modules: thunderbolt
For arm64 specifically, there is one hardware that I have access to that has an RTC with UIE enabled:
***@***.***:~$ sudo hwclock --param-get 0
The RTC parameter 0x0 is set to 0x10.
The patch that adds support for this hardware is here<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sonic-2Dnet_sonic-2Dlinux-2Dkernel_blob_master_patches-2Dsonic_0023-2Drtc-2Delba-2Dcpld-2Dsupport.patch&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=Y_lOcnrmfgZn68qeHsfCclC4YkH3KoZNu4NlgVkLaHA&e=>.
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sonic-2Dnet_sonic-2Dlinux-2Dkernel_pull_592-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAHWE6LI55DZTSMXTL5M5QAL5D2ADJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJRG42DKMZXHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L-23issuecomment-2D4917453796&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=FMIVAxH_jkogGGEFZij9DiDa2K6MuoFMCfl-i8-dLQc&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AHWE6LPINGHEUUGNOU4QAAT5D2ADJAVCNFSNUABEKJSXA33TNF2G64TZHM2TGNJZGA4DENB3JFZXG5LFHM2DOMJYGM3DEOJRGKQXMAQ&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=jnIvC5b8fwLIyGJMVr8vd7atbAHp07-TLILSojRh3VQ&e=>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_mobile_ios_AHWE6LO6T6GPDIORQKOGLLL5D2ADJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJRG42DKMZXHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=06ptcLmkjJFQyNc84XJ3g-ULvfSDtbrSqnQafHNKYuM&e=> and Android<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_mobile_android_AHWE6LORFURLVCJJ3IB3UFD5D2ADJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJRG42DKMZXHE3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA&d=DwMFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=afmaEQNyRnAAm7Dt6PdvHUE04B_lTRIu00Y_4b92SBU&m=6u1KtYuw-YXg_qMJUWd537rID57lAVtMhY9dmPteDQw5jKlOGYkbyfXqVLOiCPUk&s=2Pkm3DnsaXK1iiyiA74sBI9WQlBqgmkBKHrQo3-5YOQ&e=>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
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.