Skip to content

Commit

Permalink
Merge tag 'timers_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/s…
Browse files Browse the repository at this point in the history
…cm/linux/kernel/git/tip/tip

Pull timer fixes from Borislav Petkov:

 - Fix an integer overflow in the NTP RTC synchronization which led to
   the latter happening every 2 seconds instead of the intended every 11
   minutes.

 - Get rid of now unused get_seconds().

* tag 'timers_urgent_for_v5.11_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  ntp: Fix RTC synchronization on 32-bit platforms
  timekeeping: Remove unused get_seconds()
  • Loading branch information
torvalds committed Jan 24, 2021
2 parents 17b6c49 + e3fab2f commit 025929f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
1 change: 0 additions & 1 deletion include/linux/ktime.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,5 @@ static inline ktime_t ms_to_ktime(u64 ms)
}

# include <linux/timekeeping.h>
# include <linux/timekeeping32.h>

#endif
14 changes: 0 additions & 14 deletions include/linux/timekeeping32.h

This file was deleted.

4 changes: 2 additions & 2 deletions kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ int second_overflow(time64_t secs)
static void sync_hw_clock(struct work_struct *work);
static DECLARE_WORK(sync_work, sync_hw_clock);
static struct hrtimer sync_hrtimer;
#define SYNC_PERIOD_NS (11UL * 60 * NSEC_PER_SEC)
#define SYNC_PERIOD_NS (11ULL * 60 * NSEC_PER_SEC)

static enum hrtimer_restart sync_timer_callback(struct hrtimer *timer)
{
Expand All @@ -512,7 +512,7 @@ static void sched_sync_hw_clock(unsigned long offset_nsec, bool retry)
ktime_t exp = ktime_set(ktime_get_real_seconds(), 0);

if (retry)
exp = ktime_add_ns(exp, 2 * NSEC_PER_SEC - offset_nsec);
exp = ktime_add_ns(exp, 2ULL * NSEC_PER_SEC - offset_nsec);
else
exp = ktime_add_ns(exp, SYNC_PERIOD_NS - offset_nsec);

Expand Down
3 changes: 1 addition & 2 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,7 @@ EXPORT_SYMBOL_GPL(ktime_get_seconds);
/**
* ktime_get_real_seconds - Get the seconds portion of CLOCK_REALTIME
*
* Returns the wall clock seconds since 1970. This replaces the
* get_seconds() interface which is not y2038 safe on 32bit systems.
* Returns the wall clock seconds since 1970.
*
* For 64bit systems the fast access to tk->xtime_sec is preserved. On
* 32bit systems the access must be protected with the sequence
Expand Down

0 comments on commit 025929f

Please sign in to comment.