From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DCD623AB88 for ; Wed, 29 Apr 2026 01:28:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777426105; cv=none; b=M+ySlGXztS9n2XL24EjRxtpQEwup8l2rpfjHzmcgCvxQpMRMjVL/18zuRCQHJnu34KOONQpivCC8dWSVHNr5e+J6Q9ctTozbdS82LpvF4gPORLwsBxZ14DOvXM+q9MUUrsJN+J0XxSehmNjocQzlBvxVCpp1eT6ar+vTIDH7xik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777426105; c=relaxed/simple; bh=zmJwPP5H/36Qy9Yn78dY9bAnPw5MKgKV3aHtvdWwKAI=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=bjXpajm0zSqjxBcOoOl1kKg214erL1Ao2aoN5CS7OA6dJl0ZUSphSpC4+TH3Yw0EYG8nMQqVfZZTKwE8D4YzqrUs2+q2A9kD/NuVjbSALZBJbgudJZdGz+9HRsCkAznQz2EGWP83TArS8Av5bEQJGLQDjpC2hBkjleUwwmzPdEY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--hramamurthy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RdC14iyG; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--hramamurthy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RdC14iyG" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-35d9278587bso14456713a91.2 for ; Tue, 28 Apr 2026 18:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777426104; x=1778030904; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=mu0FUvPadnlRyYwD6jTUGg5RqUrWd3I8LqUbgKPP4HU=; b=RdC14iyGtx35EFv93IjHTPZZwdTJTPn+YMRkaHamWdC2FzcMezqF7jvMXEDFAKMfxA NWmQs/ywswaFdJRUwo7+8tbnzdykYQbzb4XifSCG4Ks+Dp8gft5Nk6+pbGyqxwuC/l9d kTFJNHa9dfhrFypsGUPDHMyQ3C2wfx/rvOPkIiohThi4WteHkEAHcaerZnfB9+Htb0q9 ydlDSu1c6rHwvHJ2oNyPX7a3mt9nrpHbkhiKQTCV0fH8DK5xF1nIq+SCd6qugHJx9277 9gO+U6aosrCdRskINg106gI/6v/DZv1LAiBpABGo7H/wSy9clkExdprSOYEaPV1J7TpQ zYLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777426104; x=1778030904; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mu0FUvPadnlRyYwD6jTUGg5RqUrWd3I8LqUbgKPP4HU=; b=dAw2OcnH/4EhMt6+bcvQnmWtF6eprC7x2dw+TB3qqtsDdqloIeCWlJrbZNak6B2d4C gMn01BUuPm+yOMd0xj2u/eQ4hS9X7RBRgLFAaFZjE+jB9plgu2tOOAotRXTLZLxyu8RN QCNcQ//P7W/b2Ud55mv4BLHYT6FZMefKv/+IIy17l24Vuce7z8+kvVR8V+TaWV0eQmK2 EqFmcQhoQp0WVljz/EMQ2Kiuy4DzwySgRLETNVK50Tn6ilcXEzeG+NIvaMSb2QFjB+XF AN08Furgyh3WFeUQhnDElfFoWM2CAAUaQ8X8c8yPBk+tzRaVnGeFeBFu452Z/CULJNiW bihg== X-Forwarded-Encrypted: i=1; AFNElJ98RvddKCBOwACShOfidpP3x+FDuUGgdQ+ZVfEZ+t+HrRE464eh3VrqgPhrYzx/ODzLWoInWMReysosvkg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7kf2Nyy+PqsdHEZpgNc9sUOyJg6LBmCcokYM5wtEul1bkeJ2t 5JGksEsWwUFCpOU8s4gG4x/FZK10u1edwF/WFvlZ/XKa5BQvIQ304blEqmO9urIP0Z4GBdy8/KQ DoyJTyDvSCv/lIk4QLZ3Lpm1vEw== X-Received: from pjbga9.prod.google.com ([2002:a17:90b:389:b0:35e:5ac0:1246]) (user=hramamurthy job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:562c:b0:362:f860:f9ba with SMTP id 98e67ed59e1d1-364a0ae65c7mr1771280a91.1.1777426103485; Tue, 28 Apr 2026 18:28:23 -0700 (PDT) Date: Wed, 29 Apr 2026 01:28:16 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Message-ID: <20260429012819.3102675-1-hramamurthy@google.com> Subject: [PATCH net-next v5 0/3] gve: add support for PTP gettimex64 From: Harshitha Ramamurthy To: netdev@vger.kernel.org Cc: joshwash@google.com, hramamurthy@google.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, jstultz@google.com, tglx@kernel.org, sboyd@kernel.org, willemb@google.com, nktgrg@google.com, jfraker@google.com, ziweixiao@google.com, maolson@google.com, jordanrhee@google.com, thostet@google.com, alok.a.tiwari@oracle.com, pkaligineedi@google.com, horms@kernel.org, dwmw2@infradead.org, jacob.e.keller@intel.com, yyd@google.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" From: Jordan Rhee 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. Due to relatively high latency of AQ commands (~100us), it is necessary for the hypervisor to sample the system time sandwich inside the AQ command. The first two patches pave the way for the PTP implementation by quieting excessive logging and refactoring an existing routine for thread safety. This table shows a comparison in chrony tracking statistics between the typical implementation pattern for gettimex64(), which is to call ptp_read_system_prets() / ptp_read_system_postts(), and the implementation in this patchset, which is to use the TSC values from the device. The RMS offset is nearly 4 orders of magnitude smaller in the chosen implementation. | | TSC from VM | TSC from device (this patchset) | | --------------- | --------------------- | ------------------------------- | | 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 | --- Changelog: V5: - Reformulate retry loop in terms of total timeout instead of retry count (Jakub Kicinski) - Link to v4: https://lore.kernel.org/netdev/20260406234002.3610542-1-hramamurthy@google.com/ 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/20260403194427.1830609-1-hramamurthy@google.com/ 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/20260326224527.1044097-1-hramamurthy@google.com/ V2: - Fixed compilation warning on ARM by casting to u64 - Link to v1: https://lore.kernel.org/netdev/20260323234829.3185051-1-hramamurthy@google.com/ --- 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 | 12 +- drivers/net/ethernet/google/gve/gve_adminq.c | 27 +- drivers/net/ethernet/google/gve/gve_adminq.h | 4 +- drivers/net/ethernet/google/gve/gve_ethtool.c | 3 +- drivers/net/ethernet/google/gve/gve_ptp.c | 316 +++++++++++++----- 5 files changed, 267 insertions(+), 95 deletions(-) base-commit: 790ead9394860e7d70c5e0e50a35b243e909a618 -- 2.54.0.545.g6539524ca2-goog