Commit 545a2bf7 authored by Cyril Bur's avatar Cyril Bur Committed by Linus Torvalds

kernel/sched/clock.c: add another clock for use with the soft lockup watchdog

When the hypervisor pauses a virtualised kernel the kernel will observe a
jump in timebase, this can cause spurious messages from the softlockup

Whilst these messages are harmless, they are accompanied with a stack
trace which causes undue concern and more problematically the stack trace
in the guest has nothing to do with the observed problem and can only be

Futhermore, on POWER8 this is completely avoidable with the introduction
of the Virtual Time Base (VTB) register.

This patch (of 2):

This permits the use of arch specific clocks for which virtualised kernels
can use their notion of 'running' time, not the elpased wall time which
will include host execution time.
Signed-off-by: default avatarCyril Bur <>
Cc: Michael Ellerman <>
Cc: Andrew Jones <>
Acked-by: default avatarDon Zickus <>
Cc: Ingo Molnar <>
Cc: Ulrich Obergfell <>
Cc: chai wen <>
Cc: Fabian Frederick <>
Cc: Aaron Tomlin <>
Cc: Ben Zhang <>
Cc: Martin Schwidefsky <>
Cc: John Stultz <>
Cc: Thomas Gleixner <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent dd4a5c1e
......@@ -2147,6 +2147,7 @@ extern unsigned long long notrace sched_clock(void);
extern u64 cpu_clock(int cpu);
extern u64 local_clock(void);
extern u64 running_clock(void);
extern u64 sched_clock_cpu(int cpu);
......@@ -420,3 +420,16 @@ u64 local_clock(void)
* Running clock - returns the time that has elapsed while a guest has been
* running.
* On a guest this value should be local_clock minus the time the guest was
* suspended by the hypervisor (for any reason).
* On bare metal this function should return the same as local_clock.
* Architectures and sub-architectures can override this.
u64 __weak running_clock(void)
return local_clock();
......@@ -154,7 +154,7 @@ static int get_softlockup_thresh(void)
static unsigned long get_timestamp(void)
return local_clock() >> 30LL; /* 2^30 ~= 10^9 */
return running_clock() >> 30LL; /* 2^30 ~= 10^9 */
static void set_sample_period(void)
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