All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] KVM: Move first pte address calculation out of loop to save some cycles
@ 2010-04-16  9:16 Gui Jianfeng
  2010-04-16  9:18 ` [PATCH 2/4] KVM: Make use of is_large_pte() instead Gui Jianfeng
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gui Jianfeng @ 2010-04-16  9:16 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

Move first pte address calculation out of loop to save some cycles

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 arch/x86/kvm/paging_tmpl.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index d9dea28..5910557 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -572,12 +572,15 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
 {
 	int i, offset, nr_present;
 	bool reset_host_protection;
+	gpa_t first_pte_gpa;
 
 	offset = nr_present = 0;
 
 	if (PTTYPE == 32)
 		offset = sp->role.quadrant << PT64_LEVEL_BITS;
 
+	first_pte_gpa = gfn_to_gpa(sp->gfn) + offset * sizeof(pt_element_t);
+
 	for (i = 0; i < PT64_ENT_PER_PAGE; i++) {
 		unsigned pte_access;
 		pt_element_t gpte;
@@ -587,8 +590,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
 		if (!is_shadow_present_pte(sp->spt[i]))
 			continue;
 
-		pte_gpa = gfn_to_gpa(sp->gfn);
-		pte_gpa += (i+offset) * sizeof(pt_element_t);
+		pte_gpa = first_pte_gpa + i * sizeof(pt_element_t);
 
 		if (kvm_read_guest_atomic(vcpu->kvm, pte_gpa, &gpte,
 					  sizeof(pt_element_t)))
-- 
1.6.5.2





^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-21  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16  9:16 [PATCH 1/4] KVM: Move first pte address calculation out of loop to save some cycles Gui Jianfeng
2010-04-16  9:18 ` [PATCH 2/4] KVM: Make use of is_large_pte() instead Gui Jianfeng
2010-04-16  9:18 ` [PATCH 3/4] KVM: Remove unused varialbe in rmap_next() Gui Jianfeng
2010-04-16  9:19 ` [PATCH 4/4] KVM: Get rid of dead function Gui Jianfeng
2010-04-21  9:03 ` [PATCH 1/4] KVM: Move first pte address calculation out of loop to save some cycles Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.