Repository navigation
Conversation
Contributor
|
@ESoapW has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128232627. |
Summary: This diff adds the conditions for what the sidecar writes. It writes NTP on every host, with -v3. It writes PTP and PRTC, and everything else PTP needs (v1, v2 and the linearizability tests), only on a PTP host: one where /dev/fbclock/ptp exists and -iface's PHC opens. A PTP host runs exactly as today; only hosts without PTP change. Today the sidecar can't run on a host without PTP. It exits at startup without a PHC, and it always writes v1, runs the sptp loop and starts the linearizability tests. That blocks -v3 on those hosts. Chrony mode used to cover them, and D127943753 removed it. The daemon checks the conditions at startup. The device is what marks a PTP host, since non-PTP NICs can have a PHC too. Any error from either check counts as no PTP, and the startup log line says why. A host without PTP then checks again every 10 s, the pace at which systemd restarts a sidecar that exits, and once the device exists and the PHC opens, it exits so that the restart runs PTP. So a link that udev makes after the sidecar started, at boot or on a turnup, or a PHC that comes back after a NIC reset, gets PTP without anyone restarting the sidecar, and ntp keeps flowing meanwhile. That matters once -manage goes off: today, with -manage on, main exits when -iface has no PHC and systemd retries. Without PTP the sidecar writes only v3's ntp section (header 0x4) and keeps running. There's no PHC setup, no v1 or v2 file, no sptp loop, no PTP counters and no linearizability tests, whose failures fbclock.mon alerts on and FBAR answers by restarting sptp. It exits at startup when it has nothing to write: without -v3, or when /run/fbclock/data can't be opened. With -manage on, main exits before the daemon starts when -iface has no PHC, so for the v3 rollout those hosts run with -manage=false. How the sidecar starts, before and after: https://pxl.cl/hX3GC In code, New checks the conditions and keeps the result, openDataV3 builds v3's header from it (0x7 on a PTP host, 0x4 without), and Run starts the ntp loop on every host. On a host without PTP, Run then waits there and re-checks every 10 s. Everything below that stop is today's Run, except that it no longer opens v3 itself. The open-source fbclock-daemon shares this code. A host with a PHC, -manage=false and no /dev/fbclock/ptp now writes only ntp, or fails without -v3, where today's daemon runs PTP. The open-source client library doesn't init there on default options, so those setups don't change. A caller that opted into NTP or ANY loses data_v2 there. No new files or flags. Without PTP the daemon creates only /run/fbclock/data, which it already creates with -v3. Differential Revision: D128232627
ESoapW
force-pushed
the
export-D128232627
branch
from
October 31, 2026 00:46
8d81498 to
4cdf08d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This diff adds the conditions for what the sidecar writes. It writes NTP on every host, with -v3. It writes PTP and PRTC, and everything else PTP needs (v1, v2 and the linearizability tests), only on a PTP host: one where /dev/fbclock/ptp exists and -iface's PHC opens. A PTP host runs exactly as today; only hosts without PTP change.
Today the sidecar can't run on a host without PTP. It exits at startup without a PHC, and it always writes v1, runs the sptp loop and starts the linearizability tests. That blocks -v3 on those hosts. Chrony mode used to cover them, and D127943753 removed it.
The daemon checks the conditions at startup. The device is what marks a PTP host, since non-PTP NICs can have a PHC too. Any error from either check counts as no PTP, and the startup log line says why. A host without PTP then checks again every 10 s, the pace at which systemd restarts a sidecar that exits, and once the device exists and the PHC opens, it exits so that the restart runs PTP. So a link that udev makes after the sidecar started, at boot or on a turnup, or a PHC that comes back after a NIC reset, gets PTP without anyone restarting the sidecar, and ntp keeps flowing meanwhile. That matters once -manage goes off: today, with -manage on, main exits when -iface has no PHC and systemd retries.
Without PTP the sidecar writes only v3's ntp section (header 0x4) and keeps running. There's no PHC setup, no v1 or v2 file, no sptp loop, no PTP counters and no linearizability tests, whose failures fbclock.mon alerts on and FBAR answers by restarting sptp. It exits at startup when it has nothing to write: without -v3, or when /run/fbclock/data can't be opened. With -manage on, main exits before the daemon starts when -iface has no PHC, so for the v3 rollout those hosts run with -manage=false.
How the sidecar starts, before and after:
https://pxl.cl/hX3GC
In code, New checks the conditions and keeps the result, openDataV3 builds v3's header from it (0x7 on a PTP host, 0x4 without), and Run starts the ntp loop on every host. On a host without PTP, Run then waits there and re-checks every 10 s. Everything below that stop is today's Run, except that it no longer opens v3 itself.
The open-source fbclock-daemon shares this code. A host with a PHC, -manage=false and no /dev/fbclock/ptp now writes only ntp, or fails without -v3, where today's daemon runs PTP. The open-source client library doesn't init there on default options, so those setups don't change. A caller that opted into NTP or ANY loses data_v2 there.
No new files or flags. Without PTP the daemon creates only /run/fbclock/data, which it already creates with -v3.
Differential Revision: D128232627