Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288796
b: refs/heads/master
c: cc06268
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and John Stultz committed Jan 27, 2012
1 parent 7c37990 commit 8cfb6fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 058892e632aa53be8255c2f0a42f9ace7bed66bb
refs/heads/master: cc06268c6a87db156af2daed6e96a936b955cc82
39 changes: 17 additions & 22 deletions trunk/kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,26 @@ static inline s64 timekeeping_get_ns_raw(void)
return clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
}

/* must hold write on timekeeper.lock */
static void timekeeping_update(bool clearntp)
{
if (clearntp) {
timekeeper.ntp_error = 0;
ntp_clear();
}
update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
}


void timekeeping_leap_insert(int leapsecond)
{
unsigned long flags;

write_seqlock_irqsave(&timekeeper.lock, flags);

timekeeper.xtime.tv_sec += leapsecond;
timekeeper.wall_to_monotonic.tv_sec -= leapsecond;
update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);

timekeeping_update(false);
write_sequnlock_irqrestore(&timekeeper.lock, flags);

}
Expand Down Expand Up @@ -386,12 +395,7 @@ int do_settimeofday(const struct timespec *tv)
timespec_sub(timekeeper.wall_to_monotonic, ts_delta);

timekeeper.xtime = *tv;

timekeeper.ntp_error = 0;
ntp_clear();

update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
timekeeping_update(true);

write_sequnlock_irqrestore(&timekeeper.lock, flags);

Expand Down Expand Up @@ -425,11 +429,7 @@ int timekeeping_inject_offset(struct timespec *ts)
timekeeper.wall_to_monotonic =
timespec_sub(timekeeper.wall_to_monotonic, *ts);

timekeeper.ntp_error = 0;
ntp_clear();

update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
timekeeping_update(true);

write_sequnlock_irqrestore(&timekeeper.lock, flags);

Expand Down Expand Up @@ -668,10 +668,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta)

__timekeeping_inject_sleeptime(delta);

timekeeper.ntp_error = 0;
ntp_clear();
update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
timekeeping_update(true);

write_sequnlock_irqrestore(&timekeeper.lock, flags);

Expand Down Expand Up @@ -1083,9 +1080,7 @@ static void update_wall_time(void)
second_overflow();
}

/* check to see if there is a new clocksource to use */
update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
timekeeping_update(false);

out:
write_sequnlock_irqrestore(&timekeeper.lock, flags);
Expand Down

0 comments on commit 8cfb6fe

Please sign in to comment.