Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202258
b: refs/heads/master
c: d94e1dc
h: refs/heads/master
v: v3
  • Loading branch information
Avi Kivity committed Aug 1, 2010
1 parent dca6571 commit c8bfa32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54b8486f469475d6c8e8aec917b91239a54eb8c8
refs/heads/master: d94e1dc9af60e3431a586c3edfbe42d8a0d3932b
17 changes: 10 additions & 7 deletions trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4604,13 +4604,15 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
if (vcpu->fpu_active)
kvm_load_guest_fpu(vcpu);

local_irq_disable();
atomic_set(&vcpu->guest_mode, 1);
smp_wmb();

clear_bit(KVM_REQ_KICK, &vcpu->requests);
smp_mb__after_clear_bit();
local_irq_disable();

if (vcpu->requests || need_resched() || signal_pending(current)) {
set_bit(KVM_REQ_KICK, &vcpu->requests);
if (!atomic_read(&vcpu->guest_mode) || vcpu->requests
|| need_resched() || signal_pending(current)) {
atomic_set(&vcpu->guest_mode, 0);
smp_wmb();
local_irq_enable();
preempt_enable();
r = 1;
Expand Down Expand Up @@ -4655,7 +4657,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
if (hw_breakpoint_active())
hw_breakpoint_restore();

set_bit(KVM_REQ_KICK, &vcpu->requests);
atomic_set(&vcpu->guest_mode, 0);
smp_wmb();
local_irq_enable();

++vcpu->stat.exits;
Expand Down Expand Up @@ -5580,7 +5583,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)

me = get_cpu();
if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu))
if (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests))
if (atomic_xchg(&vcpu->guest_mode, 0))
smp_send_reschedule(cpu);
put_cpu();
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct kvm_vcpu {
int vcpu_id;
struct mutex mutex;
int cpu;
atomic_t guest_mode;
struct kvm_run *run;
unsigned long requests;
unsigned long guest_debug;
Expand Down

0 comments on commit c8bfa32

Please sign in to comment.