From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7987D3C819A; Fri, 10 Jul 2026 07:25:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783668354; cv=none; b=upIxawu6M30GZturp0xm889RQOsMcCYfxcAGnlkFRXJuTRE1s3V9sR+rG8ABz6ooaRe/2L35MWG6WmlGp3/nFgC/SgJ+OpO8bv6i9K0vTiCNM3OdVrXzY3KLrzyLRBF5VC3NapVRrJz+DWIKS3/DAEY8A4rpTAMAQHaDK1vND/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783668354; c=relaxed/simple; bh=IPLy0GUPY6xt6QNa243LZY1kqNv2J3L0ON7qGFphxn8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=PxuxxtY6WobZIaO8iSztIGFCxaRZ7+Fikdj/cijKPG8oJCakOBUJRHuagJ1iEgR8Nq+jOqKV2oKSmu+1BcY4c525nR4yhf9d4WuJ7hSKNSyjtdWfT9ovKKKPfvmCKoKccKTnG7AL1Cp2jwJKeroG8Qw8C4UE2qz/aV8GvKiE50Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=YHeFyWBl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yqlDNwy2; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YHeFyWBl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yqlDNwy2" Date: Fri, 10 Jul 2026 07:25:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1783668350; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b5h02dE+N5SVrekMIOjIdCJFB3Cbfot1Mkn0xDSyEWk=; b=YHeFyWBlInMwxk4m/W4LRInltNY5LyYvBKuRzH9WjqtDQEK/ZMhG+CH79R2NhEZEpg6A+/ lAV2zjorN2GOJfojE/huk3+Ex0u1mMdfk8Sb72YH9nWNusir6J4OT1YhKGKmYF/+cZxfn7 iCZk5RZvnuCxqBKOrfxB33WmxHtBbhckUzf/j+Kk/rt/L1vv2KjTFYb/mdjhmFNqRAHcz2 2evVSTMoGpyLeN8kBFCKPSf09UfwmD6IDJ779R1FbFwt2XvjRLjL5anLyG1MKEmHbUE1YB e9GnAmOunIqhyrCmGYnXUk8Vuc/P0FozBhyKEWjM8r3SZDSPgZIIkwzUHoznww== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1783668350; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b5h02dE+N5SVrekMIOjIdCJFB3Cbfot1Mkn0xDSyEWk=; b=yqlDNwy24KwBGH44UO2aeDheDtGlP5BOquzGuZcRL8pZOmKRGBoQA+gvayjFam/PQgIyhl Dcu83gFgUVw4pHAw== From: "tip-bot2 for Wake Liu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] selftests: timers: Partially revert "Remove local NSEC_PER_SEC and USEC_PER_SEC defines" Cc: Wake Liu , Thomas Gleixner , John Stultz , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260610014721.718362-1-wakel@google.com> References: <20260610014721.718362-1-wakel@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178366834863.744054.7515305704032864678.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/core branch of tip: Commit-ID: f44ce7fdbdd00a596455b8689b62c12d5530d610 Gitweb: https://git.kernel.org/tip/f44ce7fdbdd00a596455b8689b62c12d553= 0d610 Author: Wake Liu AuthorDate: Wed, 10 Jun 2026 01:47:21=20 Committer: Thomas Gleixner CommitterDate: Fri, 10 Jul 2026 09:20:55 +02:00 selftests: timers: Partially revert "Remove local NSEC_PER_SEC and USEC_PER_S= EC defines" This partially reverts commit 80fa614e2fbc ("selftests: timers: Remove local NSEC_PER_SEC and USEC_PER_SEC defines"). The original commit removed local definitions of NSEC_PER_SEC and USEC_PER_SEC in favor of including . However, NSEC_PER_SEC in vdso/time64.h is defined as 1000000000L, which is 32-bit on 32-bit architectures. This causes integer overflow warnings in several timer tests when doing arithmetic like NSEC_PER_SEC * 10 on 32-bit systems. To fix this, restore the local definitions of NSEC_PER_SEC and USEC_PER_SEC in the test files, but use "LL" suffix consistently (1000000000LL and 1000000LL) to ensure 64-bit arithmetic and avoid overflows. We keep the cleanup from the original commit that renamed plural definitions (NSECS_PER_SEC/USECS_PER_SEC) to singular ones in posix_timers.c, but we now define them locally there as well. This also removes the dependency of the selftests on the internal kernel header . Signed-off-by: Wake Liu Signed-off-by: Thomas Gleixner Acked-by: John Stultz Link: https://patch.msgid.link/20260610014721.718362-1-wakel@google.com --- tools/testing/selftests/timers/Makefile | 2 +- tools/testing/selftests/timers/adjtick.c | 5 +++-- tools/testing/selftests/timers/alarmtimer-suspend.c | 3 ++- tools/testing/selftests/timers/inconsistency-check.c | 3 ++- tools/testing/selftests/timers/leap-a-day.c | 3 ++- tools/testing/selftests/timers/mqueue-lat.c | 3 ++- tools/testing/selftests/timers/nanosleep.c | 3 ++- tools/testing/selftests/timers/nsleep-lat.c | 3 ++- tools/testing/selftests/timers/posix_timers.c | 4 +++- tools/testing/selftests/timers/raw_skew.c | 3 ++- tools/testing/selftests/timers/set-2038.c | 3 ++- tools/testing/selftests/timers/set-timer-lat.c | 3 ++- tools/testing/selftests/timers/valid-adjtimex.c | 4 +++- 13 files changed, 28 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftest= s/timers/Makefile index 3220359..0e73a16 100644 --- a/tools/testing/selftests/timers/Makefile +++ b/tools/testing/selftests/timers/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS +=3D -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir) +CFLAGS +=3D -O3 -Wl,-no-as-needed -Wall LDLIBS +=3D -lrt -lpthread -lm =20 # these are all "safe" tests that don't modify diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftes= ts/timers/adjtick.c index 5b3ef70..22d274d 100644 --- a/tools/testing/selftests/timers/adjtick.c +++ b/tools/testing/selftests/timers/adjtick.c @@ -22,10 +22,11 @@ #include #include #include -#include - #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL +#define USEC_PER_SEC 1000000LL + #define MILLION 1000000 =20 long systick; diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/test= ing/selftests/timers/alarmtimer-suspend.c index aa66c80..d55d5b0 100644 --- a/tools/testing/selftests/timers/alarmtimer-suspend.c +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c @@ -28,10 +28,11 @@ #include #include #include -#include #include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + #define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs= */ =20 #define SUSPEND_SECS 15 diff --git a/tools/testing/selftests/timers/inconsistency-check.c b/tools/tes= ting/selftests/timers/inconsistency-check.c index e53e63e..9ab7066 100644 --- a/tools/testing/selftests/timers/inconsistency-check.c +++ b/tools/testing/selftests/timers/inconsistency-check.c @@ -28,9 +28,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + /* CLOCK_HWSPECIFIC =3D=3D CLOCK_SGI_CYCLE (Deprecated) */ #define CLOCK_HWSPECIFIC 10 =20 diff --git a/tools/testing/selftests/timers/leap-a-day.c b/tools/testing/self= tests/timers/leap-a-day.c index 97c8c66..71b4973 100644 --- a/tools/testing/selftests/timers/leap-a-day.c +++ b/tools/testing/selftests/timers/leap-a-day.c @@ -51,9 +51,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + #define CLOCK_TAI 11 =20 time_t next_leap; diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/self= tests/timers/mqueue-lat.c index c0d9368..ce8700c 100644 --- a/tools/testing/selftests/timers/mqueue-lat.c +++ b/tools/testing/selftests/timers/mqueue-lat.c @@ -29,9 +29,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + =20 #define TARGET_TIMEOUT 100000000 /* 100ms in nanoseconds */ #define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */ diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/selft= ests/timers/nanosleep.c index a054680..ceff181 100644 --- a/tools/testing/selftests/timers/nanosleep.c +++ b/tools/testing/selftests/timers/nanosleep.c @@ -27,9 +27,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + /* CLOCK_HWSPECIFIC =3D=3D CLOCK_SGI_CYCLE (Deprecated) */ #define CLOCK_HWSPECIFIC 10 =20 diff --git a/tools/testing/selftests/timers/nsleep-lat.c b/tools/testing/self= tests/timers/nsleep-lat.c index a7ba1eb..15f6493 100644 --- a/tools/testing/selftests/timers/nsleep-lat.c +++ b/tools/testing/selftests/timers/nsleep-lat.c @@ -24,9 +24,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + #define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */ =20 /* CLOCK_HWSPECIFIC =3D=3D CLOCK_SGI_CYCLE (Deprecated) */ diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/se= lftests/timers/posix_timers.c index 2f3bac9..fa168d8 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -16,12 +16,14 @@ #include #include #include -#include #include #include =20 #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL +#define USEC_PER_SEC 1000000LL + #define DELAY 2 =20 static void __fatal_error(const char *test, const char *name, const char *wh= at) diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selfte= sts/timers/raw_skew.c index a7bae7d..2dd16cb 100644 --- a/tools/testing/selftests/timers/raw_skew.c +++ b/tools/testing/selftests/timers/raw_skew.c @@ -25,9 +25,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + #define shift_right(x, s) ({ \ __typeof__(x) __x =3D (x); \ __typeof__(s) __s =3D (s); \ diff --git a/tools/testing/selftests/timers/set-2038.c b/tools/testing/selfte= sts/timers/set-2038.c index ecc171d..c123563 100644 --- a/tools/testing/selftests/timers/set-2038.c +++ b/tools/testing/selftests/timers/set-2038.c @@ -27,9 +27,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + #define KTIME_MAX ((long long)~((unsigned long long)1 << 63)) #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) =20 diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/s= elftests/timers/set-timer-lat.c index 44d2e36..e092c18 100644 --- a/tools/testing/selftests/timers/set-timer-lat.c +++ b/tools/testing/selftests/timers/set-timer-lat.c @@ -28,9 +28,10 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL + /* CLOCK_HWSPECIFIC =3D=3D CLOCK_SGI_CYCLE (Deprecated) */ #define CLOCK_HWSPECIFIC 10 =20 diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/= selftests/timers/valid-adjtimex.c index e1e56d3..dc2559e 100644 --- a/tools/testing/selftests/timers/valid-adjtimex.c +++ b/tools/testing/selftests/timers/valid-adjtimex.c @@ -29,9 +29,11 @@ #include #include #include -#include #include "kselftest.h" =20 +#define NSEC_PER_SEC 1000000000LL +#define USEC_PER_SEC 1000000LL + #define ADJ_SETOFFSET 0x0100 =20 #include