lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1198421495-31481-36-git-send-email-avi@qumranet.com>
Date:	Sun, 23 Dec 2007 16:51:20 +0200
From:	Avi Kivity <avi@...ranet.com>
To:	linux-kernel@...r.kernel.org, kvm-devel@...ts.sourceforge.net
Subject: [PATCH 35/50] KVM: MMU: Move dirty bit updates to a separate function

Signed-off-by: Avi Kivity <avi@...ranet.com>
---
 drivers/kvm/paging_tmpl.h |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 4538b15..a0f84a5 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -69,6 +69,17 @@ struct guest_walker {
 	u32 error_code;
 };
 
+static void FNAME(update_dirty_bit)(struct kvm_vcpu *vcpu,
+				    int write_fault,
+				    pt_element_t *ptep,
+				    gfn_t table_gfn)
+{
+	if (write_fault && !is_dirty_pte(*ptep)) {
+		mark_page_dirty(vcpu->kvm, table_gfn);
+		*ptep |= PT_DIRTY_MASK;
+	}
+}
+
 /*
  * Fetch a guest pte for a guest virtual address
  */
@@ -144,10 +155,8 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
 		if (walker->level == PT_PAGE_TABLE_LEVEL) {
 			walker->gfn = (*ptep & PT_BASE_ADDR_MASK)
 				>> PAGE_SHIFT;
-			if (write_fault && !is_dirty_pte(*ptep)) {
-				mark_page_dirty(vcpu->kvm, table_gfn);
-				*ptep |= PT_DIRTY_MASK;
-			}
+			FNAME(update_dirty_bit)(vcpu, write_fault, ptep,
+						table_gfn);
 			break;
 		}
 
@@ -157,10 +166,8 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
 			walker->gfn = (*ptep & PT_DIR_BASE_ADDR_MASK)
 				>> PAGE_SHIFT;
 			walker->gfn += PT_INDEX(addr, PT_PAGE_TABLE_LEVEL);
-			if (write_fault && !is_dirty_pte(*ptep)) {
-				mark_page_dirty(vcpu->kvm, table_gfn);
-				*ptep |= PT_DIRTY_MASK;
-			}
+			FNAME(update_dirty_bit)(vcpu, write_fault, ptep,
+						table_gfn);
 			break;
 		}
 
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ