From nobody Mon Feb 9 18:45:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4FCD3376BD9 for ; Mon, 9 Feb 2026 13:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770642404; cv=none; b=pPvK8d2lbnrTzDgz//X/CBYbT7QiCzw6QauplBbInX+DLOln8iBomVmx1YB8rolXAa+SsHNhIoBniOCYy53Qu4toAt512EGNQPjdOJPgRoWTVHYfF0OB8V5+a2SZEuoY9DdMiTbpKw8/xFSg802vfPn7dTKDmKoZ91CAsyOLBLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770642404; c=relaxed/simple; bh=iLkqyfAS+Xo/7h5mkTEjqSJiVVRj+yfXyHQF4dWH3vc=; h=Date:From:To:Cc:Subject:References:Message-ID:Content-Type: MIME-Version; b=MCXXqs5YNz/oVjlSQcsSz2KZllN4o5rUhDhQ7NYp02JOCz2dsQAk9C/LdEjeBLQATId/YeH1fcUd7nEcB35J1XvVObW8wt2Ha44A9ar7c6m/v0XoZglMtCH/pYHwze0dd2rn+UIyRB2HyXWQot1bS2rIYkb7Nn2ImQMg4hOl3D8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=atfCnQH+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="atfCnQH+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71AB0C16AAE; Mon, 9 Feb 2026 13:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770642403; bh=iLkqyfAS+Xo/7h5mkTEjqSJiVVRj+yfXyHQF4dWH3vc=; h=Date:From:To:Cc:Subject:References:From; b=atfCnQH+WbC72O4xM7ghAyFvLIkADkfq5eFD4XIc2lHwcIbvMifs8fV4Jh1BTiiDf i1BOvF0ApsyEO2z9nTMH3KQiv5z130FgtSoQz4k5aLX9GADQlKRIduIzo8ow718dII ALIZxb/AXgZ4Rp8x1At6M+20leEMoxjc1juEXkUZ+7E23YstdY1FKeCGKzqJhEvZUT /9ulgjMm9Jy67ibkw/H2v5qZc+SUqi3nv7MQjxon1+23lVoi2elPDfifiicSYTSgMK 6bGir0F75TxKtidxIll56nB4/6Z1QhZSPzsPKl2+kO/QMGLOCyn4k6KbZ7sZWusq5d jH+k/fWqNFiZg== Date: Mon, 09 Feb 2026 14:06:41 +0100 From: Thomas Gleixner To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, x86@kernel.org Subject: [GIT pull] timers/core for v7.0-rc1 References: <177064216682.108186.17056273147252170162.tglx@xen13> Message-ID: <177064217436.108186.4950312230809478309.tglx@xen13> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Linus, please pull the latest timers/core branch from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-core-20= 26-02-09 up to: 24989330fb99: time/kunit: Document handling of negative years of is= _leap() Updates for the core time subsystem: - Inline timecounter_cyc2time() as that is now used in the networking hotpath. Inlining it significantly improves performance. - Optimize the tick dependency check in case that the tracepoint is disab= led, which improves the hotpath performance in the tick management code, whi= ch is a hotpath on transitions in and out of idle. - The usual cleanups and improvements Thanks, tglx ------------------> Eric Dumazet (1): time/timecounter: Inline timecounter_cyc2time() Ionut Nechita (Sunlight Linux) (1): tick/nohz: Optimize check_tick_dependency() with early return Mark Brown (1): time/kunit: Document handling of negative years of is_leap() Thomas Gleixner (1): time/sched_clock: Use ACCESS_PRIVATE() to evaluate hrtimer::function Thomas Wei=C3=9Fschuh (3): hrtimer: Remove unused resolution constants hrtimer: Remove public definition of HIGH_RES_NSEC hrtimer: Drop _tv64() helpers include/linux/hrtimer.h | 15 --------------- include/linux/hrtimer_defs.h | 20 -------------------- include/linux/timecounter.h | 31 +++++++++++++++++++++++++++++-- kernel/time/hrtimer.c | 14 +++++++++++--- kernel/time/sched_clock.c | 2 +- kernel/time/tick-sched.c | 3 +++ kernel/time/time_test.c | 4 +++- kernel/time/timecounter.c | 35 ----------------------------------- 8 files changed, 47 insertions(+), 77 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 2cf1bf65b225..eb2d3d9dd064 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -112,12 +112,6 @@ static inline void hrtimer_set_expires_range_ns(struct= hrtimer *timer, ktime_t t timer->node.expires =3D ktime_add_safe(time, ns_to_ktime(delta)); } =20 -static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv6= 4) -{ - timer->node.expires =3D tv64; - timer->_softexpires =3D tv64; -} - static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) { timer->node.expires =3D ktime_add_safe(timer->node.expires, time); @@ -140,15 +134,6 @@ static inline ktime_t hrtimer_get_softexpires(const st= ruct hrtimer *timer) return timer->_softexpires; } =20 -static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) -{ - return timer->node.expires; -} -static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer) -{ - return timer->_softexpires; -} - static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) { return ktime_to_ns(timer->node.expires); diff --git a/include/linux/hrtimer_defs.h b/include/linux/hrtimer_defs.h index aa49ffa130e5..02b010df6570 100644 --- a/include/linux/hrtimer_defs.h +++ b/include/linux/hrtimer_defs.h @@ -6,26 +6,6 @@ #include #include =20 -#ifdef CONFIG_HIGH_RES_TIMERS - -/* - * The resolution of the clocks. The resolution value is returned in - * the clock_getres() system call to give application programmers an - * idea of the (in)accuracy of timers. Timer values are rounded up to - * this resolution values. - */ -# define HIGH_RES_NSEC 1 -# define KTIME_HIGH_RES (HIGH_RES_NSEC) -# define MONOTONIC_RES_NSEC HIGH_RES_NSEC -# define KTIME_MONOTONIC_RES KTIME_HIGH_RES - -#else - -# define MONOTONIC_RES_NSEC LOW_RES_NSEC -# define KTIME_MONOTONIC_RES KTIME_LOW_RES - -#endif - #ifdef CONFIG_64BIT # define __hrtimer_clock_base_align ____cacheline_aligned #else diff --git a/include/linux/timecounter.h b/include/linux/timecounter.h index dce03a5cafb7..7de6b350e559 100644 --- a/include/linux/timecounter.h +++ b/include/linux/timecounter.h @@ -115,6 +115,15 @@ extern void timecounter_init(struct timecounter *tc, */ extern u64 timecounter_read(struct timecounter *tc); =20 +/* + * This is like cyclecounter_cyc2ns(), but it is used for computing a + * time previous to the time stored in the cycle counter. + */ +static inline u64 cc_cyc2ns_backwards(const struct cyclecounter *cc, u64 c= ycles, u64 frac) +{ + return ((cycles * cc->mult) - frac) >> cc->shift; +} + /** * timecounter_cyc2time - convert a cycle counter to same * time base as values returned by @@ -131,7 +140,25 @@ extern u64 timecounter_read(struct timecounter *tc); * * Returns: cycle counter converted to nanoseconds since the initial time = stamp */ -extern u64 timecounter_cyc2time(const struct timecounter *tc, - u64 cycle_tstamp); +static inline u64 timecounter_cyc2time(const struct timecounter *tc, u64 c= ycle_tstamp) +{ + const struct cyclecounter *cc =3D tc->cc; + u64 delta =3D (cycle_tstamp - tc->cycle_last) & cc->mask; + u64 nsec =3D tc->nsec, frac =3D tc->frac; + + /* + * Instead of always treating cycle_tstamp as more recent than + * tc->cycle_last, detect when it is too far in the future and + * treat it as old time stamp instead. + */ + if (unlikely(delta > cc->mask / 2)) { + delta =3D (tc->cycle_last - cycle_tstamp) & cc->mask; + nsec -=3D cc_cyc2ns_backwards(cc, delta, frac); + } else { + nsec +=3D cyclecounter_cyc2ns(cc, delta, tc->mask, &frac); + } + + return nsec; +} =20 #endif diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index f8ea8c8fc895..d0ab2e9e3f30 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -49,6 +49,14 @@ =20 #include "tick-internal.h" =20 +/* + * The resolution of the clocks. The resolution value is returned in + * the clock_getres() system call to give application programmers an + * idea of the (in)accuracy of timers. Timer values are rounded up to + * this resolution values. + */ +#define HIGH_RES_NSEC 1 + /* * Masks for selecting the soft and hard context timers from * cpu_base->active @@ -806,7 +814,7 @@ static void hrtimer_reprogram(struct hrtimer *timer, bo= ol reprogram) struct hrtimer_clock_base *base =3D timer->base; ktime_t expires =3D ktime_sub(hrtimer_get_expires(timer), base->offset); =20 - WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0); + WARN_ON_ONCE(hrtimer_get_expires(timer) < 0); =20 /* * CLOCK_REALTIME timer might be requested with an absolute @@ -1053,7 +1061,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t no= w, ktime_t interval) =20 orun =3D ktime_divns(delta, incr); hrtimer_add_expires_ns(timer, incr * orun); - if (hrtimer_get_expires_tv64(timer) > now) + if (hrtimer_get_expires(timer) > now) return orun; /* * This (and the ktime_add() below) is the @@ -1835,7 +1843,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_b= ase *cpu_base, ktime_t now, * are right-of a not yet expired timer, because that * timer will have to trigger a wakeup anyway. */ - if (basenow < hrtimer_get_softexpires_tv64(timer)) + if (basenow < hrtimer_get_softexpires(timer)) break; =20 __run_hrtimer(cpu_base, base, timer, &basenow, flags); diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index f39111830ca3..f3aaef695b8c 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -215,7 +215,7 @@ void sched_clock_register(u64 (*read)(void), int bits, = unsigned long rate) =20 update_clock_read_data(&rd); =20 - if (sched_clock_timer.function !=3D NULL) { + if (ACCESS_PRIVATE(&sched_clock_timer, function) !=3D NULL) { /* update timeout for clock wrap */ hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL_HARD); diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 8ddf74e705d3..fd928d374cfc 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -344,6 +344,9 @@ static bool check_tick_dependency(atomic_t *dep) { int val =3D atomic_read(dep); =20 + if (likely(!tracepoint_enabled(tick_stop))) + return !val; + if (val & TICK_DEP_MASK_POSIX_TIMER) { trace_tick_stop(0, TICK_DEP_MASK_POSIX_TIMER); return true; diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c index 2889763165e5..1b99180da288 100644 --- a/kernel/time/time_test.c +++ b/kernel/time/time_test.c @@ -4,7 +4,9 @@ #include =20 /* - * Traditional implementation of leap year evaluation. + * Traditional implementation of leap year evaluation, but note that long + * is a signed type and the tests do cover negative year values. So this + * can't use the is_leap_year() helper from rtc.h. */ static bool is_leap(long year) { diff --git a/kernel/time/timecounter.c b/kernel/time/timecounter.c index 3d2a354cfe1c..2e64dbb6302d 100644 --- a/kernel/time/timecounter.c +++ b/kernel/time/timecounter.c @@ -62,38 +62,3 @@ u64 timecounter_read(struct timecounter *tc) } EXPORT_SYMBOL_GPL(timecounter_read); =20 -/* - * This is like cyclecounter_cyc2ns(), but it is used for computing a - * time previous to the time stored in the cycle counter. - */ -static u64 cc_cyc2ns_backwards(const struct cyclecounter *cc, - u64 cycles, u64 mask, u64 frac) -{ - u64 ns =3D (u64) cycles; - - ns =3D ((ns * cc->mult) - frac) >> cc->shift; - - return ns; -} - -u64 timecounter_cyc2time(const struct timecounter *tc, - u64 cycle_tstamp) -{ - u64 delta =3D (cycle_tstamp - tc->cycle_last) & tc->cc->mask; - u64 nsec =3D tc->nsec, frac =3D tc->frac; - - /* - * Instead of always treating cycle_tstamp as more recent - * than tc->cycle_last, detect when it is too far in the - * future and treat it as old time stamp instead. - */ - if (delta > tc->cc->mask / 2) { - delta =3D (tc->cycle_last - cycle_tstamp) & tc->cc->mask; - nsec -=3D cc_cyc2ns_backwards(tc->cc, delta, tc->mask, frac); - } else { - nsec +=3D cyclecounter_cyc2ns(tc->cc, delta, tc->mask, &frac); - } - - return nsec; -} -EXPORT_SYMBOL_GPL(timecounter_cyc2time);