summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-04-15 16:12:40 -0700
committerRobert Mustacchi <rm@joyent.com>2011-04-15 16:12:40 -0700
commit01ce994f8ab0b2140b536e6a7dc02e74db7356e3 (patch)
tree1080dc8aad9d54c18000173f90ad21736e720ce1
parentd22dd2726db60633d0b435ddf2d97773d477e8e5 (diff)
downloadillumos-kvm-01ce994f8ab0b2140b536e6a7dc02e74db7356e3.tar.gz
HVM-72 want second xxx probe for synchronization issues
-rw-r--r--kvm.c66
-rw-r--r--kvm.h2
-rw-r--r--kvm_x86.c12
-rwxr-xr-xtools/xxxcheck1
4 files changed, 45 insertions, 36 deletions
diff --git a/kvm.c b/kvm.c
index b55ea6b..e48a142 100644
--- a/kvm.c
+++ b/kvm.c
@@ -2295,7 +2295,7 @@ gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn)
#ifdef XXX
aliases = rcu_dereference(kvm->arch.aliases);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
aliases = kvm->arch.aliases;
#endif /*XXX*/
@@ -2481,7 +2481,7 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
#ifdef XXX
cond_resched_lock(&vcpu->mutex);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
mutex_enter(&vcpu->kvm->mmu_lock);
#endif /*XXX*/
kvm_mmu_pages_init(parent, &parents, &pages);
@@ -2989,7 +2989,7 @@ void kvm_define_shared_msr(unsigned slot, uint32_t msr)
/* we need ensured the shared_msr_global have been updated */
smp_wmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
}
@@ -4099,7 +4099,7 @@ skip_lpage:
rcu_assign_pointer(kvmp->memslots, slots);
synchronize_srcu_expedited(&kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
kvmp->memslots = slots;
#endif /*XXX*/
/* From this point no new shadow pages pointing to a deleted
@@ -4149,7 +4149,7 @@ skip_lpage:
rcu_assign_pointer(kvmp->memslots, slots);
synchronize_srcu_expedited(&kvmp->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
kvmp->memslots = slots;
#endif /*XXX*/
@@ -5006,6 +5006,8 @@ int vmx_vcpu_setup(struct vcpu_vmx *vmx)
kvm_vmcs_dump(0);
vmcs_dump_idx++;
}
+#else
+ XXX_KVM_PROBE;
#endif /*XXX_KVM_DEBUG*/
return 0;
}
@@ -7278,7 +7280,7 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs,
#ifdef XXX
idx = srcu_read_lock(&vcpu->kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif
for (i = 0; i < msrs->nmsrs; ++i)
if (do_msr(vcpu, entries[i].index, &entries[i].data))
@@ -7286,7 +7288,7 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs,
#ifdef XXX
srcu_read_unlock(&vcpu->kvm->srcu, idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif
vcpu_put(vcpu);
@@ -7773,6 +7775,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
kvm_vmcs_dump(1);
vmcs_dump_idx++;
}
+#else
+ XXX_KVM_PROBE;
#endif /*XXX_KVM_DEBUG*/
__asm__(
@@ -7885,6 +7889,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
kvm_vmcs_dump(2);
vmcs_dump_idx++;
}
+#else
+ XXX_KVM_PROBE;
#endif /*XXX_KVM_DEBUG*/
vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP)
@@ -11400,7 +11406,7 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
gsi = rcu_dereference(kvm->irq_routing)->chip[irqchip][pin];
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
gsi = (kvm->irq_routing)->chip[irqchip][pin];
#ifdef XXX
@@ -11411,7 +11417,7 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
kian->irq_acked(kian);
rcu_read_unlock();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
}
@@ -11994,14 +12000,14 @@ static void vapic_exit(struct kvm_vcpu *vcpu)
#ifdef XXX
idx = srcu_read_lock(&vcpu->kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
kvm_release_page_dirty(apic->vapic_page);
mark_page_dirty(vcpu->kvm, apic->vapic_addr >> PAGESHIFT);
#ifdef XXX
srcu_read_unlock(&vcpu->kvm->srcu, idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
}
@@ -12085,7 +12091,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
#ifdef XXX
vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
vapic_enter(vcpu);
@@ -12097,13 +12103,13 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
#ifdef XXX
srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
kvm_vcpu_block(vcpu);
#ifdef XXX
vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
if (test_and_clear_bit(KVM_REQ_UNHALT, &vcpu->requests))
{
@@ -12155,20 +12161,20 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
#ifdef XXX
srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
kvm_resched(vcpu);
#ifdef XXX
vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
}
}
#ifdef XXX
srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
post_kvm_run_save(vcpu);
vapic_exit(vcpu);
@@ -12204,13 +12210,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
#ifdef XXX
vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
r = complete_pio(vcpu);
#ifdef XXX
srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
if (r)
goto out;
@@ -12222,14 +12228,14 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
#ifdef XXX
vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
r = emulate_instruction(vcpu, vcpu->arch.mmio_fault_cr2, 0,
EMULTYPE_NO_DECODE);
#ifdef XXX
srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
if (r == EMULATE_DO_MMIO) {
/*
@@ -12753,7 +12759,7 @@ static void update_handled_vectors(struct kvm_ioapic *ioapic)
#ifdef XXX
smp_wmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
}
@@ -12889,7 +12895,7 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode)
#ifdef XXX
smp_rmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
if (!test_bit(vector, ioapic->handled_vectors))
return;
@@ -13263,14 +13269,14 @@ int kvm_set_irq_routing(struct kvm *kvm,
#ifdef XXX
rcu_assign_pointer(kvm->irq_routing, new);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
kvm->irq_routing = new;
#endif /*XXX*/
mutex_exit(&kvm->irq_lock);
#ifdef XXX
synchronize_rcu();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
new = old;
@@ -13405,7 +13411,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, uint32_t flags)
#ifdef XXX
raw_spin_lock_init(&pit->pit_state.inject_lock);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
mutex_init(&pit->pit_state.inject_lock, NULL, MUTEX_DRIVER, 0);
#endif /*XXX*/
kvm->arch.vpit = pit;
@@ -13610,7 +13616,7 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, uint32_t irq, int level)
rcu_read_lock();
irq_rt = rcu_dereference(kvm->irq_routing);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
irq_rt = kvm->irq_routing;
#endif /*XXX*/
if (irq < irq_rt->nr_rt_entries) {
@@ -13620,7 +13626,7 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, uint32_t irq, int level)
#ifdef XXX
rcu_read_unlock();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
while(i--) {
@@ -13811,13 +13817,13 @@ kvm_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *cred_p, int *rval_
#ifdef XXX
smp_wmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
kvmp->arch.vpic = vpic;
#ifdef XXX
smp_wmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
rval = kvm_setup_default_irq_routing(kvmp);
if (rval) {
diff --git a/kvm.h b/kvm.h
index 3869897..2eeed1b 100644
--- a/kvm.h
+++ b/kvm.h
@@ -12,6 +12,8 @@
#define XXX_KVM_PROBE DTRACE_PROBE2(kvm__xxx, \
char *, __FILE__, int, __LINE__)
+#define XXX_KVM_SYNC_PROBE DTRACE_PROBE2(kvm__xxx__sync, \
+ char *, __FILE__, int, __LINE__)
#ifdef _KERNEL
#include "bitops.h"
diff --git a/kvm_x86.c b/kvm_x86.c
index 63202a5..e2023cb 100644
--- a/kvm_x86.c
+++ b/kvm_x86.c
@@ -446,7 +446,7 @@ int irqchip_in_kernel(struct kvm *kvm)
#ifdef XXX
smp_rmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif
return ret;
}
@@ -2239,7 +2239,7 @@ int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
#ifdef XXX
idx = srcu_read_lock(&vcpu->kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
if (!init_rmode(vmx->vcpu.kvm)) {
@@ -2360,7 +2360,7 @@ out:
#ifdef XXX
srcu_read_unlock(&vcpu->kvm->srcu, idx);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
return ret;
}
@@ -4061,7 +4061,7 @@ kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int32_t id, int *rval_p)
#ifdef XXX
smp_wmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
atomic_inc_32(&kvm->online_vcpus);
@@ -4283,7 +4283,7 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
synchronize_srcu_expedited(&kvm->srcu);
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif
kmem_free(bus, sizeof(struct kvm_io_bus));
return r;
@@ -4308,7 +4308,7 @@ static int coalesced_mmio_write(struct kvm_io_device *this,
#ifdef XXX
smp_wmb();
#else
- XXX_KVM_PROBE;
+ XXX_KVM_SYNC_PROBE;
#endif /*XXX*/
ring->last = (ring->last + 1) % KVM_COALESCED_MMIO_MAX;
mutex_exit(&dev->lock);
diff --git a/tools/xxxcheck b/tools/xxxcheck
index d6501f8..da21795 100755
--- a/tools/xxxcheck
+++ b/tools/xxxcheck
@@ -27,6 +27,7 @@ for file in $*; do
/#ifdef XXX_KVM_DECLARATION/{ inif = 0 }
/#else/{ if (inif && !nest) { foundelse = 1; } }
/XXX_KVM_PROBE;/{ if (inif && foundelse) { foundprobe = 1; } }
+ /XXX_KVM_SYNC_PROBE;/{ if (inif && foundelse) { foundprobe = 1; } }
/#endif/{
if (inif && nest) {
nest--;