]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: do not deliver asynchronous page faults if CR0.PG=0
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 9 Feb 2022 10:17:38 +0000 (05:17 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Feb 2022 13:20:16 +0000 (08:20 -0500)
commitbe19ccb55df6659754e16000030c0d815f6f45ba
treea962b257b25966729c3ae61942de6bd799be39f1
parent2c142fe41e25ddb32e013e718d0c7a2a2b39959d
KVM: x86: do not deliver asynchronous page faults if CR0.PG=0

Enabling async page faults is nonsensical if paging is disabled, but
it is allowed because CR0.PG=0 does not clear the async page fault
MSR.  Just ignore them and only use the artificial halt state,
similar to what happens in guest mode if async #PF vmexits are disabled.

Given the increasingly complex logic, and the nicer code if the new
"if" is placed last, opportunistically change the "||" into a chain
of "if (...) return false" statements.

Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c