On Fri, Apr 07, 2023, Like Xu wrote: > On 7/4/2023 10:18 am, Sean Christopherson wrote: > > Wait, really? VMRUN is counted if and only if it enters to a CPL0 guest? Can > > someone from AMD confirm this? I was going to say we should just treat this as > > "normal" behavior, but counting CPL0 but not CPL>0 is definitely quirky. > > VMRUN is only counted on a CPL0-target (branch) instruction counter. Yes or no question: if KVM does VMRUN and a PMC is programmed to count _all_ taken branches, will the PMC count VMRUN as a branch if guest CPL>0 according to the VMCB? > This issue makes a guest CPL0-target instruction counter inexplicably > increase, as if it would have been under-counted before the virtualization > instructions were counted. Heh, it's very much explicable, it's just not desirable, and you and I would argue that it's also incorrect. AMD folks, are there plans to document this as an erratum? I agree with Like that counting VMRUN as a taken branch in guest context is a CPU bug, even if the behavior is known/expected.