On 21/08/20 10:16, Borislav Petkov wrote: > On Fri, Aug 21, 2020 at 10:09:01AM +0200, Paolo Bonzini wrote: >> One more MSR *is* a big deal: KVM's vmentry+vmexit cost is around 1000 >> cycles, adding 100 clock cycles for 2 WRMSRs is a 10% increase. > > The kernel uses TSC_AUX so we can't reserve it to KVM either. KVM only uses TSC_AUX while in kernel space, because the kernel hadn't used it until now. That's for a good reason: * if possible, __this_cpu_read(cpu_number) is always faster. * The kernel can just block preemption at its will and has no need for the atomic rdtsc+vgetcpu provided by RDTSCP. So far, the kernel had always used LSL instead of RDPID when __this_cpu_read was not available. In one place, RDTSCP is used as an ordered rdtsc but it discards the TSC_AUX value. RDPID is also used in the vDSO but it isn't kernel space. Hence the assumption that KVM makes (and has made ever since TSC_AUX was introduced. What is the difference in speed between LSL and RDPID? I don't have a machine that has RDPID to test it, unfortunately. Paolo