diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2008-08-01 19:09:13 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 04:15:19 -0400 |
commit | 29415c37f043d1d54dcf356601d738ff6633b72b (patch) | |
tree | 43958b606712801806e0ff8e3da5426b9c66feaf /arch/x86 | |
parent | 8349b5cd816adf102c078553ec8ca63b3beb457c (diff) |
KVM: set debug registers after "schedulable" section
The vcpu thread can be preempted after the guest_debug_pre() callback,
resulting in invalid debug registers on the new vcpu.
Move it inside the non-preemptable section.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/x86.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f1b0223c4088..4a033757a19e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3113,10 +3113,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
3113 | down_read(&vcpu->kvm->slots_lock); | 3113 | down_read(&vcpu->kvm->slots_lock); |
3114 | vapic_enter(vcpu); | 3114 | vapic_enter(vcpu); |
3115 | 3115 | ||
3116 | preempted: | ||
3117 | if (vcpu->guest_debug.enabled) | ||
3118 | kvm_x86_ops->guest_debug_pre(vcpu); | ||
3119 | |||
3120 | again: | 3116 | again: |
3121 | if (vcpu->requests) | 3117 | if (vcpu->requests) |
3122 | if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) | 3118 | if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) |
@@ -3170,6 +3166,9 @@ again: | |||
3170 | goto out; | 3166 | goto out; |
3171 | } | 3167 | } |
3172 | 3168 | ||
3169 | if (vcpu->guest_debug.enabled) | ||
3170 | kvm_x86_ops->guest_debug_pre(vcpu); | ||
3171 | |||
3173 | vcpu->guest_mode = 1; | 3172 | vcpu->guest_mode = 1; |
3174 | /* | 3173 | /* |
3175 | * Make sure that guest_mode assignment won't happen after | 3174 | * Make sure that guest_mode assignment won't happen after |
@@ -3244,7 +3243,7 @@ out: | |||
3244 | if (r > 0) { | 3243 | if (r > 0) { |
3245 | kvm_resched(vcpu); | 3244 | kvm_resched(vcpu); |
3246 | down_read(&vcpu->kvm->slots_lock); | 3245 | down_read(&vcpu->kvm->slots_lock); |
3247 | goto preempted; | 3246 | goto again; |
3248 | } | 3247 | } |
3249 | 3248 | ||
3250 | post_kvm_run_save(vcpu, kvm_run); | 3249 | post_kvm_run_save(vcpu, kvm_run); |