diff options
author | Bryan Cantrill <bryan@joyent.com> | 2011-12-06 01:23:23 +0000 |
---|---|---|
committer | Bryan Cantrill <bryan@joyent.com> | 2011-12-06 01:23:23 +0000 |
commit | c1086e516e7350f245dab213303af08cd0e0e834 (patch) | |
tree | 74ab36eef6cb830d444e4129fe4351680240a721 /kvm.c | |
parent | 0b48fcf44fc479f9270a7f3eaab0fdbc587dd313 (diff) | |
download | illumos-kvm-c1086e516e7350f245dab213303af08cd0e0e834.tar.gz |
HVM-700 Panic in module "kvm" due to a NULL pointer dereference
HVM-708 record emulation failures via ring buffer, not cmn_err()
Diffstat (limited to 'kvm.c')
-rw-r--r-- | kvm.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -426,12 +426,23 @@ 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)]; + int id = curthread->t_cpu->cpu_id; + hrtime_t tsc = gethrtime_unscaled(); ent->kvmre_tag = tag; - ent->kvmre_cpuid = curthread->t_cpu->cpu_id; + ent->kvmre_cpuid = id; ent->kvmre_thread = (uintptr_t)curthread; - ent->kvmre_tsc = gethrtime_unscaled(); + ent->kvmre_tsc = tsc; ent->kvmre_payload = payload; + + ent = &ringbuf->kvmr_taglast[tag]; + ent->kvmre_tag = tag; + ent->kvmre_cpuid = id; + ent->kvmre_thread = (uintptr_t)curthread; + ent->kvmre_tsc = tsc; + ent->kvmre_payload = payload; + + ringbuf->kvmr_tagcount[tag]++; } /* @@ -479,10 +490,11 @@ vcpu_load(struct kvm_vcpu *vcpu) int cpu; mutex_enter(&vcpu->mutex); - kpreempt_disable(); - cpu = CPU->cpu_seqid; installctx(curthread, vcpu, kvm_ctx_save, kvm_ctx_restore, NULL, NULL, NULL, NULL); + + kpreempt_disable(); + cpu = CPU->cpu_seqid; kvm_arch_vcpu_load(vcpu, cpu); kvm_ringbuf_record(&vcpu->kvcpu_ringbuf, KVM_RINGBUF_TAG_VCPULOAD, vcpu->cpu); |