x86.c (1425075e7272faaa3629a1e2df679c0ba4cf55d3) x86.c (00f526850151e91fdad0896a1436341687ad2582)
1/*
2 * Kernel-based Virtual Machine driver for Linux
3 *
4 * derived from drivers/kvm/kvm_main.c
5 *
6 * Copyright (C) 2006 Qumranet, Inc.
7 * Copyright (C) 2008 Qumranet, Inc.
8 * Copyright IBM Corporation, 2008

--- 1548 unchanged lines hidden (view full) ---

1557 cycle_t ret = (cycle_t)rdtsc_ordered();
1558 u64 last = pvclock_gtod_data.clock.cycle_last;
1559
1560 if (likely(ret >= last))
1561 return ret;
1562
1563 /*
1564 * GCC likes to generate cmov here, but this branch is extremely
1/*
2 * Kernel-based Virtual Machine driver for Linux
3 *
4 * derived from drivers/kvm/kvm_main.c
5 *
6 * Copyright (C) 2006 Qumranet, Inc.
7 * Copyright (C) 2008 Qumranet, Inc.
8 * Copyright IBM Corporation, 2008

--- 1548 unchanged lines hidden (view full) ---

1557 cycle_t ret = (cycle_t)rdtsc_ordered();
1558 u64 last = pvclock_gtod_data.clock.cycle_last;
1559
1560 if (likely(ret >= last))
1561 return ret;
1562
1563 /*
1564 * GCC likes to generate cmov here, but this branch is extremely
1565 * predictable (it's just a funciton of time and the likely is
1565 * predictable (it's just a function of time and the likely is
1566 * very likely) and there's a data dependence, so force GCC
1567 * to generate a branch instead. I don't barrier() because
1568 * we don't actually need a barrier, and if this function
1569 * ever gets inlined it will generate worse code.
1570 */
1571 asm volatile ("");
1572 return last;
1573}

--- 1173 unchanged lines hidden (view full) ---

2747 if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1)
2748 kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
2749 if (vcpu->cpu != cpu)
2750 kvm_migrate_timers(vcpu);
2751 vcpu->cpu = cpu;
2752 }
2753
2754 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
1566 * very likely) and there's a data dependence, so force GCC
1567 * to generate a branch instead. I don't barrier() because
1568 * we don't actually need a barrier, and if this function
1569 * ever gets inlined it will generate worse code.
1570 */
1571 asm volatile ("");
1572 return last;
1573}

--- 1173 unchanged lines hidden (view full) ---

2747 if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1)
2748 kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
2749 if (vcpu->cpu != cpu)
2750 kvm_migrate_timers(vcpu);
2751 vcpu->cpu = cpu;
2752 }
2753
2754 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
2755 vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD;
2756}
2757
2758void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
2759{
2760 kvm_x86_ops->vcpu_put(vcpu);
2761 kvm_put_guest_fpu(vcpu);
2762 vcpu->arch.last_host_tsc = rdtsc();
2763}

--- 3850 unchanged lines hidden (view full) ---

6614
6615 /*
6616 * Do this here before restoring debug registers on the host. And
6617 * since we do this before handling the vmexit, a DR access vmexit
6618 * can (a) read the correct value of the debug registers, (b) set
6619 * KVM_DEBUGREG_WONT_EXIT again.
6620 */
6621 if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
2755}
2756
2757void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
2758{
2759 kvm_x86_ops->vcpu_put(vcpu);
2760 kvm_put_guest_fpu(vcpu);
2761 vcpu->arch.last_host_tsc = rdtsc();
2762}

--- 3850 unchanged lines hidden (view full) ---

6613
6614 /*
6615 * Do this here before restoring debug registers on the host. And
6616 * since we do this before handling the vmexit, a DR access vmexit
6617 * can (a) read the correct value of the debug registers, (b) set
6618 * KVM_DEBUGREG_WONT_EXIT again.
6619 */
6620 if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
6622 int i;
6623
6624 WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
6625 kvm_x86_ops->sync_dirty_debug_regs(vcpu);
6621 WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
6622 kvm_x86_ops->sync_dirty_debug_regs(vcpu);
6626 for (i = 0; i < KVM_NR_DB_REGS; i++)
6627 vcpu->arch.eff_db[i] = vcpu->arch.db[i];
6623 kvm_update_dr0123(vcpu);
6624 kvm_update_dr6(vcpu);
6625 kvm_update_dr7(vcpu);
6626 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;
6628 }
6629
6630 /*
6631 * If the guest has used debug registers, at least dr7
6632 * will be disabled while returning to the host.
6633 * If we don't have active breakpoints in the host, we don't
6634 * care about the messed up debug address registers. But if
6635 * we have some of them active, restore the old state.

--- 1755 unchanged lines hidden ---
6627 }
6628
6629 /*
6630 * If the guest has used debug registers, at least dr7
6631 * will be disabled while returning to the host.
6632 * If we don't have active breakpoints in the host, we don't
6633 * care about the messed up debug address registers. But if
6634 * we have some of them active, restore the old state.

--- 1755 unchanged lines hidden ---