diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-03-19 04:36:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-27 04:45:08 -0400 |
commit | 4498e7467e9e441c18ca12f1ca08460356e0508a (patch) | |
tree | 8f375eea5056d16193ca5f4c2aa81d88e697d089 /kernel/time | |
parent | 4a4ad80d32cea69ee93bd4589f24dc478804cd80 (diff) |
time: Parametrize all tk_fast_mono users
In preparation for more tk_fast instances, remove all hard-coded
tk_fast_mono references.
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.484279927@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/timekeeping.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index cbb612ee813f..278373edb472 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -364,18 +364,18 @@ static inline s64 timekeeping_get_ns(struct tk_read_base *tkr) | |||
364 | * slightly wrong timestamp (a few nanoseconds). See | 364 | * slightly wrong timestamp (a few nanoseconds). See |
365 | * @ktime_get_mono_fast_ns. | 365 | * @ktime_get_mono_fast_ns. |
366 | */ | 366 | */ |
367 | static void update_fast_timekeeper(struct tk_read_base *tkr) | 367 | static void update_fast_timekeeper(struct tk_read_base *tkr, struct tk_fast *tkf) |
368 | { | 368 | { |
369 | struct tk_read_base *base = tk_fast_mono.base; | 369 | struct tk_read_base *base = tkf->base; |
370 | 370 | ||
371 | /* Force readers off to base[1] */ | 371 | /* Force readers off to base[1] */ |
372 | raw_write_seqcount_latch(&tk_fast_mono.seq); | 372 | raw_write_seqcount_latch(&tkf->seq); |
373 | 373 | ||
374 | /* Update base[0] */ | 374 | /* Update base[0] */ |
375 | memcpy(base, tkr, sizeof(*base)); | 375 | memcpy(base, tkr, sizeof(*base)); |
376 | 376 | ||
377 | /* Force readers back to base[0] */ | 377 | /* Force readers back to base[0] */ |
378 | raw_write_seqcount_latch(&tk_fast_mono.seq); | 378 | raw_write_seqcount_latch(&tkf->seq); |
379 | 379 | ||
380 | /* Update base[1] */ | 380 | /* Update base[1] */ |
381 | memcpy(base + 1, base, sizeof(*base)); | 381 | memcpy(base + 1, base, sizeof(*base)); |
@@ -413,20 +413,25 @@ static void update_fast_timekeeper(struct tk_read_base *tkr) | |||
413 | * of the following timestamps. Callers need to be aware of that and | 413 | * of the following timestamps. Callers need to be aware of that and |
414 | * deal with it. | 414 | * deal with it. |
415 | */ | 415 | */ |
416 | u64 notrace ktime_get_mono_fast_ns(void) | 416 | static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf) |
417 | { | 417 | { |
418 | struct tk_read_base *tkr; | 418 | struct tk_read_base *tkr; |
419 | unsigned int seq; | 419 | unsigned int seq; |
420 | u64 now; | 420 | u64 now; |
421 | 421 | ||
422 | do { | 422 | do { |
423 | seq = raw_read_seqcount(&tk_fast_mono.seq); | 423 | seq = raw_read_seqcount(&tkf->seq); |
424 | tkr = tk_fast_mono.base + (seq & 0x01); | 424 | tkr = tkf->base + (seq & 0x01); |
425 | now = ktime_to_ns(tkr->base) + timekeeping_get_ns(tkr); | 425 | now = ktime_to_ns(tkr->base) + timekeeping_get_ns(tkr); |
426 | } while (read_seqcount_retry(&tkf->seq, seq)); | ||
426 | 427 | ||
427 | } while (read_seqcount_retry(&tk_fast_mono.seq, seq)); | ||
428 | return now; | 428 | return now; |
429 | } | 429 | } |
430 | |||
431 | u64 ktime_get_mono_fast_ns(void) | ||
432 | { | ||
433 | return __ktime_get_fast_ns(&tk_fast_mono); | ||
434 | } | ||
430 | EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); | 435 | EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); |
431 | 436 | ||
432 | /* Suspend-time cycles value for halted fast timekeeper. */ | 437 | /* Suspend-time cycles value for halted fast timekeeper. */ |
@@ -455,7 +460,7 @@ static void halt_fast_timekeeper(struct timekeeper *tk) | |||
455 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); | 460 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); |
456 | cycles_at_suspend = tkr->read(tkr->clock); | 461 | cycles_at_suspend = tkr->read(tkr->clock); |
457 | tkr_dummy.read = dummy_clock_read; | 462 | tkr_dummy.read = dummy_clock_read; |
458 | update_fast_timekeeper(&tkr_dummy); | 463 | update_fast_timekeeper(&tkr_dummy, &tk_fast_mono); |
459 | } | 464 | } |
460 | 465 | ||
461 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD | 466 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD |
@@ -586,7 +591,7 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) | |||
586 | memcpy(&shadow_timekeeper, &tk_core.timekeeper, | 591 | memcpy(&shadow_timekeeper, &tk_core.timekeeper, |
587 | sizeof(tk_core.timekeeper)); | 592 | sizeof(tk_core.timekeeper)); |
588 | 593 | ||
589 | update_fast_timekeeper(&tk->tkr_mono); | 594 | update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono); |
590 | } | 595 | } |
591 | 596 | ||
592 | /** | 597 | /** |