From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH v3 0/4] Fix accessed bit tracking Date: Mon, 5 Jul 2010 15:39:09 +0300 Message-ID: <1278333553-22731-1-git-send-email-avi@redhat.com> Cc: Marcelo Tosatti To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:62417 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758535Ab0GEMjP (ORCPT ); Mon, 5 Jul 2010 08:39:15 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o65CdEnt018830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 5 Jul 2010 08:39:15 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o65CdEX2024837 for ; Mon, 5 Jul 2010 08:39:14 -0400 Sender: kvm-owner@vger.kernel.org List-ID: The kvm mmu synchronizes shadow ptes using the mmu lock, however the cpu will happily ignore the lock when setting the accessed bit. This can cause the accessed bit to be lost. Luckily this only results in incorrect page selection for swap. This patchset fixes the problem by atomically updating the spte when needed while taking care of the accessed bit. v3: fix i386 pte exchange code in patch 3 add missing __set_spte() to drop_spte() in patch 2 v2: fix incorrect code transformations in first patch Avi Kivity (4): KVM: MMU: Introduce drop_spte() KVM: MMU: Move accessed/dirty bit checks from rmap_remove() to drop_spte() KVM: MMU: Atomically check for accessed bit when dropping an spte KVM: MMU: Don't drop accessed bit while updating an spte arch/x86/kvm/mmu.c | 88 +++++++++++++++++++++++++++++++------------ arch/x86/kvm/paging_tmpl.h | 13 +++--- 2 files changed, 69 insertions(+), 32 deletions(-)