mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@denx.de>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <jstultz@google.com>,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, rdunlap@infradead.org, paulmck@kernel.org
Subject: Re: [PATCH AUTOSEL 5.10 2/2] timekeeping: Always check for negative motion
Date: Mon, 2 Dec 2024 13:06:52 +0100	[thread overview]
Message-ID: <Z02i3MxY7JEJfgQ4@duo.ucw.cz> (raw)
In-Reply-To: <20241124124733.3338551-2-sashal@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2526 bytes --]

Hi!

> [ Upstream commit c163e40af9b2331b2c629fd4ec8b703ed4d4ae39 ]
> 
> clocksource_delta() has two variants. One with a check for negative motion,
> which is only selected by x86. This is a historic leftover as this function
> was previously used in the time getter hot paths.
> 
> Since 135225a363ae timekeeping_cycles_to_ns() has unconditional protection
> against this as a by-product of the protection against 64bit math
> overflow.
> timekeeping_advance(). The extra conditional there is not hurting anyone.

We don't have 135225a363ae in 5.10. So we probably should not have
this?

Best regards,
								Pavel

> +++ b/arch/x86/Kconfig
> @@ -107,7 +107,6 @@ config X86
>  	select ARCH_WANTS_THP_SWAP		if X86_64
>  	select BUILDTIME_TABLE_SORT
>  	select CLKEVT_I8253
> -	select CLOCKSOURCE_VALIDATE_LAST_CYCLE
>  	select CLOCKSOURCE_WATCHDOG
>  	select DCACHE_WORD_ACCESS
>  	select EDAC_ATOMIC_SCRUB
> diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
> index a09b1d61df6a5..5cbedc0a06efc 100644
> --- a/kernel/time/Kconfig
> +++ b/kernel/time/Kconfig
> @@ -17,11 +17,6 @@ config ARCH_CLOCKSOURCE_DATA
>  config ARCH_CLOCKSOURCE_INIT
>  	bool
>  
> -# Clocksources require validation of the clocksource against the last
> -# cycle update - x86/TSC misfeature
> -config CLOCKSOURCE_VALIDATE_LAST_CYCLE
> -	bool
> -
>  # Timekeeping vsyscall support
>  config GENERIC_TIME_VSYSCALL
>  	bool
> diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h
> index 4ca2787d1642e..1d4854d5c386e 100644
> --- a/kernel/time/timekeeping_internal.h
> +++ b/kernel/time/timekeeping_internal.h
> @@ -15,7 +15,6 @@ extern void tk_debug_account_sleep_time(const struct timespec64 *t);
>  #define tk_debug_account_sleep_time(x)
>  #endif
>  
> -#ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE
>  static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
>  {
>  	u64 ret = (now - last) & mask;
> @@ -26,12 +25,6 @@ static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
>  	 */
>  	return ret & ~(mask >> 1) ? 0 : ret;
>  }
> -#else
> -static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
> -{
> -	return (now - last) & mask;
> -}
> -#endif
>  
>  /* Semi public for serialization of non timekeeper VDSO updates. */
>  extern raw_spinlock_t timekeeper_lock;

-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

      reply	other threads:[~2024-12-02 12:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24 12:47 [PATCH AUTOSEL 5.10 1/2] uprobes: sanitiize xol_free_insn_slot() Sasha Levin
2024-11-24 12:47 ` [PATCH AUTOSEL 5.10 2/2] timekeeping: Always check for negative motion Sasha Levin
2024-12-02 12:06   ` Pavel Machek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z02i3MxY7JEJfgQ4@duo.ucw.cz \
    --to=pavel@denx.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®