KVM: X86: Fix tlb flush for tdp in kvm_invalidate_pcid()
authorLai Jiangshan <laijs@linux.alibaba.com>
Tue, 19 Oct 2021 11:01:51 +0000 (19:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Dec 2021 08:32:34 +0000 (09:32 +0100)
commit6bd55427e266de8bb46781732a0786d6ed8aec48
tree6fded8d603339251a23314e3b307617bbed089fd
parentbf4367c02c8cc4d910157dfd1d34a89daea44d65
KVM: X86: Fix tlb flush for tdp in kvm_invalidate_pcid()

[ Upstream commit e45e9e3998f0001079b09555db5bb3b4257f6746 ]

The KVM doesn't know whether any TLB for a specific pcid is cached in
the CPU when tdp is enabled.  So it is better to flush all the guest
TLB when invalidating any single PCID context.

The case is very rare or even impossible since KVM generally doesn't
intercept CR3 write or INVPCID instructions when tdp is enabled, so the
fix is mostly for the sake of overall robustness.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Message-Id: <20211019110154.4091-2-jiangshanlai@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/x86.c