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 986F78013F for ; Mon, 31 Aug 2026 22:47:22 +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 67VMkAbb030846; Tue, 1 Sep 2026 01:46:11 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67VMkAbb030846 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="HdAlJqZ7" 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 67VMk5Vu030829 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 1 Sep 2026 01:46:06 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67VMk5Vu030829 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4955fd77c18so21437845e9.2 for ; Mon, 31 Aug 2026 15:46:06 -0700 (PDT) X-Gm-Message-State: AFuF++nCuA5eb7gZPgGdt5u8BvsB0tCX1VyA/yomKjTg3PgyQlZxJC9j y6dzemmD/oTqOaeiv5TSHcmnlB/AHYYWCVG4LIGxNbHoc7UhjuWzsQb/k7qSyi6Xy9/c9lc+Pqp OyDh4+Dwt+J1A7IfaWbJKV6Ulid+k556Jv8cq3GLeeyyy7Wt2hEe2rw== X-Gm-Gg: AR+sD11qVlXW8tY3WmQ2zvfynaqHXr49hZjDMPhf7Qi5vMxyztADdBUVJb5xjHh4aV1 ck/V4KyGp0FbbUDH+1mBYiB3v4OdljwracOHOq9EpNe/U5ux1KxA1ny8834X05xvHB49r61wmbj 0YK92mA54nV2gLmqkP4TdoBBjZ2TmmKUWwGPfnEgByZrfIgktZGkNWF2YLCfWU5/gZPUBo7vOHo +PGB1DPmsUFsNfmUrnM0wxuSwkzNNj7OU+P2sheFB6AeXmnsKKjMo29mhjwiG+Vx04munVB2P87 jb+s12PRE5raXMsdb4qieV4C/78rA5Ik2rKUSBExFuUak0iqyi0Zlufq1UEuqIuprbCm8ZIissj ehqYkNjK+vSwqolEV5i7lcUmDMw== X-Received: by 2002:a05:600c:3b13:b0:495:4d5c:903e with SMTP id 5b1f17b1804b1-49cdc4332d4mr66278455e9.7.1788216365719; Mon, 31 Aug 2026 15:46:05 -0700 (PDT) X-Received: by 2002:a05:600c:3b13:b0:495:4d5c:903e with SMTP id 5b1f17b1804b1-49cdc4332d4mr66277985e9.7.1788216365314; Mon, 31 Aug 2026 15:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1788216365; cv=none; d=google.com; s=arc-20260327; b=bUZxdWAnffTTLS+09Hv30f8M9Vt0pWesJcKlYyIgso026kurzccJ6LgwObd5R7bKzM JTWOyVBNhY9MJv0tXOJB90w1RL41DMWviYfKRlfNrGA+Nld3zrb9hAB7SxRbWBupgX6R iqbPfXk3/ctofr0RrRZ+IrZvZ1dyQ9IVMPUue8/qfBFirddkyxkWGiDRBObdR3dabFS0 hm3Ng83+SL1UtUgteKqGEVYwKl0tSwz7Tn5cD1N6/svK84y6pwcpSJ40EhCBw2NCEVle DDxt67USJJk8G0Uk59gNGFqUtHTJmTiwZ30OUdpLo3HswK+kdSjo8UVmrMD4oDT1RVjq AFnA== 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=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=ZQRO0F86xwEvCdlKa1AytoOZXW2Tn5qrt2VrbVsV6gA9xfuF3gdwO9BPuWyeJNYkW6 IgESboq2eN48VFAct4Un1zGjyP85/OxcI71FBYdwdyi2Th3Znjq/NiGLA+FlMOyBoKyR +xdCR8Z91t2rEVTZkaCylVppk7422UbHvRomNcwQOx+Zb0aYT/kUuhhY02HAqzkKBbuq 6MtQUt6+FFqaP3KUu8+K+YBKXXcgryX52LreSOMs39j3yzblPmO27NH1e4CkW72KyIwE ucj4/tTKrAkcw1XpSZQwiysjlHZZWMAjPIbumrNBhW2ZrZ2fCy5WRZhPf6dCp89Tl9Vx Z4wA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=HdAlJqZ7; 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 5b1f17b1804b1-49cdce4c6ecsi17112395e9.18.2026.08.31.15.46.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 15:46:05 -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=HdAlJqZ7; 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=HdAlJqZ7ROcv nI/B7ZF2o6zjJRswhHy6cdAKUM+ME50ZM/KXlxxmPEI5IvqxMzuRMM8sXWIkczETEF7V9DbgO770B VxKorkyrW4gh4akEAy5nkKgiV7sgR4u0n1yB8DexPgbjwFx35fUdcUBRJTWbpflrHhIoAcmrtzHMH VAqDICCJmteV+FZ5WjL4uva0/knw3Pn7I/OpPm642ErOV4recrLanvg3gZfNlYErqk3KMN3He//HC 5PxQtSksmefdHMZEZ29VrnCdnqXVp1+6EXNBjKa7aJjlOU5ZYyBJjOZR6jRZ7MuPWDjfDM2WS7Rvr /6I3KU/Xe/chnnc5WajWew==; 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 1x1Aj4-009fqa-0k; Tue, 01 Sep 2026 00:45:56 +0200 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Tue, 1 Sep 2026 01:45:59 +0300 Message-ID: <20260831224603.1641737-2-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831224603.1641737-1-eva.kurchatova@virtuozzo.com> References: <20260831224603.1641737-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH vz10 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