]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Move GHCB unmapping to fix RCU warning
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 6 May 2021 20:14:41 +0000 (15:14 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 May 2021 10:06:23 +0000 (06:06 -0400)
commitd5a5ca18e27bf6728f866753c766d8a5a9de806f
tree921b38c2bc256a037a897cdb62889aeab8f3fd4f
parent962fb7e63a774ad527dfc916bcf4fcecdaaa718a
KVM: SVM: Move GHCB unmapping to fix RCU warning

When an SEV-ES guest is running, the GHCB is unmapped as part of the
vCPU run support. However, kvm_vcpu_unmap() triggers an RCU dereference
warning with CONFIG_PROVE_LOCKING=y because the SRCU lock is released
before invoking the vCPU run support.

Move the GHCB unmapping into the prepare_guest_switch callback, which is
invoked while still holding the SRCU lock, eliminating the RCU dereference
warning.

Fixes: 2a4a6e417d97 ("KVM: SVM: Add initial support for a VMGEXIT VMEXIT")
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <b2f9b79d15166f2c3e4375c0d9bc3268b7696455.1620332081.git.thomas.lendacky@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h