Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248021
b: refs/heads/master
c: 09000ad
h: refs/heads/master
i:
  248019: 9041cff
v: v3
  • Loading branch information
Bharat Bhushan authored and Avi Kivity committed May 11, 2011
1 parent ada9c3d commit 7abd5de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 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: 7c5625227ff8c81953e953d8e25c3eba2ab0aeb3
refs/heads/master: 09000adb86550d2895b64faa52e64eaec3cae7b2
1 change: 1 addition & 0 deletions trunk/arch/powerpc/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ struct kvm_vcpu_arch {
u32 dbsr;

#ifdef CONFIG_KVM_EXIT_TIMING
struct mutex exit_timing_lock;
struct kvmppc_exit_timing timing_exit;
struct kvmppc_exit_timing timing_last_enter;
u32 last_exit_type;
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/powerpc/kvm/powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;

#ifdef CONFIG_KVM_EXIT_TIMING
mutex_init(&vcpu->arch.exit_timing_lock);
#endif

return 0;
}

Expand Down
10 changes: 7 additions & 3 deletions trunk/arch/powerpc/kvm/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
{
int i;

/* pause guest execution to avoid concurrent updates */
mutex_lock(&vcpu->mutex);
/* Take a lock to avoid concurrent updates */
mutex_lock(&vcpu->arch.exit_timing_lock);

vcpu->arch.last_exit_type = 0xDEAD;
for (i = 0; i < __NUMBER_OF_KVM_EXIT_TYPES; i++) {
Expand All @@ -49,7 +49,7 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
vcpu->arch.timing_exit.tv64 = 0;
vcpu->arch.timing_last_enter.tv64 = 0;

mutex_unlock(&vcpu->mutex);
mutex_unlock(&vcpu->arch.exit_timing_lock);
}

static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
Expand All @@ -65,6 +65,8 @@ static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
return;
}

mutex_lock(&vcpu->arch.exit_timing_lock);

vcpu->arch.timing_count_type[type]++;

/* sum */
Expand Down Expand Up @@ -93,6 +95,8 @@ static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
vcpu->arch.timing_min_duration[type] = duration;
if (unlikely(duration > vcpu->arch.timing_max_duration[type]))
vcpu->arch.timing_max_duration[type] = duration;

mutex_unlock(&vcpu->arch.exit_timing_lock);
}

void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu)
Expand Down

0 comments on commit 7abd5de

Please sign in to comment.