> On Jan 26, 2020, at 2:06 PM, Jim Mattson <jmattson@xxxxxxxxxx> wrote: > > If I had to guess, you probably have SMM malware on your host. Remove > the malware, and the test should pass. Well, malware will always be an option, but I doubt this is the case. Interestingly, in the last few times the failure did not reproduce. Yet, thinking about it made me concerned about MTRRs configuration, and that perhaps performance is affected by memory marked as UC after boot, since kvm-unit-test does not reset MTRRs. Reading the variable range MTRRs, I do see some ranges marked as UC (most of the range 2GB-4GB, if I read the MTRRs correctly): MSR 0x200 = 0x80000000 MSR 0x201 = 0x3fff80000800 MSR 0x202 = 0xff000005 MSR 0x203 = 0x3fffff000800 MSR 0x204 = 0x38000000000 MSR 0x205 = 0x3f8000000800 Do you think we should set the MTRRs somehow in KVM-unit-tests? If yes, can you suggest a reasonable configuration? Thanks, Nadav > > On Fri, Jan 24, 2020 at 4:06 PM Nadav Amit <nadav.amit@xxxxxxxxx> wrote: >>> On Jan 24, 2020, at 3:38 PM, Sean Christopherson <sean.j.christopherson@xxxxxxxxx> wrote: >>> >>> On Fri, Jan 24, 2020 at 03:13:44PM -0800, Nadav Amit wrote: >>>>> On Dec 2, 2019, at 12:43 PM, Aaron Lewis <aaronlewis@xxxxxxxxxx> wrote: >>>>> >>>>> Verify that the difference between a guest RDTSC instruction and the >>>>> IA32_TIME_STAMP_COUNTER MSR value stored in the VMCS12's VM-exit >>>>> MSR-store list is less than 750 cycles, 99.9% of the time. >>>>> >>>>> 662f1d1d1931 ("KVM: nVMX: Add support for capturing highest observable L2 TSC”) >>>>> >>>>> Signed-off-by: Aaron Lewis <aaronlewis@xxxxxxxxxx> >>>>> Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx> >>>> >>>> Running this test on bare-metal I get: >>>> >>>> Test suite: rdtsc_vmexit_diff_test >>>> FAIL: RDTSC to VM-exit delta too high in 117 of 100000 iterations >>>> >>>> Any idea why? Should I just play with the 750 cycles magic number? >>> >>> Argh, this reminds me that I have a patch for this test to improve the >>> error message to makes things easier to debug. Give me a few minutes to >>> get it sent out, might help a bit. >> >> Thanks for the quick response. With this patch I get on my bare-metal Skylake: >> >> FAIL: RDTSC to VM-exit delta too high in 100 of 49757 iterations, last = 1152 >> FAIL: Guest didn't run to completion. >> >> I’ll try to raise the delta and see what happens. >> >> Sorry for my laziness - it is just that like ~30% of the tests that are >> added fail on bare-metal :(