diff options
author | Bryan Cantrill <bryan@joyent.com> | 2011-11-29 06:23:47 +0000 |
---|---|---|
committer | Bryan Cantrill <bryan@joyent.com> | 2011-11-29 06:23:47 +0000 |
commit | 3b2aaad2c0647aa661548ee3add64f1aa590100c (patch) | |
tree | f496dae87ac9db7c36d9aaf7d897297340d50d93 /kvm.c | |
parent | a131c2d183ff020f325c894f2d5d20a8c93ea3d9 (diff) | |
download | illumos-kvm-3b2aaad2c0647aa661548ee3add64f1aa590100c.tar.gz |
HVM-701 need static instrumentation in kvm_ctx_save()/kvm_ctx_restore()
Diffstat (limited to 'kvm.c')
-rw-r--r-- | kvm.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -421,6 +421,19 @@ kvm_fire_urn(struct kvm_vcpu *vcpu) vcpu->urn->on_user_return(vcpu, vcpu->urn); } +void +kvm_ringbuf_record(kvm_ringbuf_t *ringbuf, uint32_t tag, uint64_t payload) +{ + kvm_ringbuf_entry_t *ent = &ringbuf->kvmr_buf[ringbuf->kvmr_ent++ & + (KVM_RINGBUF_NENTRIES - 1)]; + + ent->kvmre_tag = tag; + ent->kvmre_cpuid = curthread->t_cpu->cpu_id; + ent->kvmre_thread = (uintptr_t)curthread; + ent->kvmre_tsc = gethrtime_unscaled(); + ent->kvmre_payload = payload; +} + /* * Called when we've been asked to save our context. i.e. we're being swapped * out. @@ -429,6 +442,8 @@ void kvm_ctx_save(void *arg) { struct kvm_vcpu *vcpu = arg; + kvm_ringbuf_record(&vcpu->kvcpu_ringbuf, + KVM_RINGBUF_TAG_CTXSAVE, vcpu->cpu); kvm_arch_vcpu_put(vcpu); kvm_fire_urn(vcpu); } @@ -444,6 +459,8 @@ kvm_ctx_restore(void *arg) cpu = CPU->cpu_seqid; struct kvm_vcpu *vcpu = arg; + kvm_ringbuf_record(&vcpu->kvcpu_ringbuf, + KVM_RINGBUF_TAG_CTXRESTORE, vcpu->cpu); kvm_arch_vcpu_load(vcpu, cpu); } |