Hello all, For an academic project we need to trap and emulate each RDTSC instruction executed in a virtual machine. (Our main aim is to calculate how many rdtsc instructions are executed in a virtual machine.) Currently we can intercept each of them. But we have a problem to give the correct tsc values (values are not stable). So we don't want to mess up the rdtsc reads. We just need to count rdtscs. Our current approach looks like this. static int handle_rdtsc(struct kvm_vcpu *vcpu) { counter += 1; vcpu->arch.regs[VCPU_REGS_RAX] = (rdtsc() - VM_EXIT_COS) & -1u; vcpu->arch.regs[VCPU_REGS_RDX] = ((rdtsc() - VM_EXIT_COST) >> 32) & -1u; return skip_emulated_instruction(vcpu); } VM_EXIT_COST calculated by how many clock cycles are executed during host to guest transition (for RDTSC exits only). Can KVM handle these operations built-in or do you have any idea how we can achieve this? Thanks a lot.