Article View: linux.kernel.netdev
Article #6495[PATCH net v5 0/5] ptp: make virtual clock sampling and teardown failure-safe
From: James Hilliard
Date: Thu, 22 Oct 2026 15:16
Date: Thu, 22 Oct 2026 15:16
71 lines
14678 bytes
14678 bytes
Fix virtual-clock sampling errors, registration rollback and parent
teardown in separate patches. Keep failed PHC reads out of the timecounter
and serialize extended samples with virtual-clock adjustments. Also
preserve the zero sentinel for packets without hardware timestamps.
Retain the existing cyclecounter mask, scaling and conversion windows.
Retry the first failed refresh promptly, then back off consecutive failures
up to the normal refresh interval. Queue the first refresh immediately
after registration. Prolonged sampling gaps remain subject to the existing
half-wrap conversion window and full-wrap sampling limit.
Changes in v5:
- Replace the fixed 10 ms failure retry with per-clock exponential backoff,
starting at 10 ms and capped at the normal two-second interval. Reset
the retry state after a successful refresh, following Sashiko's report
and Paolo Abeni's review.
- Report: https://lore.kernel.org/r/179245576913.3135.17393378308394380121@kernel.org
- Rebase onto current net.
- Link to v4: https://patch.msgid.link/20261015-ptp-vclock-sampling-v4-0-cba6ffc8ceb6@gmail.com
Changes in v4:
- Retry failed refreshes after 10 ms, keeping the normal two-second
interval after success.
- Queue the first refresh immediately after registration, while keeping
counter initialization before publication.
- Clarify the half-wrap conversion window and full-wrap sampling limit.
- Document the zero-input return from ptp_convert_timestamp().
- Add Vadim Fedorenko's Reviewed-by tags to patches 1 and 5.
- Rebase onto current net.
- Link to v3: https://patch.msgid.link/20261013-ptp-vclock-sampling-v3-0-d3ee4ea62fc6@gmail.com
Changes in v3:
- Split the independent fixes into separate patches, as requested by Paolo.
- Retain the existing timecounter arithmetic and conversion windows; drop
the full-width rewrite and extended-read anchor updates from v2.
- Propagate registration errors through sysfs, including a failed initial
PHC sample, and initialize the counter before publishing the clock.
- Preserve absent hardware timestamps instead of converting zero.
- Correct the sysfs teardown rationale and its Fixes tag.
- Rebase onto current net.
- Link to v2: https://patch.msgid.link/20261005-ptp-vclock-sampling-v2-0-8ed12d4d10af@gmail.com
Changes in v2:
- Drain virtual clock sysfs changes before parent unregister walks children.
- Use full-width samples and overflow-safe scaling across long sampling gaps.
- Update the anchor for extended and cross-timestamp reads under the clock lock.
- Link to v1: https://patch.msgid.link/20260930-ptp-vclock-sampling-v1-1-c11bc16691ae@gmail.com
Assisted-by: Codex:gpt-6-astra
---
James Hilliard (5):
ptp: drain virtual clock sysfs operations before unregistering children
ptp: unwind partially completed virtual clock creation
ptp: vclock: propagate physical clock sampling errors
ptp: vclock: serialize extended samples with counter updates
ptp: vclock: preserve missing hardware timestamps
drivers/ptp/ptp_clock.c | 5 ++
drivers/ptp/ptp_private.h | 5 +-
drivers/ptp/ptp_sysfs.c | 18 +++++-
drivers/ptp/ptp_vclock.c | 117 ++++++++++++++++++++++++++-------------
include/linux/ptp_clock_kernel.h | 2 +-
5 files changed, 104 insertions(+), 43 deletions(-)
---
base-commit: f4377bf85887f57b59abb5479f7660a81ffe4449
change-id: 20260930-ptp-vclock-sampling-902f98408c93
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
Technical Details
Message-ID:
<20261022-ptp-vclock-sampling-v5-0-06ceace17bac@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350647-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350647-linux-kernel-netdev=dewy.ru
From: james.hilliard1@gmail.com (James Hilliard)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v5 0/5] ptp: make virtual clock sampling and teardown
failure-safe
Date: Thu, 22 Oct 2026 09:16:40 -0600
Organization: Usenet Network
Message-ID: <20261022-ptp-vclock-sampling-v5-0-06ceace17bac@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="242050"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Fbl9677E93dQXqvYKYRkvQSqhZg= sha256:aVIwt/r8DujA3KgMm4Rg5hjQ0gqf0ExP7BS63oOJS9o=
sha1:qhPWwZGqi58SKDzs84os0Bn38TM= sha256:3wHd+/cwSnYMeXVloveQJiFziT9xEpZO2BLQwGNImS8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id D71181112CD; Thu, 22 Oct 2026 18:17:34 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.047
X-Spam-Status: No, score=-3.047 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id AbAIaYS61h-i;
Thu, 22 Oct 2026 18:17:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350647-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id C64191112CB; Thu, 22 Oct 2026 18:17:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 35CF632C3F; Thu, 22 Oct 2026 15:16:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792682209;
b=qcjixKkrQhWybWfe5u3UBekmyP6a3iCw2lxERMss/H3hwQyJBS8xV2RkROURGV5ocnlM
w+xgYpXA/cDKx7oXX3k3kqO5wcudaZuw6ee1OFfic68t5TlyxtGizMCWxq2T4zb8DpEHG
Sr4G8r7mELoIxAoKCE+HcKnFDM+lMZtwW3ZXqok7znU9DJlM9tQYaHg+xxHrti0jFLiUM
vwXgKm8crlN8IsyVS/CpJKVaLHpSD1iAe0qB2yGron1ms7Hsfaqz6FSRYSS7xm5CTV4Ii
41KE8x6/CX2qQHfTLlTZcjzofYG0gnsLkrO/vkGp8zVaa8vVQIDdPjtT6mvSOfR0eKg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792682209;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:Subject:Date:Message-Id:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding:
X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer;
bh=xUZNRCeZ9z5gfh4C0SQt/91FcFEsF8PF7oTyP3jiUAE=;
b=gUVUNeaTe1jN3JU0SSFb8Bke5ak1rQTtbgkkkzkLzecwCVZr89Szwd3/X0xFE6wqgmLl
h/h5mEFrsIpu00TM+hNiJFV3CYVBQbZx1jkxNU1IIehTOWyjtlZS6oQufm8xutqQxuczO
dmr4hj3RoCSbX1mPjKfamRWnN0y1UGr0fbf+9zryNgmVLEdKqhmkorbXarZDi5DyBUFrP
srDex3t3xzojLx0ozSsSDt2z/SA52eNdlBTNJC/UajhJPqro0MO8Nf3tN8klbI9g+a1Gj
OKyDyLFk8vNImi5zDwpUoXyK20SlKyMi2jE8T6vbAishrwi3v0QD+nJQZt2OlYsNILA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=PQNQg77c;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DBBC860A6F73;
Thu, 22 Oct 2026 15:16:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=PQNQg77c
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792682208;
b=mtjvmaX/GpN1rHLppgIdzhtBRYZwKk5v8swprOaerelBFJACcj+dqXOWXnNH3+u07ktc
L9j/8XMIHnc75EmBX2Ot4y5/nj/O05cJ1uu9Qvx1IRjTAQpWnQd9tNi9RfobB34XY3R9P
3ipfSCU5bhwKj0kOHV99kEAZSu9SWUjTqYjNS8Hq2WLwt81AANiWwEfxSP8/WNq3fWrI7
qUx+byWR9GgEXLaLR7aBwPM/i9wnrFMbX+HtmRGnBoht/04AKr6TJ/yumfUsXoV5vzaMy
WTd3FQOMxRNxkIuTv6bo1kHhGBZ4VE7w6Up/InOY0Xk3n7bpJ5ZKyE7vcK4AXnk75DA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792682208;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Subject:Date:
Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:
X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer;
bh=xUZNRCeZ9z5gfh4C0SQt/91FcFEsF8PF7oTyP3jiUAE=;
b=kz5vSZDJI5b8HGEjgWZnB8mRy8ZhNdo24p85Zr+OHdRkKM+V0Lx7gYwZJi/4mUSNxHyq
nz5qgwGNtOvqnZ5NxJreAbCmbai1Dtdx/yB9mJ0qUvdGHb/I6LwGD+6VZpIsUzMYxwd0U
g/FMajQP9fN4AHCRdfrWZ4fabe7Mj+aeK/bJfgnNSEwfG0faPgwtS2hOV0zsb0z7O0H2K
vyfRerWxEet2yzfz2ziXL7T9+iHF5qh8Bt+OwxcYM0BYBmznfiDBpoG0FP4GO/iF9A5mb
vn3W53/bNEHJEidWzX1YF+oWdrnfPP+eGzNYOZY8vrYlpmF/3RPlQH48NFou+RxUZKw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=PQNQg77c;
arc=none smtp.remote-ip=209.85.161.53
X-Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A917E606ACF3
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 15:16:47 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A917E606ACF3
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-6d290b10a35so882293eaf.2
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 08:16:47 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792682206; x=1793287006; darn=vger.kernel.org;
h=cc:to:content-transfer-encoding:content-type:mime-version
:message-id:date:subject:from:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=xUZNRCeZ9z5gfh4C0SQt/91FcFEsF8PF7oTyP3jiUAE=;
b=PQNQg77c9YG3sMVbs/CRq0dD0jdqBK16WUU/HsZLvNRmD61ES2q5Gq7LW9qCfkXlV5
X6b2DjRZxuGdiriIhuEKnr7aSeVz41KF1PzdNamzm2BE901YBOl9tE2ooIcKGQteDybK
KhbfsOTlAIQjCUV8SOBe0l3TmnMyLkfva4pk1fTo9jKhSgRR3UXjdMKgk+X6HZMYoql9
sosC7O5QaEd7hQK9rAO4AP425tqoMxzI28lFLGLNBcMyUmbBWM4rE+4Ik0h9vsUxWlCn
69adrX1U02e2t9gzo/dHFpIJqnn0Tzbt8A7K4VCvdNWRfY2N2yL2CQ2cc9bq7LsFTRJP
A2xg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792682206; x=1793287006;
h=cc:to:content-transfer-encoding:content-type:mime-version
:message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=xUZNRCeZ9z5gfh4C0SQt/91FcFEsF8PF7oTyP3jiUAE=;
b=jbpwg3EieOlU3J/VLgiQNaIkeDT4Dg0RAy2kDIeGFt1aTiEsw/8RAkaSMurOKJuJj6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nfDYoUMhG1LfIZAfH8+LJy3GOTyi
muTs8cG+8Wb2wAtBI2+/AAtRMY3pAyUzlNZT4for+Pmp3gUqYFZO0FgmDTam0Jiyh7/Ir5ILB6W
lXStQ=
X-Received: by 2002:a05:6820:2219:b0:6ff:fcf5:40e9 with SMTP id 006d021491bc7-70942610aaemr3372897eaf.70.1792682206527;
Thu, 22 Oct 2026 08:16:46 -0700 (PDT)
X-Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49])
by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a7d5eb8fc0sm4685631fac.1.2026.10.22.08.16.44
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 22 Oct 2026 08:16:44 -0700 (PDT)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-B4-Tracking: v=1; b=H4sIAAAAAAAC/33Oz2rDMAwG8FcpPtdDsl0T99T3KDs4spya5R9xM
Bsl7z6Tw+hKt+Mn8f2ku8i8JM7ifLiLhUvKaRprOB0Pgm5+7FimULNQoCw4DXJeZ1mon+hDZj/
MfRo76UBF1xhoyGlRm/PCMX3u6lWMvIr3OrylvE7L136p4L76Fy0oURJiS2itQ8+XbvCpf6Np2
L2ifgwEOL02lATZcEAVTEDw8dnQDwbq14auRtDMhr1VkeyzYR6NP/4w1aDW2xipIW5/Gdu2fQM
rWwO0hwEAAA==
X-Change-ID: 20260930-ptp-vclock-sampling-902f98408c93
X-Cc: Eric Dumazet <edumazet@kernel.org>,
"David S. Miller" <davem@davemloft.net>, linux-kernel@vger.kernel.org,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
James Hilliard <james.hilliard1@gmail.com>
X-Mailer: b4 0.15.2