gve: add support for PTP gettimex64
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v8 Latest3 patches 19 repliesApplied 3/3
- v73 patches 2 repliesSuperseded
- v63 patches 7 repliesSuperseded
Earlier versions · 5
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 | 3 patches | 4 replies | Superseded | |
| v4 | 3 patches | 3 replies | Superseded | |
| v3 | 3 patches | 6 replies | Superseded | |
| v2 | 3 patches | 12 replies | Superseded | |
| v1 | 3 patches | 0 replies | Superseded |
Changes in v8 from the cover letter
- Fixed opcode extraction for extended commands (Sashiko)
- Link to v7: https://lore.kernel.org/netdev/[email protected]/
Patches in v8 All 3 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | gve: skip error logging for retryable AdminQ commandsdrivers/ | +33 | 0 replies | Applied |
| 2/3 | gve: make nic clock reads thread safedrivers/ drivers/ drivers/ | +63 | 0 replies | Applied |
| 3/3 | gve: implement PTP gettimex64drivers/ drivers/ drivers/ +1 more | +255 | 19 replies | Applied |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Jacob Keller | Joshua Washington | Willem de Bruijn | Kevin Yang | Naman Gulati |
|---|---|---|---|---|---|
| 1/3 | R-b | R-b | |||
| 2/3 | R-b | R-b | |||
| 3/3 | R-b | R-b | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.
Cover letter [PATCH net-next v8 0/3] gve: add support for PTP gettimex64
From: Jordan Rhee <[email protected]>
This patch series adds support to obtain near-simultaneous NIC and system timestamps with gettimex64. This enables daemons like chrony and phc2sys to synchronize the system clock to the NIC clock.
GVE does not have direct register access to the NIC hardware clock, so it must issue an AdminQ command to read the NIC clock. Two paths for obtaining a cross-timestamp are implemented: a precise path using system counter values sampled by the device, and a fallback path using system counter values sampled in the driver using ptp_read_system_prets()/postts().
To use the precise path, the current system clocksource must match the units returned by the device, which on x86 is X86_TSC and on ARM64 is ARM_ARCH_COUNTER. The clockid requested for the cross-timestamp must be either CLOCK_REALTIME or CLOCK_MONOTONIC_RAW. These conditions hold by default on GCP VMs using Chrony, so we expect the precise path to be used the vast majority of the time. If the system clocksource is changed to kvm-clock, it activates the fallback path. Ethtool counters have been added to count how many times each path is used.
The uncertainty window in the precise path is typically around 1-2us, while in the fallback path is around 60-80us. This table shows a comparison in chrony tracking statistics between the precise path and fallback path. The RMS offset is nearly 4 orders of magnitude smaller in the precise path.
| | Fallback Path | Precise path | | --------------- | --------------------- | ------------------------ | | System time | 0.000000005 s slow | 0.000000001 s fast | | Last offset | +0.000005606 seconds | +0.000000001 seconds | | RMS offset | 0.000009020 seconds | 0.000000002 seconds | | Frequency | 4.115 ppm fast | 0.362 ppm fast | | Residual freq | +2.515 ppm | +0.000 ppm | | Skew | 18.480 ppm | 0.001 ppm | | Root delay | 0.000000001 seconds | 0.000000001 seconds | | Root dispersion | 0.000081905 seconds | 0.000001169 seconds | | Update interval | 0.5 seconds | 0.5 seconds | | Leap status | Normal | Normal |
The first two patches pave the way for the PTP implementation by quieting excessive logging and refactoring an existing routine for thread safety.
---
Changelog:
V8:
- Fixed opcode extraction for extended commands (Sashiko)
- Link to v7: https://lore.kernel.org/netdev/[email protected]/
V7:
- Changed err from u32 to int (Sashiko)
- Actually committed stubs for adjtime and adjfine (Sashiko)
- Picked up Jake Keller's review tags
- Link to v6: https://lore.kernel.org/netdev/[email protected]/
V6:
- Added a fallback to driver-sampled time sandwich that is used when
the following conditions are not met:
- The system clock source is X86_TSC or ARM_ARCH_COUNTER
- The requested clockid is CLOCK_REALTIME or CLOCK_MONOTONIC_RAW
- The architecture is x86 or ARM64
- Added ethtool statistics to count how many cross-timestamps used the
precise path versus fallback path.
- Fixed printf format specifier.
- Added stub implementions of adjtime and adjfine to prevent NULL
dereference when phc2sys tries to adjust clock.
- Moved system time snapshot back to gve_ptp_gettimex64() so we can get
the current system clock source from it. It is OK for it to be outside
the mutex and retry loop because lock contention and retries should be extremely rare, and chrony filters out bad samples.
- Link to v5: https://lore.kernel.org/netdev/[email protected]/
V5:
- Reformulate retry loop in terms of total timeout instead of retry
count (Jakub Kicinski)
- Link to v4: https://lore.kernel.org/netdev/[email protected]/
V4:
- Call out change to dev_err_ratelimited() in patch 1 commit message (Jacob Keller)
- Ensure only one log is emitted when command returns GVE_ADMINQ_COMMAND_UNSET (Jacob Keller)
- Link to v3: https://lore.kernel.org/netdev/[email protected]/
V3:
- Take system time snapshot inside the mutex
- Return -EOPNOTSUPP if cross-timestamp is requested on an arch other
than x86 or arm64
- Fix initialization to only register PTP clock once all data is
initialized
- Link to v2: https://lore.kernel.org/netdev/[email protected]/
V2:
- Fixed compilation warning on ARM by casting to u64
- Link to v1: https://lore.kernel.org/netdev/[email protected]/
---
Ankit Garg (1):
gve: make nic clock reads thread safe
Jordan Rhee (2):
gve: skip error logging for retryable AdminQ commands
gve: implement PTP gettimex64
drivers/net/ethernet/google/gve/gve.h | 20 +- drivers/net/ethernet/google/gve/gve_adminq.c | 41 +- drivers/net/ethernet/google/gve/gve_adminq.h | 4 +- drivers/net/ethernet/google/gve/gve_ethtool.c | 6 +- drivers/net/ethernet/google/gve/gve_ptp.c | 369 ++++++++++++++---- 5 files changed, 344 insertions(+), 96 deletions(-)
base-commit: 8ebd24a7822cbae25beeafba49b2159d6a68a5f2
Signature · 1 line
2.54.0.563.g4f69b47b94-goog