jetson: prevent invalid RTC from rewinding host clock#1807
jetson: prevent invalid RTC from rewinding host clock#1807brianmcgillion merged 1 commit intotiiuae:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Jetson Orin boot-time wall-clock rewinds caused by an early-registered, invalid rtc0 value by disabling kernel RTC hctosys and adding a guarded, udev-triggered time seeding path that only applies an RTC-derived time when it’s considered plausible.
Changes:
- Disable kernel
RTC_HCTOSYSfor the Jetson Orin hardware path to prevent early boot-time clock rewinds. - Add a udev-triggered
ghaf-seed-time-from-rtc@oneshot service to optionally seed system time from/sys/class/rtc/rtc0/since_epochusing plausibility checks. - Document Jetson-specific boot-time clock behavior and the intended time seeding workflow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix | Disables kernel hctosys and adds udev-triggered RTC seeding service with plausibility checks. |
| docs/src/content/docs/ghaf/dev/ref/build_and_run.mdx | Adds documentation note explaining Jetson RTC behavior and Ghaf’s mitigation approach. |
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
cb6ea5c to
53f4215
Compare
|
Implemented copilot-requested safety check. |
|
Tested on Orin AGX |
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
0b0c668 to
0093905
Compare
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
modules/reference/hardware/jetpack/nvidia-jetson-orin/jetson-orin.nix
Outdated
Show resolved
Hide resolved
|
Ran 'Manual Testing Steps' on Orin NX. Functionality is as expected. |
0093905 to
c6bb08d
Compare
Signed-off-by: vadik likholetov <vadikas@gmail.com>
|
Superseded by the following comment (this one was posted with shell-escaped formatting issues). |
|
Addressed all open review suggestions from the previous CHANGES_REQUESTED pass and resolved the related threads. Also squashed the branch history into a single signed commit: Validation run:
|
Summary
RTC_HCTOSYS=n) for this hardware path.ghaf-seed-time-from-rtc@) that optionally seeds system time fromrtc0only when the RTC value is plausible relative to/var/lib/systemd/timesync/clock(not behind anchor, not more than 180 days ahead, and above minimum epoch).systemd-timesyncdworkflow and persisted timesync anchorWhy This Fixes Root Cause
nvvrs-pseq-rtccan register asrtc0early at boot and provide an invalid epoch-like value that rewinds wall clock time. Disabling kernel hctosys prevents this early rewind path. Time recovery remains native: optional bounded RTC seeding when rtc0 appears and then normalsystemd-timesyncdsynchronization.Manual Testing Steps
nix build .#nvidia-jetson-orin-agx-debug-from-x86_64-flash-scriptudevadm info -q property -p /sys/class/rtc/rtc0 | grep -E 'DEVNAME|SUBSYSTEM|SYSTEMD_WANTS'systemctl status ghaf-seed-time-from-rtc@rtc0.service --no-pager -ljournalctl -b -u ghaf-seed-time-from-rtc@rtc0.service --no-pagersystemctl status systemd-timesyncd.service --no-pager -lls -ld /var/lib/systemd/timesync && stat /var/lib/systemd/timesync/clocktimedatectl show -p NTPSynchronized -p TimeUSecjournalctl -b --no-pager | grep -E 'nvvrs-pseq-rtc|setting system clock|Time jumped backwards|RTC seed'Verification
On host:
rtc0:DEVNAME=/dev/rtc0SUBSYSTEM=rtcSYSTEMD_WANTS=ghaf-seed-time-from-rtc@rtc0.serviceRTC seed skipped: RTC epoch 47 below minimum 1704067200systemd-timesyncdactive and synchronized:Initial clock synchronization to Fri 2026-03-06 ... UTCNTPSynchronized=yes/var/lib/systemd/timesync/clockowned bysystemd-timesync:systemd-timesyncnvvrs-pseq-rtc ... registered as rtc0observed.setting system clock to 1970...observed in this boot.