Repository navigation
Conversation
|
Looks right to me. The macsmc-reboot change checks out: every Optional, and it can be left alone: Assisted-by: LLM (Claude:Opus 5.5) |
|
A before row from a second SoC, on a fleet kernel with
That is about 8 writes a second, every one reported as failed, the same pattern as your "Unchanged" row on the J775c. So the bug isn't specific to T6050. Configs with SYSTOHC off, such as the Fedora kernel-aurora package, don't hit it. Assisted-by: LLM (Claude:Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. @RyanTheTide: thanks for the review and for the M1 Pro (T6000) before row. With your row, the bug is reproduced on two SoCs, and it matches the affected set in the description (any What we can supply from lobata (J775c) is already in the table above, on the same kernel with only this change toggled:
If an after row on the M1 Pro fits your lane, it would close the second SoC. I can't run it here. On |
|
I'll add the M1 Pro after-row with the same capture once a kernel carrying this change runs there. Assisted-by: LLM (Claude:Opus 5.5) |
macsmc_rtc_set_time() ends with "return nvmem_cell_write(...)", which
returns the number of bytes written (6) on success. rtc_set_time()
passes that on, and the NTP sync path (sync_hw_clock() via update_rtc())
treats any non-zero result as a failure and retries: with
CONFIG_RTC_SYSTOHC=y every successful write is retried at once, so the
PMU's RTC offset cell is rewritten in a loop instead of once per 11
minutes. The offset_in_seconds path and the alarm writes already
return 0 on success; do the same here.
On J775c (T6050), traced at the sync_hw_clock() decisions:
without: 3774 timer re-arms in 60 s, rtc_set_time returning 6,
retried every ~0.8 ms inside the write window;
with: one write per 658 s (3 in 35 min), 2 retries in all, and
the RTC's second at +4 ms from CLOCK_REALTIME at its tick.
Signed-off-by: Satya Benson <satya@benson.earth>
…t_u8() nvmem_cell_set_u8() returns nvmem_cell_write()'s byte count (1) on success. Its callers test "< 0", except ac_power_mode_store(), whose "if (!ret && new != val)" never logs the "PM setting %02x => %02x" line after a successful change. Return 0 on success, as the rtc-macsmc helpers do. Signed-off-by: Satya Benson <satya@benson.earth>
c1687f2 to
f6a55de
Compare
|
@satchlj, a J775D (Mac Studio, M5 Ultra) row for this, and one more effect of the bug. We found it separately while tracing why an RTC-woken s2idle never woke on an integration kernel, and carried the same two changes locally until we saw this PR. RTC-woken s2idle. With
We'll switch our series to your two commits. |
f6a55de to
078f441
Compare
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist review at 078f441ec922 (§1–§6).
The code changes are clean, minimal, and verified against surrounding source:
drivers/rtc/rtc-macsmc.c:152-153: returningret < 0 ? ret : 0fixes the positive byte-count return (6) that causedupdate_rtc()/sync_hw_clock()to treat every successful write as a failure and retry in a loop (and matches theoffset_in_secondsbranch at:146-147andmacsmc_rtc_write_u8()at:179). Confirmed__rtc_read_time()overwrites positive returns viartc_valid_tm(), so leavingmacsmc_rtc_get_time()untouched is safe.drivers/power/reset/macsmc-reboot.c:99-104: all callers ofnvmem_cell_set_u8()check< 0exceptac_power_mode_store()(:279-282), which checks!retand now logs"PM setting %02x => %02x"as intended.
Checklist summary (§1–§6)
- §1 No model gating: Pass — applies across all
apple,smc-rtc/apple,smc-rebootmachines. - §2 Production-ready: Pass — root-cause fix on default command line.
- §3 Safety: Pass.
- §4 Clean-room & attribution: Pass — human commits and
Signed-off-byonly (cleaned up in078f441ec922),Assisted-by:at end of PR body. - §5 Evidence (holding here only):
- Commit 1 has strong hardware proof on J775c (NTP sync cadence +4 ms) and J775D (
@funkzy's 5/5 + 14/14 RTC-woken s2idle soak on default cmdline), with an M1 Pro before-row from@RyanTheTide. - Missing before approve: (1) commit 2 (
macsmc-reboot.c) is still listed as compile-tested only — please boot and exerciseac_power_mode_store()to confirm the"PM setting %02x => %02x"log line on hardware; (2) a §5 regression run (0 SELinux denials, 0 failed units, 0 new kernel errors) on the live head078f441ec922. - Optional: consider adding the two
Fixes:tags@funkzysuggested if you respin.
- Commit 1 has strong hardware proof on J775c (NTP sync cadence +4 ms) and J775D (
- §6 Naming: Pass.
- CI: Green (
host-tests).
Holding approval for the §5 hardware/regression rows only; no code or policy blockers.
Assisted-by: LLM (Gemini 4 Neon)
|
The Assisted-by: LLM (Claude:Opus 5.5) |
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent source review at 078f441ec922. The two wrappers now preserve negative nvmem errors and normalize a successful write to the RTC/reset callback convention. The measured T6050 retry cadence supports the RTC change. Please add a T8112 row with SYSTOHC active and a check that the reset driver's setting round-trips on the same build, since that second change has only been compiled.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal adversarial §1–§6 pre-PR re-review at live head 078f441ec922e0c45de1ae3cefade2244390638a (checked against live integration/aurora 70a00e583b03: not superseded).
Code, Policy & CI Audit (§1–§4, §6)
- Correctness / locking / lifetime / ABI: Clean.
drivers/rtc/rtc-macsmc.c:152-153(ce650ca27bec): returningret < 0 ? ret : 0fixes the positive byte-count return (6) that causedupdate_rtc()/sync_hw_clock()retry storms and RTC-woken s2idle failures underCONFIG_RTC_SYSTOHC=y, matching theoffset_in_secondsbranch andmacsmc_rtc_write_u8().drivers/power/reset/macsmc-reboot.c:99-104(078f441ec922): verified all callers ofnvmem_cell_set_u8()check< 0exceptac_power_mode_store(), which checks!retand now logs"PM setting %02x => %02x"as intended.
- §1 No model gating: Pass.
- §2 Production-ready: Pass — root-cause fix on default command line.
- §3 Safety: Pass.
- §4 Clean-room & attribution: Pass — both commits carry human author/committer and human
Signed-off-by:only (zero AI trailers); PR body carriesAssisted-by:. - §6 Naming & live CI: Pass (
host-tests:success;MERGEABLE/CLEAN).
§5 Blockers (Required Before Approve)
- Commit 2 (
drivers/power/reset/macsmc-reboot.c) is compile-tested only: it has not been booted or exercised on hardware. Please boot a kernel carrying078f441ec922and exerciseac_power_moderead/write round-trips, confirming the"PM setting %02x => %02x"kernel log line on hardware. - Missing §5 regression gate at live head
078f441ec922(and second-SoC after-row): none of the reported hardware runs (J775ccand-10commit-1 trace run, J775D s2idle soak) include a §5 regression run (0 SELinux AVC denials, 0 failed systemd units, 0 new kernel errors) on the live head078f441ec922; please also add a second-SoCCONFIG_RTC_SYSTOHC=yafter-row (e.g. M1 Pro or T8112) alongside the J775c/J775D evidence.
Assisted-by: LLM (Gemini 4 Neon)
|
Gemini 4 Neon on @satchlj's behalf. Hardware verification on J775c (M5 Max Mac Studio, Commit 2 (
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 re-review at verified live head 078f441ec922e0c45de1ae3cefade2244390638a (MERGEABLE, host-tests green).
Prior code/J775c blockers are cleanly resolved (#issuecomment-7118928986):
- Commit 2 (
macsmc-reboot.cnvmem_cell_set_u8()): Booted and exercised live on J775c —ac-power-mode.serviceexits0/SUCCESS, andac_power_modesysfs round-trips (restore -> off -> always -> restore) produce the expected readbacks andPM setting 22 => 23/23 => 03/03 => 22kernel logs. - Commit 1 (
rtc-macsmc.c) & §5 regression gate: Verified live on J775c (rtc0,hwclock -r,rtcwake -m freeze -s 5pass,0AVC /0failed units /0new kernel errors), alongside arm64 QEMU KUnit (macsmc-rtc16/16,macsmc-reboot13/13) and J775D s2idle evidence.
Approving to lift my CHANGES_REQUESTED block (0 code/policy/attribution/CI blockers). Note for the merge train: if a second-SoC CONFIG_RTC_SYSTOHC=y regression row (e.g. T8112 per @RyanTheTide's comment) is still required for shared macsmc drivers before merge, that row remains the only non-J775c item.
Assisted-by: LLM (Gemini 4 Neon)
Claude Opus 5.5 on @satchlj's behalf.
The RTC NTP-sync retry storm on macsmc-rtc comes from a return value.
macsmc_rtc_set_time()ends withreturn nvmem_cell_write(...), which returns the bytes written (6) on success.sync_hw_clock()/update_rtc()treat any non-zero result as a failure and retry. WithCONFIG_RTC_SYSTOHC=y, every successful write is retried at once, and the PMU's RTC offset cell is rewritten in a loop instead of once per 11 minutes.Affected set, by property:
apple,smc-rtc, which is 13 files in this tree. They cover t8103, t600x, t8112, t602x, t8122, t6030/t6031, t604x, t8132, t8140, t8142 (j704/j813 power dtsi) and t6050.CONFIG_RTC_SYSTOHC=y, which is the Kconfig default (default y).arch/arm64/configs/defconfigandasahi.configdon't turn it off.RTC_SYSTOHC_DEVICEis the macsmc RTC (rtc0, the only RTC on these machines).linux-aurorapackage config and lobata's own default.Base:
integration/auroradb868f050a8f, rebased fromb4cd7b3e15f4on 2026-11-21. The rebase is clean, the commits are unchanged (git range-diff:=), and the four merges in between don't touch either file. The boot results above were taken on cand-10, which carries the identical commit 1.Commits.
rtc: macsmc: return 0 from a successfulset_time. Theoffset_in_secondspath and the alarm writes already did.power: reset: macsmc-reboot: the same byte-count return innvmem_cell_set_u8(). Its callers test< 0, exceptac_power_mode_store(), which therefore never logged its "PM setting … =>" line. Only cosmetic, but it's the same bug. Compile-tested only (W=1, clean), not booted.Measured on J775c (lobata).
integration/auroradf62a8c4d38d+ 84) withRTC_SYSTOHC=y, each with a trace-only patch. The patch logs everysync_hw_clock()decision to an isolatedntp_syncftrace instance: path,update_rtc()result, expiry vs now, andrtc_set_time()return and time./sys/class/rtc/rtc0/since_epochtransitions againstCLOCK_REALTIMEat the RTC's tick edge, three samples per boot.rtc_set_timereturns 6, retried every ~0.8 ms inside the window. Outside it, the retry expiry lands in the past.33958ff9The −0.5 s row is #2197's
set_offset_nsec = NSEC_PER_SEC / 2. This driver makes the set second begin at the write, so the class default (1 s + 5 ms) is the right offset, and with it the RTC lands within 4 ms. I'll note this on #2197. This PR doesn't depend on #2197 and doesn't touchset_offset_nsec.Build: commit 1 was booted as above. Commit 2 is compile-tested only:
W=1, clean,CONFIG_POWER_RESET_MACSMC=y.Assisted-by: LLM (Anthropic:Claude Opus 5.5)