public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()
@ 2024-08-03 15:05 Thomas Gleixner
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2024-08-03 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Cc

The addition of the bases argument to clock_was_set() fixed up all call
sites correctly except for do_adjtimex(). This uses CLOCK_REALTIME
instead of CLOCK_SET_WALL as argument. CLOCK_REALTIME is 0.

As a result the effect of that clock_was_set() notification is incomplete
and might result in timers expiring late because the hrtimer code does
not re-evaluate the affected clock bases.

Use CLOCK_SET_WALL instead of CLOCK_REALTIME to tell the hrtimers code
which clock bases need to be re-evaluated.

Fixes: 17a1b8826b45 ("hrtimer: Add bases argument to clock_was_set()")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <jstultz@google.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: stable@vger.kernel.org
---
 kernel/time/timekeeping.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2606,7 +2606,7 @@ int do_adjtimex(struct __kernel_timex *t
 		clock_set |= timekeeping_advance(TK_ADV_FREQ);
 
 	if (clock_set)
-		clock_was_set(CLOCK_REALTIME);
+		clock_was_set(CLOCK_SET_WALL);
 
 	ntp_notify_cmos_timer();
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()
@ 2024-08-03 15:06 Thomas Gleixner
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2024-08-03 15:06 UTC (permalink / raw)
  To: LKML; +Cc: Cc

The addition of the bases argument to clock_was_set() fixed up all call
sites correctly except for do_adjtimex(). This uses CLOCK_REALTIME
instead of CLOCK_SET_WALL as argument. CLOCK_REALTIME is 0.

As a result the effect of that clock_was_set() notification is incomplete
and might result in timers expiring late because the hrtimer code does
not re-evaluate the affected clock bases.

Use CLOCK_SET_WALL instead of CLOCK_REALTIME to tell the hrtimers code
which clock bases need to be re-evaluated.

Fixes: 17a1b8826b45 ("hrtimer: Add bases argument to clock_was_set()")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <jstultz@google.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: stable@vger.kernel.org
---
 kernel/time/timekeeping.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2606,7 +2606,7 @@ int do_adjtimex(struct __kernel_timex *t
 		clock_set |= timekeeping_advance(TK_ADV_FREQ);
 
 	if (clock_set)
-		clock_was_set(CLOCK_REALTIME);
+		clock_was_set(CLOCK_SET_WALL);
 
 	ntp_notify_cmos_timer();
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()
@ 2024-08-03 15:07 Thomas Gleixner
  2024-08-05 17:50 ` John Stultz
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2024-08-03 15:07 UTC (permalink / raw)
  To: LKML; +Cc: John Stultz, Stephen Boyd, Anna-Maria Behnsen,
	Frederic Weisbecker

The addition of the bases argument to clock_was_set() fixed up all call
sites correctly except for do_adjtimex(). This uses CLOCK_REALTIME
instead of CLOCK_SET_WALL as argument. CLOCK_REALTIME is 0.

As a result the effect of that clock_was_set() notification is incomplete
and might result in timers expiring late because the hrtimer code does
not re-evaluate the affected clock bases.

Use CLOCK_SET_WALL instead of CLOCK_REALTIME to tell the hrtimers code
which clock bases need to be re-evaluated.

Fixes: 17a1b8826b45 ("hrtimer: Add bases argument to clock_was_set()")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <jstultz@google.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: stable@vger.kernel.org
---
 kernel/time/timekeeping.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2606,7 +2606,7 @@ int do_adjtimex(struct __kernel_timex *t
 		clock_set |= timekeeping_advance(TK_ADV_FREQ);
 
 	if (clock_set)
-		clock_was_set(CLOCK_REALTIME);
+		clock_was_set(CLOCK_SET_WALL);
 
 	ntp_notify_cmos_timer();
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()
  2024-08-03 15:07 Thomas Gleixner
@ 2024-08-05 17:50 ` John Stultz
  2024-08-05 18:30   ` Thomas Gleixner
  0 siblings, 1 reply; 5+ messages in thread
From: John Stultz @ 2024-08-05 17:50 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Stephen Boyd, Anna-Maria Behnsen, Frederic Weisbecker

On Sat, Aug 3, 2024 at 8:07 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> The addition of the bases argument to clock_was_set() fixed up all call
> sites correctly except for do_adjtimex(). This uses CLOCK_REALTIME
> instead of CLOCK_SET_WALL as argument. CLOCK_REALTIME is 0.
>
> As a result the effect of that clock_was_set() notification is incomplete
> and might result in timers expiring late because the hrtimer code does
> not re-evaluate the affected clock bases.
>
> Use CLOCK_SET_WALL instead of CLOCK_REALTIME to tell the hrtimers code
> which clock bases need to be re-evaluated.

Acked-by: John Stultz <jstultz@google.com>

My only thought here is maybe renaming CLOCK_SET_WALL and
CLOCK_SET_BOOT to something like:
  BASEMASK_WALL_CLOCK_SET and BASEMASK_BOOT_CLOCK_SET

Just to avoid future naming mixups or confusion with clockids?

thanks
-john

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()
  2024-08-05 17:50 ` John Stultz
@ 2024-08-05 18:30   ` Thomas Gleixner
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2024-08-05 18:30 UTC (permalink / raw)
  To: John Stultz; +Cc: LKML, Stephen Boyd, Anna-Maria Behnsen, Frederic Weisbecker

On Mon, Aug 05 2024 at 10:50, John Stultz wrote:
> On Sat, Aug 3, 2024 at 8:07 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>>
>> The addition of the bases argument to clock_was_set() fixed up all call
>> sites correctly except for do_adjtimex(). This uses CLOCK_REALTIME
>> instead of CLOCK_SET_WALL as argument. CLOCK_REALTIME is 0.
>>
>> As a result the effect of that clock_was_set() notification is incomplete
>> and might result in timers expiring late because the hrtimer code does
>> not re-evaluate the affected clock bases.
>>
>> Use CLOCK_SET_WALL instead of CLOCK_REALTIME to tell the hrtimers code
>> which clock bases need to be re-evaluated.
>
> Acked-by: John Stultz <jstultz@google.com>
>
> My only thought here is maybe renaming CLOCK_SET_WALL and
> CLOCK_SET_BOOT to something like:
>   BASEMASK_WALL_CLOCK_SET and BASEMASK_BOOT_CLOCK_SET
>
> Just to avoid future naming mixups or confusion with clockids?

Makes sense. Care to whip up a patch?

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-05 18:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-03 15:05 [PATCH] timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex() Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2024-08-03 15:06 Thomas Gleixner
2024-08-03 15:07 Thomas Gleixner
2024-08-05 17:50 ` John Stultz
2024-08-05 18:30   ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox