On Tue, Jan 10, 2023, Robert Hoo wrote: > On Mon, 2023-01-09 at 16:29 +0000, Sean Christopherson wrote: > > As a base rule, KVM intercepts CR4 bits unless there's a reason not to, > > e.g. if the CR4 bit in question is written frequently by real guests and/or > > never consumed by KVM. > > From these 2 points to judge: > CR4.LAM_SUP is written frequently by guest? I'm not sure, as native > kernel enabling patch has LAM_U57 only yet, not sure its control will > be per-process/thread or whole kernel-level. If it its use case is > kasan kind of, would you expect it will be frequently guest written? Controlling a kernel-level knob on a per-process basis would be bizarre. But the expected use case definitely needs to be understood. I assume Kirill, or whoever is doing the LAM_SUP implementation, can provide answers. > Never consumed by KVM? false, e.g. kvm_untagged_addr() will read this > bit. But not frequently, I think, at least by this patch set. Untagging an address will need to be done any time KVM consumes a guest virtual address, i.e. performs any kind of emulation. That's not super high frequency on modern CPUs, but it's not exactly rare either. > So in general, you suggestion/preference? I'm all right on both > choices. Unless guests will be touching CR4.LAM_SUP on context switches, intercepting is unquestionably the right choice.