diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-03-19 04:39:08 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-27 04:45:09 -0400 |
commit | f09cb9a1808e35ad7502ea39b6bfb443c7fa0f19 (patch) | |
tree | 1a172f02117de052a2de202b8db41e32e76b1d15 /kernel/time | |
parent | 4498e7467e9e441c18ca12f1ca08460356e0508a (diff) |
time: Introduce tk_fast_raw
Add the NMI safe CLOCK_MONOTONIC_RAW accessor..
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150319093400.562746929@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/timekeeping.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 278373edb472..c3fcff06d30a 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -59,6 +59,7 @@ struct tk_fast { | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | static struct tk_fast tk_fast_mono ____cacheline_aligned; | 61 | static struct tk_fast tk_fast_mono ____cacheline_aligned; |
62 | static struct tk_fast tk_fast_raw ____cacheline_aligned; | ||
62 | 63 | ||
63 | /* flag for if timekeeping is suspended */ | 64 | /* flag for if timekeeping is suspended */ |
64 | int __read_mostly timekeeping_suspended; | 65 | int __read_mostly timekeeping_suspended; |
@@ -434,6 +435,12 @@ u64 ktime_get_mono_fast_ns(void) | |||
434 | } | 435 | } |
435 | EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); | 436 | EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); |
436 | 437 | ||
438 | u64 ktime_get_raw_fast_ns(void) | ||
439 | { | ||
440 | return __ktime_get_fast_ns(&tk_fast_raw); | ||
441 | } | ||
442 | EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns); | ||
443 | |||
437 | /* Suspend-time cycles value for halted fast timekeeper. */ | 444 | /* Suspend-time cycles value for halted fast timekeeper. */ |
438 | static cycle_t cycles_at_suspend; | 445 | static cycle_t cycles_at_suspend; |
439 | 446 | ||
@@ -461,6 +468,11 @@ static void halt_fast_timekeeper(struct timekeeper *tk) | |||
461 | cycles_at_suspend = tkr->read(tkr->clock); | 468 | cycles_at_suspend = tkr->read(tkr->clock); |
462 | tkr_dummy.read = dummy_clock_read; | 469 | tkr_dummy.read = dummy_clock_read; |
463 | update_fast_timekeeper(&tkr_dummy, &tk_fast_mono); | 470 | update_fast_timekeeper(&tkr_dummy, &tk_fast_mono); |
471 | |||
472 | tkr = &tk->tkr_raw; | ||
473 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); | ||
474 | tkr_dummy.read = dummy_clock_read; | ||
475 | update_fast_timekeeper(&tkr_dummy, &tk_fast_raw); | ||
464 | } | 476 | } |
465 | 477 | ||
466 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD | 478 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD |
@@ -592,6 +604,7 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) | |||
592 | sizeof(tk_core.timekeeper)); | 604 | sizeof(tk_core.timekeeper)); |
593 | 605 | ||
594 | update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono); | 606 | update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono); |
607 | update_fast_timekeeper(&tk->tkr_raw, &tk_fast_raw); | ||
595 | } | 608 | } |
596 | 609 | ||
597 | /** | 610 | /** |