]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: pair smp_wmb() of mmu_try_to_unsync_pages() with smp_rmb()
authorLai Jiangshan <laijs@linux.alibaba.com>
Tue, 19 Oct 2021 11:01:53 +0000 (19:01 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Oct 2021 09:43:21 +0000 (05:43 -0400)
commit552ba1be91aa4f56c901e14457ab524ce2382a78
tree9287dedd4681a9118d5d4f4c4326845e1e4e76eb
parent3a9cca687ee6f7eec7196f2ee613352182dcd793
KVM: X86: pair smp_wmb() of mmu_try_to_unsync_pages() with smp_rmb()

The commit a318c5413f709 ("kvm: x86: Avoid taking MMU lock
in kvm_mmu_sync_roots if no sync is needed") added smp_wmb() in
mmu_try_to_unsync_pages(), but the corresponding smp_load_acquire() isn't
used on the load of SPTE.W.  smp_load_acquire() orders _subsequent_
loads after sp->is_unsync; it does not order _earlier_ loads before
the load of sp->is_unsync.

This has no functional change; smp_rmb() is a NOP on x86, and no
compiler barrier is required because there is a VMEXIT between the
load of SPTE.W and kvm_mmu_snc_roots.

Cc: Junaid Shahid <junaids@google.com>
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Message-Id: <20211019110154.4091-4-jiangshanlai@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c