Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234624
b: refs/heads/master
c: 70a08cc
h: refs/heads/master
v: v3
  • Loading branch information
John Stultz committed Feb 21, 2011
1 parent 647b60f commit 07f8d4f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 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: 314ac37150011ebb398f522db528d2dbcc611189
refs/heads/master: 70a08cca1227dc31c784ec930099a4417a06e7d0
1 change: 1 addition & 0 deletions trunk/include/linux/hrtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ struct hrtimer_clock_base {
enum hrtimer_base_type {
HRTIMER_BASE_REALTIME,
HRTIMER_BASE_MONOTONIC,
HRTIMER_BASE_BOOTTIME,
HRTIMER_MAX_CLOCK_BASES,
};

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ struct itimerval {
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
#define CLOCK_BOOTTIME 7

/*
* The IDs of various hardware clocks:
Expand Down
16 changes: 12 additions & 4 deletions trunk/kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
.get_time = &ktime_get,
.resolution = KTIME_LOW_RES,
},
{
.index = CLOCK_BOOTTIME,
.get_time = &ktime_get_boottime,
.resolution = KTIME_LOW_RES,
},
}
};

Expand All @@ -90,16 +95,17 @@ static inline int hrtimer_clockid_to_base(clockid_t clock_id)
*/
static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
{
ktime_t xtim, tomono;
ktime_t xtim, mono, boot;
struct timespec xts, tom, slp;

get_xtime_and_monotonic_and_sleep_offset(&xts, &tom, &slp);

xtim = timespec_to_ktime(xts);
tomono = timespec_to_ktime(tom);
mono = ktime_add(xtim, timespec_to_ktime(tom));
boot = ktime_add(mono, timespec_to_ktime(slp));
base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim;
base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time =
ktime_add(xtim, tomono);
base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono;
base->clock_base[HRTIMER_BASE_BOOTTIME].softirq_time = boot;
}

/*
Expand Down Expand Up @@ -727,6 +733,7 @@ static int hrtimer_switch_to_hres(void)
base->hres_active = 1;
base->clock_base[HRTIMER_BASE_REALTIME].resolution = KTIME_HIGH_RES;
base->clock_base[HRTIMER_BASE_MONOTONIC].resolution = KTIME_HIGH_RES;
base->clock_base[HRTIMER_BASE_BOOTTIME].resolution = KTIME_HIGH_RES;

tick_setup_sched_timer();

Expand Down Expand Up @@ -1719,6 +1726,7 @@ void __init hrtimers_init(void)
{
hrtimer_clock_to_base_table[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME;
hrtimer_clock_to_base_table[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC;
hrtimer_clock_to_base_table[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME;

hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE,
(void *)(long)smp_processor_id());
Expand Down

0 comments on commit 07f8d4f

Please sign in to comment.