]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Keep HPTE locked when invalidating
authorPaul Mackerras <paulus@samba.org>
Thu, 15 Dec 2011 02:01:10 +0000 (02:01 +0000)
committerAvi Kivity <avi@redhat.com>
Mon, 5 Mar 2012 12:52:39 +0000 (14:52 +0200)
commitaa5b64e5275f3adb3b435036bb8cbfbddb301698
treefe0fb65201a532f360f6100959b6442f6829c94d
parentcf52a40a457c5e7cd764eba2791bbf6286c57d26
KVM: PPC: Book3S HV: Keep HPTE locked when invalidating

This reworks the implementations of the H_REMOVE and H_BULK_REMOVE
hcalls to make sure that we keep the HPTE locked and in the reverse-
mapping chain until we have finished invalidating it.  Previously
we would remove it from the chain and unlock it before invalidating
it, leaving a tiny window when the guest could access the page even
though we believe we have removed it from the guest (e.g.,
kvm_unmap_hva() has been called for the page and has found no HPTEs
in the chain).  In addition, we'll need this for future patches where
we will need to read the R and C bits in the HPTE after invalidating
it.

Doing this required restructuring kvmppc_h_bulk_remove() substantially.
Since we want to batch up the tlbies, we now need to keep several
HPTEs locked simultaneously.  In order to avoid possible deadlocks,
we don't spin on the HPTE bitlock for any except the first HPTE in
a batch.  If we can't acquire the HPTE bitlock for the second or
subsequent HPTE, we terminate the batch at that point, do the tlbies
that we have accumulated so far, unlock those HPTEs, and then start
a new batch to do the remaining invalidations.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/kvm/book3s_hv_rm_mmu.c