]> git.hungrycats.org Git - linux/commit
KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE
authorPaul Mackerras <paulus@samba.org>
Wed, 24 Jun 2015 11:18:05 +0000 (21:18 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Sep 2015 17:10:55 +0000 (10:10 -0700)
commit1e264dadd94b0f7f4063eeef9443930e3ac75855
tree4b1e751029ef274d0c893f8d43f67ea3fed436ab
parent4dd33bd6a462c7b3f8e3073c3fab6e4ed8da3620
KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE

commit 1e5bf454f58731e360e504253e85bae7aaa2d298 upstream.

The reference (R) and change (C) bits in a HPT entry can be set by
hardware at any time up until the HPTE is invalidated and the TLB
invalidation sequence has completed.  This means that when removing
a HPTE, we need to read the HPTE after the invalidation sequence has
completed in order to obtain reliable values of R and C.  The code
in kvmppc_do_h_remove() used to do this.  However, commit 6f22bd3265fb
("KVM: PPC: Book3S HV: Make HTAB code LE host aware") removed the
read after invalidation as a side effect of other changes.  This
restores the read of the HPTE after invalidation.

The user-visible effect of this bug would be that when migrating a
guest, there is a small probability that a page modified by the guest
and then unmapped by the guest might not get re-transmitted and thus
the destination might end up with a stale copy of the page.

Fixes: 6f22bd3265fb
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kvm/book3s_hv_rm_mmu.c