diff options
author | Avi Kivity <avi@redhat.com> | 2011-11-15 07:59:07 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-20 03:53:48 -0500 |
commit | 95ef1e52922cf75b1ea2eae54ef886f2cc47eecb (patch) | |
tree | 158082c19666aa589b539f20b4cf29e99f205f4f | |
parent | bb75c627fb0dfb8c0ab75d3033709ff928896e16 (diff) |
KVM guest: prevent tracing recursion with kvmclock
Prevent tracing of preempt_disable() in get_cpu_var() in
kvm_clock_read(). When CONFIG_DEBUG_PREEMPT is enabled,
preempt_disable/enable() are traced and this causes the function_graph
tracer to go into an infinite recursion. By open coding the
preempt_disable() around the get_cpu_var(), we can use the notrace
version which prevents preempt_disable/enable() from being traced and
prevents the recursion.
Based on a similar patch for Xen from Jeremy Fitzhardinge.
Tested-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index c1a0188e29ae..44842d756b29 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -74,9 +74,10 @@ static cycle_t kvm_clock_read(void) | |||
74 | struct pvclock_vcpu_time_info *src; | 74 | struct pvclock_vcpu_time_info *src; |
75 | cycle_t ret; | 75 | cycle_t ret; |
76 | 76 | ||
77 | src = &get_cpu_var(hv_clock); | 77 | preempt_disable_notrace(); |
78 | src = &__get_cpu_var(hv_clock); | ||
78 | ret = pvclock_clocksource_read(src); | 79 | ret = pvclock_clocksource_read(src); |
79 | put_cpu_var(hv_clock); | 80 | preempt_enable_notrace(); |
80 | return ret; | 81 | return ret; |
81 | } | 82 | } |
82 | 83 | ||