From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 4F21B8017D for ; Mon, 21 Sep 2026 20:48:17 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68LKl05v010828; Mon, 21 Sep 2026 23:47:03 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68LKl05v010828 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="iOeadQQb" Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68LKkoBK010808 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 21 Sep 2026 23:46:50 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68LKkoBK010808 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4957287363bso29930925e9.0 for ; Mon, 21 Sep 2026 13:46:50 -0700 (PDT) X-Gm-Message-State: AFuF++nKXlP3BZGZbHaDX9xQbEIVQ0JUDa2xabzK6uVCWlt/w5Hp4vng duyfbwfPzFmyWNuyDEovhkrPV3ggyLeay67lZkm878ZakSKxMMBreQ+RR4nnyUkxZ1RxqUuG2bV peI426YidlydVRQHHj63/Hn/jfHIUi/lXfpLdyZyox1nSz/Uncl2/xA== X-Gm-Gg: AYBFou2WDy4LtjG90CBPevdPfqafGwXnMCEKxiPav0NADoKACqtx/lTPf4p4dE1WtZd rvL2+ilFJpbK5AKLsrVnzGGWVs3dvLuqV2KktNf+wzXBK4DjT6I8oKFgoGBQdAMkU6XQ8ejCNz/ PGKjnbX54wJbcVgswenJQQykOJClccur87hRKbfhb0PAwlKmSUSiADVugr2SzL+/jjtTw52YoYx 1hf0uk9tKl24OqeWUTBcq6NnWZRH4pRSykNnQl5TsBUUZJxZpp8nnQwL9oW6NI2cQheM2tz9kR9 gGXpAqGRyTx/MaRCk5U9R6wyLr0ruJ8fLHT8/vu7UQp0ZEk1QFMY5TY6kGkZsF6ijEz7max4H21 OH7vkUkakjTaf6Nq3JMLGckU14g== X-Received: by 2002:a05:600c:8a0a:10b0:49f:ce73:5e95 with SMTP id 5b1f17b1804b1-49fce735f50mr76425245e9.35.1790023610324; Mon, 21 Sep 2026 13:46:50 -0700 (PDT) X-Received: by 2002:a05:600c:8a0a:10b0:49f:ce73:5e95 with SMTP id 5b1f17b1804b1-49fce735f50mr76425085e9.35.1790023609890; Mon, 21 Sep 2026 13:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790023609; cv=none; d=google.com; s=arc-20260327; b=mhWRPiPT46W5qZHQ0l8E2RrUBW1CIiI2VMF9Ybh0kYHARcB5jXwcQrml6XOactWjpD KEZBjwhKjs6fZKwF6I5GXVCwcJMAZkYF7lEf/NCaSVt0yH06EfN2XwealGQmLBNCEcBW fNvM6BdSgUt/RnPVdPnHjvfqR4RAmC48tBo0Ewq6mWt9Y9iQrHYnAVuS9T7YOJBewrT+ gpU7TuROhp8Ks0vn7F2YhzPswx+GyQuAFwUbLFJ8JYizOepitixX3jEvwqt0zrIniab2 uwngvHEXy853NBGb7I47itFTrCacpZnA8vV8fikxRbI2LbsW3G9WE4Azlz7M6o7FHaj6 fmQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=/tlXCk/C1HUZiIRe9UC5s9XRD9+bdrpxrOsj8DrXKZE=; fh=bRmlDJ6vflC8xapCpe8SIKiBemLWBr+xozKix8GBr/Q=; b=r0WSAneA07w+DkxGa3dheDcIJTAnrZcGltcHhbbrVxCztJEBuCB1R6q2NBjS6/i+IY JrTKi5uIGyIDSj5pbLtw5FEDXDdcCB6acp+FBggsLsctTnAmpcW3LAnfZ9JjSE6UqYDI yyUUUlkOKqhzZKy9oC+7xWmYjjEEqSu+CuHpBjQz2m86DXklicX7pw2v1uT1DvxKCNth 8twrSkdDus/dWh2AAcd+gcslujHdKAob2EA8SrLLkhsxP19LiVrWNhkA/MMh7nEtodxV 9oyMWUrBwup9CesJAya3QfpS+Fi9kq8mXo3mnuhWGoeaN8bxOJOJaMEFKZsZZQZIc2Pz T5tA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iOeadQQb; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48862241861si65616f8f.318.2026.09.21.13.46.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 13:46:49 -0700 (PDT) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iOeadQQb; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=/tlXCk/C1HUZiIRe9UC5s9XRD9+bdrpxrOsj8DrXKZE=; b=iOeadQQbeBKQ xWEFlwlAxUm9uPTR0l+3PNMXUROUXto7rG6fZYQfN4QKS17HYVIK/4Dqnr8NSALO5ED0kvee8zYDR 7QlZMF5Z1nkJFZ7mJYrq4auMEKVl7bAQajHwqjQUhJ5qgMAGTUP87ZFvqoLqOYq6p1VTUPQfGMNc8 QlXVP4LElA4sx74p7wBxYxIeggagUNNe8AHoSvIJulbQl4G4dsTwr3L9fy3CFjR3HgFKt9aoDlIhn sNnaj6eRZqB37NM52OE0aLfr7GeXWfYSKWq2/KqIPDsGD6rm9IsPMs7JuYQ2T/i1np9OuIOGyrnqb 3MIHyjzPv2j6fr4KpoHDoA==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1x8krf-009pCP-0P; Mon, 21 Sep 2026 22:46:40 +0200 From: Eva Kurchatova To: vasileios.almpanis@virtuozzo.com Date: Mon, 21 Sep 2026 23:46:29 +0300 Message-ID: <20260921204643.2692341-3-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260921204643.2692341-1-eva.kurchatova@virtuozzo.com> References: <20260921204643.2692341-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH vz10 v2 2/3] selftests: timers: count what tick is worth in the drift estimate X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org raw_skew measures the drift between CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW and compares it against the adjustment adjtimex reports, but it reads only tx.freq for the latter. The kernel takes the tick value into the adjustment as well, a microsecond of the tick length per unit, a hundred ppm each, and a time sync daemon does put the coarse part of its correction there. Where it does, the two numbers cannot meet: # Estimating clock drift: -51.724(est) 48.277(act) [FAILED] On the machine measured, chronyd held freq at 48.278 ppm with tick at 9999, so the correction really applied is -51.722 ppm, which is what the clocks show. The skip for an externally adjusted clock does not catch it: the clock is steady, offset is zero and neither freq nor tick move during the run. Count what tick is worth alongside freq, on the same machine: # Estimating clock drift: -51.724(est) -51.723(act) [OK] https://virtuozzo.atlassian.net/browse/VSTOR-143363 Feature: fix selftests Signed-off-by: Eva Kurchatova --- tools/testing/selftests/timers/raw_skew.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c index 957f7cd29cb1..b798fa1ba37e 100644 --- a/tools/testing/selftests/timers/raw_skew.c +++ b/tools/testing/selftests/timers/raw_skew.c @@ -91,6 +91,7 @@ int main(int argc, char **argv) { struct timespec mon, raw, start, end; long long delta1, delta2, interval, eppm, ppm; + long tick_nom; struct timex tx1, tx2; setbuf(stdout, NULL); @@ -129,6 +130,17 @@ int main(int argc, char **argv) /* Avg the two actual freq samples adjtimex gave us */ ppm = (long long)(tx1.freq + tx2.freq) * 1000 / 2; ppm = shift_right(ppm, 16); + + /* + * The tick value holds the coarse part of the adjustment, a + * microsecond of the tick length per unit, and time sync daemons + * do put part of their correction there. What it is worth has to + * be counted in as well, or a clock disciplined through it looks + * off by a hundred ppm a unit against what the two clocks show. + */ + tick_nom = USEC_PER_SEC / sysconf(_SC_CLK_TCK); + ppm += (long long)(tx1.tick + tx2.tick - 2 * tick_nom) * + (USEC_PER_SEC / tick_nom) * 1000 / 2; printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000))); if (llabs(eppm - ppm) > 1000) { -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel