diff options
author | Peter Zijlstra <peterz@infradead.org> | 2023-05-19 13:21:09 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-06-05 22:11:08 +0300 |
commit | 5c5e9a2b25b6a79d4b7a5f2a54d02ef1c36dc35a (patch) | |
tree | a74d876dc00aa266dedf0933e6466073f7bf10ae /arch/x86/xen | |
parent | e39acc37db34f6688e2c16e958fb1d662c422c81 (diff) | |
download | linux-5c5e9a2b25b6a79d4b7a5f2a54d02ef1c36dc35a.tar.xz |
x86/tsc: Provide sched_clock_noinstr()
With the intent to provide local_clock_noinstr(), a variant of
local_clock() that's safe to be called from noinstr code (with the
assumption that any such code will already be non-preemptible),
prepare for things by providing a noinstr sched_clock_noinstr()
function.
Specifically, preempt_enable_*() calls out to schedule(), which upsets
noinstr validation efforts.
vmlinux.o: warning: objtool: native_sched_clock+0x96: call to preempt_schedule_notrace_thunk() leaves .noinstr.text section
vmlinux.o: warning: objtool: kvm_clock_read+0x22: call to preempt_schedule_notrace_thunk() leaves .noinstr.text section
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Kelley <mikelley@microsoft.com> # Hyper-V
Link: https://lore.kernel.org/r/20230519102715.910937674@infradead.org
Diffstat (limited to 'arch/x86/xen')
-rw-r--r-- | arch/x86/xen/time.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index b74ac2562cfb..52fa5609b7f6 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -66,11 +66,10 @@ static noinstr u64 xen_sched_clock(void) struct pvclock_vcpu_time_info *src; u64 ret; - preempt_disable_notrace(); src = &__this_cpu_read(xen_vcpu)->time; ret = pvclock_clocksource_read_nowd(src); ret -= xen_sched_clock_offset; - preempt_enable_notrace(); + return ret; } |