From nobody Sat Jul 25 22:31:42 2026 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 392CE13D886 for ; Mon, 13 Jul 2026 02:00:56 +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=1783908057; cv=none; b=hp7V3djSuVhDcs+Ebqeio8ZUJyVoQipej44KO/Pdp0QiasZ5/hj/h9PeEuc8bdOV63PGJmJp1N0S51mCPILdlZQdUc6dXypmT+6ubYkIR714DZ1bBcWvcL3O96qqNnS7I3FedTDTOezaNrtl05oghCbscf7OavY7GIPYFT1g0eQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783908057; c=relaxed/simple; bh=NJvX4kCRFksJa0wb0RXVmH2j/5ZLTl9fmErLszuC8Ko=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ph2hRDHo5+kmcNeUqvVmWpG5EkM1E8ObYgDzW3312Upzswv23pPWboC0YrWeoE2CJu4ebgkGwxBoxAr1DWqPWZENAodEo7VFZSezCy3GPCaO0xkp1Sd0egM8RfDXc4hapl1z7e4QuJkT4wHlZzDOHCoVe8brcd04xxSDCHQNnQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--wakel.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KEQRsBy2; 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--wakel.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KEQRsBy2" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-37fca5f21b1so3273470a91.0 for ; Sun, 12 Jul 2026 19:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783908055; x=1784512855; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/aKXi+914ETzc5OT00HoyBu/yEdiUI+Jo2Zkp+kvf+M=; b=KEQRsBy2hgmfMDBWwEWlZEYvqz5sRlowjyLskqZzKT9ybGhGg2JXQ4AzbTc1oC6wqH ZDvnBIFCe8NNl9usuBgNFM9zpqBRVXXUwdAb2plhq9oJvNSjb6LzWGanFQ1z8X+geowJ B6jD/tiC8EFdLEQHrzRwndLZwrH0YmfOBylFp6DAmf4Rg5+2DTBwd5R2wDVOH4zc3J4/ EzZQfppUC6MufEBdbgxX0YNhhwtatfstl3uQnHy0tYj1d2DHpDNQLOxO+x6AKYXRNq6/ wlJcmQ4kTM+8Il2wyaHpZRVYFGmAfebb/JUhXErv+TZAEXSYaJd7qrPlbr/Pp6xLMBCf p4JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783908055; x=1784512855; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/aKXi+914ETzc5OT00HoyBu/yEdiUI+Jo2Zkp+kvf+M=; b=Ja+yL6r6U/NY1PuZ+EaI8DLV4iAf4hK/TYpmMoEqfS4S98hpq6hZ5A6tJaGAO97fQM sA7UGBnI5yuVRt6Pg5zha2SqpYRcMxvp/mGsgl2Lz2vrIlgU3fKYkeLqVlE/V3Hod5vB nUVr33iwjJ43xK8N3suGnFU78zvNWDWQ+ZWdzhAWzOTh1JfUTe0gptFr47CDSoo5HPl3 uEHj24c1kibhYW8fe2N4LR/XJ6KEtV9JsFyT+JA5TFev8EJdHzK9dqAnVwiL62SHL7GO oNDbOQCraLU9x24ieL2saOHsvbpUKsxRokTLz/seaj15+SOKB302RTf3kuhjm9423MBH MfYA== X-Forwarded-Encrypted: i=1; AHgh+RopeyeCc59/LVaIJALFSuWi+0ZWBOd1Nu/gi15mR2NOb4pMsmQs3LNBvoY5QMCragjTHS6mNRwusHiF8Mk=@vger.kernel.org X-Gm-Message-State: AOJu0Ywj9ZPFVwrmkp43jnEruosAbTAKgG1D6WZfnpddtD4oRfk6NfBG Kxcqsri7ma92sfqRXMBp3baQczDeRe2NhjjMlSFhkIWXRUJ9a39pQ+bXJK5mWzu7vLBDG3gehub xnA== X-Received: from pjvd13.prod.google.com ([2002:a17:90a:d98d:b0:38d:f086:96]) (user=wakel job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3901:b0:37f:d265:18d2 with SMTP id 98e67ed59e1d1-38dc81b0ec8mr5882908a91.7.1783908055110; Sun, 12 Jul 2026 19:00:55 -0700 (PDT) Date: Mon, 13 Jul 2026 02:00:53 +0000 In-Reply-To: <20260710025144.2000000-1-wakel@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260710025144.2000000-1-wakel@google.com> X-Mailer: git-send-email 2.55.0.795.g602f6c329a-goog Message-ID: <20260713020053.3897259-1-wakel@google.com> Subject: [PATCH v2] selftests: timers: Make sleep time in raw_skew configurable From: Wake Liu To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , John Stultz , Shuah Khan Cc: Stephen Boyd , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Wake Liu Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The raw_skew test currently sleeps for 120 seconds to estimate clock drift. This is a very long time for a single test, and can cause timeouts in automated test suites or CI systems. Allow overriding the sleep time via a command line argument, so it can be adjusted if needed in different environments, while keeping the default at 120 seconds to preserve original behavior. Also add -h/--help support to document this option. Signed-off-by: Wake Liu Acked-by: John Stultz --- tools/testing/selftests/timers/raw_skew.c | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/self= tests/timers/raw_skew.c index a7bae7d80916..5fff3eaf1307 100644 --- a/tools/testing/selftests/timers/raw_skew.c +++ b/tools/testing/selftests/timers/raw_skew.c @@ -27,6 +27,7 @@ #include #include #include "kselftest.h" +#include =20 #define shift_right(x, s) ({ \ __typeof__(x) __x =3D (x); \ @@ -87,11 +88,30 @@ void get_monotonic_and_raw(struct timespec *mon, struct= timespec *raw) } } =20 +static void usage(char *argv0) +{ + printf("Usage: %s [sleep_secs]\n", argv0); + printf(" sleep_secs: time to sleep in seconds to estimate clock drift (d= efault: 120s)\n"); +} + int main(int argc, char **argv) { struct timespec mon, raw, start, end; long long delta1, delta2, interval, eppm, ppm; struct timex tx1, tx2; + int sleep_sec =3D 120; + + if (argc > 1) { + if (strcmp(argv[1], "-h") =3D=3D 0 || strcmp(argv[1], "--help") =3D=3D 0= ) { + usage(argv[0]); + ksft_exit_pass(); + } + sleep_sec =3D atoi(argv[1]); + if (sleep_sec <=3D 0) { + printf("Invalid sleep time, using default 120s\n"); + sleep_sec =3D 120; + } + } =20 setbuf(stdout, NULL); =20 @@ -109,9 +129,9 @@ int main(int argc, char **argv) if (tx1.offset) printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate resu= lts\n"); =20 - printf("Estimating clock drift: "); + printf("Estimating clock drift (%ds): ", sleep_sec); fflush(stdout); - sleep(120); + sleep(sleep_sec); =20 get_monotonic_and_raw(&mon, &raw); end =3D mon; --=20 2.55.0.795.g602f6c329a-goog