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 308058015B for ; Mon, 21 Sep 2026 20:49:28 +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 68LKlDdT010843; Mon, 21 Sep 2026 23:47:14 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68LKlDdT010843 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="UXlH4TyT" Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68LKkoie010810 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 21 Sep 2026 23:46:51 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68LKkoie010810 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-49953abe51fso20500035e9.1 for ; Mon, 21 Sep 2026 13:46:50 -0700 (PDT) X-Gm-Message-State: AFuF++lJmCZp1wZmC1qHkJs4aR3A79fqsvaaoet2EWEjZsdeq0GINMT0 i3qnatKJ/TMEHE0sTX6xvkg9A1BMBAIDiET/nu1n+DL+ueRGZ5v3MVACuYJow+sEpj7SHFWDq2a pnDWMCMf3FS+n2J51YPBfAnTdGQEDXUuEp+5d/L/YXWmtG10AfKv67A== X-Gm-Gg: AYBFou2AEzVsfI7HRyCFLtSiwLFBVU3Fep3xrKAo+av6BzQFFcuXcVxqgzKJCZzZdju GUausIaTJRa3jjvZK7NJahl94XW4ut15r7lPzpBFKa/9S1fTkOa0K8sLqfpBr9reQGjqs3yHTZG KmGtVFe6b//PChRCNZK9XidBhJFNOPzDrCtf+5H2qMee8C7xWu0mOHhPZmfVEn7Sp1/mwMJNPvb SDM/J0v2oAa4mo4oAMhDzs04axqWVYmk4q9q9yrwSZ4b5fghPvqlwK4G491qmEYsFkGvhRtBupB cesMfgH+8g5qY8s78L0Be49Ye4TCUJkbB3/ie+FMOXk5brPyJbU3ZnwI+3Yg0IsojmjJ12yfpps 7Z2XSCFoQaFxVNpEQ5IvFf6hJmg== X-Received: by 2002:a05:600c:5250:b0:49f:bd0d:59f5 with SMTP id 5b1f17b1804b1-49fc5746338mr178062735e9.18.1790023610626; Mon, 21 Sep 2026 13:46:50 -0700 (PDT) X-Received: by 2002:a05:600c:5250:b0:49f:bd0d:59f5 with SMTP id 5b1f17b1804b1-49fc5746338mr178062525e9.18.1790023610163; Mon, 21 Sep 2026 13:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790023610; cv=none; d=google.com; s=arc-20260327; b=TMIz0ifi7hmZ304fyAGd04zEigvu0GnIEOKyUZg1XLrAJxDL4kFSMScAFTsrUKGBO4 hsRCwqT3fr3mhVVj98TARMJkGR2VeJYrlFyfNVBlHM7gddptkOKtVW12jZcrS5+1EGJv CP1MSmt/2PPMKaTnKhJ1Qx1o2idZdDs/3OsbfTq1eZDR7loi5qK89YhAsYkNnnNYXOYt +Mf5sHcggFHFEW5/0zBUId98CLIELwjmfMOSBWY6R3ij7xWVYl+siSFSAFFpuxXFkIqd Bmj8koZF5ycbP3tMPYP9sSZf2kejRxfRyWb+7QahecexgVIAb9awHEDt+CfTq219Z/zD 4g9A== 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=lxWtI2BO9W5zMRZc1cloYHWodyaQqnktRXFrAgRxFw4=; fh=bRmlDJ6vflC8xapCpe8SIKiBemLWBr+xozKix8GBr/Q=; b=FAjeXcMbhZwzvI7BwHUkAoeMHI1+zKEMOqjVvyxcCxMGdjQ4haSqpsRApXsAyYIlo7 wGb+D1zSBfSVyzPaFmLGWLAKSdEX4RN51mNQWzVbBK8qmP+xHgo0bM6/u2Jc6Z0RrIQs 8KK9wJRhwEt5WeGl0bk/q7u7rkuC34Pv71QFOV8wkzhEnBmt9PxeplltOmnXGYVZCvNg i4TpUg4kR2IrOGRqNfrwglsEFnOYKSKS/Dhx7S9/EmkHd0Aan28K3m7/rtZjlRqqxhwx 5z+gQutm7iTtkTnTGwdtBc0SYYySQC8kgtOyWIuhZWin3BSzcLrogX3coAsSA9y3U1l5 wOdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=UXlH4TyT; 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-488622485d5si96340f8f.351.2026.09.21.13.46.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 13:46:50 -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=UXlH4TyT; 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=lxWtI2BO9W5zMRZc1cloYHWodyaQqnktRXFrAgRxFw4=; b=UXlH4TyTsbB/ bwH1/YOzwZYsIM4hEZyNr3dF7xKYQ4ZHtpTigLT7D8OM7zTvISEa3ObkoADwIGoTUcMSdKFj6m/DC AgbIpZTY/SUCzrLCMwXnf1YjYZnsp1aAECI/gPLMfUi5GIJVWklHYHXdINVAvNtId7T2Qc7iiimVx 6K6SRjhi7rfB0RNw0afFIvEoa3ZzJqa3FMh/MIuNrLuaKgdIKnDXaLSv5I5vPSwetg0tt3Q5kTSd4 69B2MDHtivtr2DiS0EtUbBNQzDU4KYrYLs2RmRid1+yYlCK4iBaq8ymsFvtIzBII/BzdIGxiz+WqS +a0EGzSZxCwqP695EGpEXA==; 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-1H; Mon, 21 Sep 2026 22:46:41 +0200 From: Eva Kurchatova To: vasileios.almpanis@virtuozzo.com Date: Mon, 21 Sep 2026 23:46:30 +0300 Message-ID: <20260921204643.2692341-4-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 3/3] selftests: timers: measure each timer on the clock it is armed with 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 Commit b00385b8d081 ("selftests/posix_timers: Use CLOCK_THREAD_CPUTIME_ID for ITIMER_PROF measurements") gave ITIMER_PROF the clock it counts, as measuring a cpu timer against the wall says nothing on a machine where the task does not have a cpu to itself. The other timers are still measured against CLOCK_REALTIME and fail the same way. With four busy loops on the two cpus of a test machine: not ok 2 ITIMER_VIRTUAL not ok 5 timer_create() per CLOCK_THREAD_CPUTIME_ID not ok 6 timer_create() per CLOCK_PROCESS_CPUTIME_ID ITIMER_VIRTUAL counts the time the task spends in userspace, so take CLOCK_THREAD_CPUTIME_ID for it as well; the loop it runs stays in userspace, so what that clock adds for system time is far inside the half a second the check allows. check_timer_create() arms its timer on the clock it is given, so measure on that one. ITIMER_REAL is armed with CLOCK_MONOTONIC, in fork.c: hrtimer_setup(&sig->real_timer, it_real_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL); so measure it on that rather than on CLOCK_REALTIME, which a step of the wall clock would carry away from the timer it is timing. All three arms now choose a clock, so they read better as a switch, which also gives the unknown case somewhere to go. The test passes whole on that machine, 19 of 19, busy or idle. https://virtuozzo.atlassian.net/browse/VSTOR-143363 Feature: fix selftests Signed-off-by: Eva Kurchatova --- tools/testing/selftests/timers/posix_timers.c | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index 077a98fb1b1d..f5a92ede3a6d 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -108,18 +108,27 @@ static void check_itimer(int which, const char *name) struct itimerval val = { .it_value.tv_sec = DELAY, }; - int clock_id = CLOCK_REALTIME; + int clock_id; done = 0; - if (which == ITIMER_VIRTUAL) + /* Measure each timer on the clock the kernel arms it with. */ + switch (which) { + case ITIMER_VIRTUAL: + clock_id = CLOCK_THREAD_CPUTIME_ID; signal(SIGVTALRM, sig_handler); - else if (which == ITIMER_PROF) { + break; + case ITIMER_PROF: clock_id = CLOCK_THREAD_CPUTIME_ID; signal(SIGPROF, sig_handler); - } - else if (which == ITIMER_REAL) + break; + case ITIMER_REAL: + clock_id = CLOCK_MONOTONIC; signal(SIGALRM, sig_handler); + break; + default: + fatal_error(name, "unknown itimer"); + } if (clock_gettime(clock_id, &start)) fatal_error(name, "clock_gettime()"); @@ -146,7 +155,7 @@ static void check_timer_create(int which, const char *name) struct itimerspec val = { .it_value.tv_sec = DELAY, }; - int clock_id = CLOCK_REALTIME; + int clock_id = which; timer_t id; done = 0; -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel