x86/kvm: Handle async page faults directly through do_page_fault()
authorAndy Lutomirski <luto@kernel.org>
Fri, 28 Feb 2020 18:42:48 +0000 (10:42 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 19 May 2020 13:53:57 +0000 (15:53 +0200)
commitef68017eb5704eb2b0577c3aa6619e13caf2b59f
treea2a446d82225fc8adf7badb026cb869573371a39
parentaf1e56b78534c38bb0e0c712ca70e59f816b74e9
x86/kvm: Handle async page faults directly through do_page_fault()

KVM overloads #PF to indicate two types of not-actually-page-fault
events.  Right now, the KVM guest code intercepts them by modifying
the IDT and hooking the #PF vector.  This makes the already fragile
fault code even harder to understand, and it also pollutes call
traces with async_page_fault and do_async_page_fault for normal page
faults.

Clean it up by moving the logic into do_page_fault() using a static
branch.  This gets rid of the platform trap_init override mechanism
completely.

[ tglx: Fixed up 32bit, removed error code from the async functions and
   massaged coding style ]

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200505134059.169270470@linutronix.de
arch/x86/entry/entry_32.S
arch/x86/entry/entry_64.S
arch/x86/include/asm/kvm_para.h
arch/x86/include/asm/x86_init.h
arch/x86/kernel/kvm.c
arch/x86/kernel/traps.c
arch/x86/kernel/x86_init.c
arch/x86/mm/fault.c