Commit c7d6b5a2 authored by Thomas Gleixner's avatar Thomas Gleixner

Merge branch 'fortglx/4.8/time' of https://git.linaro.org/people/john.stultz/linux into timers/core

Pull time(keeping) updates from John Stultz:

 - Handle the 1ns issue with the old refusing to die vsyscall machinery
 - More y2038 updates
 - Documentation fixes
 - Simplify clocksource handling
parents 86721ab6 7c71feb0
...@@ -26,10 +26,10 @@ enum alarmtimer_restart { ...@@ -26,10 +26,10 @@ enum alarmtimer_restart {
* struct alarm - Alarm timer structure * struct alarm - Alarm timer structure
* @node: timerqueue node for adding to the event list this value * @node: timerqueue node for adding to the event list this value
* also includes the expiration time. * also includes the expiration time.
* @period: Period for recuring alarms * @timer: hrtimer used to schedule events while running
* @function: Function pointer to be executed when the timer fires. * @function: Function pointer to be executed when the timer fires.
* @type: Alarm type (BOOTTIME/REALTIME) * @type: Alarm type (BOOTTIME/REALTIME).
* @enabled: Flag that represents if the alarm is set to fire or not * @state: Flag that represents if the alarm is set to fire or not.
* @data: Internal data value. * @data: Internal data value.
*/ */
struct alarm { struct alarm {
......
...@@ -205,7 +205,20 @@ struct tm { ...@@ -205,7 +205,20 @@ struct tm {
int tm_yday; int tm_yday;
}; };
void time_to_tm(time_t totalsecs, int offset, struct tm *result); void time64_to_tm(time64_t totalsecs, int offset, struct tm *result);
/**
* time_to_tm - converts the calendar time to local broken-down time
*
* @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
* Coordinated Universal Time (UTC).
* @offset offset seconds adding to totalsecs.
* @result pointer to struct tm variable to receive broken-down time
*/
static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
{
time64_to_tm(totalsecs, offset, result);
}
/** /**
* timespec_to_ns - Convert timespec to nanoseconds * timespec_to_ns - Convert timespec to nanoseconds
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* struct alarm_base - Alarm timer bases * struct alarm_base - Alarm timer bases
* @lock: Lock for syncrhonized access to the base * @lock: Lock for syncrhonized access to the base
* @timerqueue: Timerqueue head managing the list of events * @timerqueue: Timerqueue head managing the list of events
* @timer: hrtimer used to schedule events while running
* @gettime: Function to read the time correlating to the base * @gettime: Function to read the time correlating to the base
* @base_clockid: clockid for the base * @base_clockid: clockid for the base
*/ */
......
...@@ -669,10 +669,12 @@ static void clocksource_enqueue(struct clocksource *cs) ...@@ -669,10 +669,12 @@ static void clocksource_enqueue(struct clocksource *cs)
struct list_head *entry = &clocksource_list; struct list_head *entry = &clocksource_list;
struct clocksource *tmp; struct clocksource *tmp;
list_for_each_entry(tmp, &clocksource_list, list) list_for_each_entry(tmp, &clocksource_list, list) {
/* Keep track of the place, where to insert */ /* Keep track of the place, where to insert */
if (tmp->rating >= cs->rating) if (tmp->rating < cs->rating)
break;
entry = &tmp->list; entry = &tmp->list;
}
list_add(&cs->list, entry); list_add(&cs->list, entry);
} }
......
...@@ -43,13 +43,13 @@ static int udelay_test_single(struct seq_file *s, int usecs, uint32_t iters) ...@@ -43,13 +43,13 @@ static int udelay_test_single(struct seq_file *s, int usecs, uint32_t iters)
int allowed_error_ns = usecs * 5; int allowed_error_ns = usecs * 5;
for (i = 0; i < iters; ++i) { for (i = 0; i < iters; ++i) {
struct timespec ts1, ts2; s64 kt1, kt2;
int time_passed; int time_passed;
ktime_get_ts(&ts1); kt1 = ktime_get_ns();
udelay(usecs); udelay(usecs);
ktime_get_ts(&ts2); kt2 = ktime_get_ns();
time_passed = timespec_to_ns(&ts2) - timespec_to_ns(&ts1); time_passed = kt2 - kt1;
if (i == 0 || time_passed < min) if (i == 0 || time_passed < min)
min = time_passed; min = time_passed;
...@@ -87,11 +87,11 @@ static int udelay_test_show(struct seq_file *s, void *v) ...@@ -87,11 +87,11 @@ static int udelay_test_show(struct seq_file *s, void *v)
if (usecs > 0 && iters > 0) { if (usecs > 0 && iters > 0) {
return udelay_test_single(s, usecs, iters); return udelay_test_single(s, usecs, iters);
} else if (usecs == 0) { } else if (usecs == 0) {
struct timespec ts; struct timespec64 ts;
ktime_get_ts(&ts); ktime_get_ts64(&ts);
seq_printf(s, "udelay() test (lpj=%ld kt=%ld.%09ld)\n", seq_printf(s, "udelay() test (lpj=%ld kt=%lld.%09ld)\n",
loops_per_jiffy, ts.tv_sec, ts.tv_nsec); loops_per_jiffy, (s64)ts.tv_sec, ts.tv_nsec);
seq_puts(s, "usage:\n"); seq_puts(s, "usage:\n");
seq_puts(s, "echo USECS [ITERS] > " DEBUGFS_FILENAME "\n"); seq_puts(s, "echo USECS [ITERS] > " DEBUGFS_FILENAME "\n");
seq_puts(s, "cat " DEBUGFS_FILENAME "\n"); seq_puts(s, "cat " DEBUGFS_FILENAME "\n");
......
...@@ -67,20 +67,21 @@ static const unsigned short __mon_yday[2][13] = { ...@@ -67,20 +67,21 @@ static const unsigned short __mon_yday[2][13] = {
#define SECS_PER_DAY (SECS_PER_HOUR * 24) #define SECS_PER_DAY (SECS_PER_HOUR * 24)
/** /**
* time_to_tm - converts the calendar time to local broken-down time * time64_to_tm - converts the calendar time to local broken-down time
* *
* @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970, * @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
* Coordinated Universal Time (UTC). * Coordinated Universal Time (UTC).
* @offset offset seconds adding to totalsecs. * @offset offset seconds adding to totalsecs.
* @result pointer to struct tm variable to receive broken-down time * @result pointer to struct tm variable to receive broken-down time
*/ */
void time_to_tm(time_t totalsecs, int offset, struct tm *result) void time64_to_tm(time64_t totalsecs, int offset, struct tm *result)
{ {
long days, rem, y; long days, rem, y;
int remainder;
const unsigned short *ip; const unsigned short *ip;
days = totalsecs / SECS_PER_DAY; days = div_s64_rem(totalsecs, SECS_PER_DAY, &remainder);
rem = totalsecs % SECS_PER_DAY; rem = remainder;
rem += offset; rem += offset;
while (rem < 0) { while (rem < 0) {
rem += SECS_PER_DAY; rem += SECS_PER_DAY;
...@@ -124,4 +125,4 @@ void time_to_tm(time_t totalsecs, int offset, struct tm *result) ...@@ -124,4 +125,4 @@ void time_to_tm(time_t totalsecs, int offset, struct tm *result)
result->tm_mon = y; result->tm_mon = y;
result->tm_mday = days + 1; result->tm_mday = days + 1;
} }
EXPORT_SYMBOL(time_to_tm); EXPORT_SYMBOL(time64_to_tm);
...@@ -480,10 +480,12 @@ static inline void old_vsyscall_fixup(struct timekeeper *tk) ...@@ -480,10 +480,12 @@ static inline void old_vsyscall_fixup(struct timekeeper *tk)
* users are removed, this can be killed. * users are removed, this can be killed.
*/ */
remainder = tk->tkr_mono.xtime_nsec & ((1ULL << tk->tkr_mono.shift) - 1); remainder = tk->tkr_mono.xtime_nsec & ((1ULL << tk->tkr_mono.shift) - 1);
if (remainder != 0) {
tk->tkr_mono.xtime_nsec -= remainder; tk->tkr_mono.xtime_nsec -= remainder;
tk->tkr_mono.xtime_nsec += 1ULL << tk->tkr_mono.shift; tk->tkr_mono.xtime_nsec += 1ULL << tk->tkr_mono.shift;
tk->ntp_error += remainder << tk->ntp_error_shift; tk->ntp_error += remainder << tk->ntp_error_shift;
tk->ntp_error -= (1ULL << tk->tkr_mono.shift) << tk->ntp_error_shift; tk->ntp_error -= (1ULL << tk->tkr_mono.shift) << tk->ntp_error_shift;
}
} }
#else #else
#define old_vsyscall_fixup(tk) #define old_vsyscall_fixup(tk)
......
...@@ -279,7 +279,7 @@ static void print_name_offset(struct seq_file *m, unsigned long addr) ...@@ -279,7 +279,7 @@ static void print_name_offset(struct seq_file *m, unsigned long addr)
static int tstats_show(struct seq_file *m, void *v) static int tstats_show(struct seq_file *m, void *v)
{ {
struct timespec period; struct timespec64 period;
struct entry *entry; struct entry *entry;
unsigned long ms; unsigned long ms;
long events = 0; long events = 0;
...@@ -295,11 +295,11 @@ static int tstats_show(struct seq_file *m, void *v) ...@@ -295,11 +295,11 @@ static int tstats_show(struct seq_file *m, void *v)
time = ktime_sub(time_stop, time_start); time = ktime_sub(time_stop, time_start);
period = ktime_to_timespec(time); period = ktime_to_timespec64(time);
ms = period.tv_nsec / 1000000; ms = period.tv_nsec / 1000000;
seq_puts(m, "Timer Stats Version: v0.3\n"); seq_puts(m, "Timer Stats Version: v0.3\n");
seq_printf(m, "Sample period: %ld.%03ld s\n", period.tv_sec, ms); seq_printf(m, "Sample period: %ld.%03ld s\n", (long)period.tv_sec, ms);
if (atomic_read(&overflow_count)) if (atomic_read(&overflow_count))
seq_printf(m, "Overflow: %d entries\n", atomic_read(&overflow_count)); seq_printf(m, "Overflow: %d entries\n", atomic_read(&overflow_count));
seq_printf(m, "Collection: %s\n", timer_stats_active ? "active" : "inactive"); seq_printf(m, "Collection: %s\n", timer_stats_active ? "active" : "inactive");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment