Hi! I recently triaged a series of failures that I am seeing on both of my AMD machines in the kvm selftests. One test failed due to a trivial typo, to which I had sent a fix, but most of the other tests failed due to what I now suspect to be a very minor but still a CPU bug. All of the failing tests except two tests that timeout (and I haven't yet triaged them), use the perf_test_util.c library. All of these fail with SHUTDOWN exit reason. After a relatively recent commit ef4c9f4f6546 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()"), vm_get_max_gfn() was fixed to return the maximum GFN that the guest can use. For default VM type this value is obtained from 'vm->pa_bit's which is in turn obtained from guest's cpuid in kvm_get_cpu_address_width function. It is 48 on both my AMD machines (3970X and 4650U) and also on remote EPYC 7302P machine. (all of them are Zen2 machines) My 3970X has SME enabled by BIOS, while my 4650U doesn't have it enabled. The 7302P also has SME enabled. SEV was obviously not enabled for the test. NPT was enabled. It appears that if the guest uses any GPA above 0xFFFCFFFFF000 in its guest paging tables, then it gets #PF with reserved bits error code. That causes the guest to shutdown because the kvm unit tests don't setup exception handling (I think). I used my 'intercept all exceptions' debug feature to enable #PF intercept which allowed me to clearly see the #PF with a reserved bit reason happening prior to shutdown. I attached a simple reproducer for this. PS: I did my best to check that this isn't a code/compiler bug in the selftests. I did find one bug (which one can even claim to be a compiler bug, but I think that due to very undefined nature of bitfields, the compiler is allowed to do this): In addr_gva2gpa we have this code return (pte[index[0]].pfn * vm->page_size) + (gva & 0xfffu); The pfn is declared as 'uint64_t pfn:40' When the PTE is set to 'fffd00000003' for example, this code for some reason returns 0xfd00000000 instead of '0xfffd00000000' If 'pte[index[0]].pfn' is copied to uint64_t variable and then shifted / multiplied by the page size then the correct value is printed. This was tested on both gcc 10.2.1 that comes with fedora 32, gcc 11.1.1 that comes with fedora 34 and gcc 8.5.0 that comes with RHEL 8.5.0. However the raw PTE value does seem to be correctly set, so it looks like this problem is not related to the possible CPU bug I found. The reproducer I attached has few test 'printf's for this issue as well. Best regards, Maxim Levitsky