public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
To: avi@redhat.com, mtosatti@redhat.com
Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, mingo@elte.hu
Subject: [PATCH 3/4] KVM: MMU: Update walker->pt/pte_access directly
Date: Thu, 9 Jun 2011 23:03:52 +0900	[thread overview]
Message-ID: <20110609230352.4cc6fcea.takuya.yoshikawa@gmail.com> (raw)
In-Reply-To: <20110609225949.91cce4a0.takuya.yoshikawa@gmail.com>

From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>

This will help us split out the big body of the walk loop later.

The only functional change is when we return from walk_addr_generic()
with with an error.  The original code did not change these but the new
one may change.  But this should be safe unless callers use these on
that case.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
 arch/x86/kvm/paging_tmpl.h |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 3270789..711336b 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -122,7 +122,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
 {
 	pt_element_t pte;
 	pt_element_t __user *ptep_user;
-	unsigned pt_access, uninitialized_var(pte_access);
 	bool eperm;
 	const int write_fault = access & PFERR_WRITE_MASK;
 	const int user_fault  = access & PFERR_USER_MASK;
@@ -150,7 +149,7 @@ walk:
 	ASSERT((!is_long_mode(vcpu) && is_pae(vcpu)) ||
 	       (mmu->get_cr3(vcpu) & CR3_NONPAE_RESERVED_BITS) == 0);
 
-	pt_access = ACC_ALL;
+	walker->pt_access = ACC_ALL;
 
 	for (;;) {
 		gfn_t real_gfn;
@@ -224,7 +223,8 @@ walk:
 			pte |= PT_ACCESSED_MASK;
 		}
 
-		pte_access = pt_access & FNAME(gpte_access)(vcpu, pte);
+		walker->pte_access = walker->pt_access &
+				     FNAME(gpte_access)(vcpu, pte);
 
 		walker->ptes[walker->level - 1] = pte;
 
@@ -260,7 +260,7 @@ walk:
 			break;
 		}
 
-		pt_access = pte_access;
+		walker->pt_access = walker->pte_access;
 		--walker->level;
 	}
 
@@ -286,10 +286,8 @@ walk:
 		walker->ptes[walker->level - 1] = pte;
 	}
 
-	walker->pt_access = pt_access;
-	walker->pte_access = pte_access;
 	pgprintk("%s: pte %llx pte_access %x pt_access %x\n",
-		 __func__, (u64)pte, pte_access, pt_access);
+		 __func__, (u64)pte, walker->pte_access, walker->pt_access);
 	return 1;
 
 error:
-- 
1.7.4.1


  parent reply	other threads:[~2011-06-09 14:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 13:59 [PATCH 0/4] KVM: MMU: Clean up walk_addr_generic() Takuya Yoshikawa
2011-06-09 14:01 ` [PATCH 1/4] KVM: MMU: Clean up the error handling of walk_addr_generic() Takuya Yoshikawa
2011-06-12 15:45   ` Avi Kivity
2011-06-09 14:02 ` [PATCH 2/4] KVM: MMU: Move some variables into the walk loop Takuya Yoshikawa
2011-06-09 14:03 ` Takuya Yoshikawa [this message]
2011-06-09 14:05 ` [PATCH 4/4] KVM: MMU: Split out the main body of walk_addr_generic() Takuya Yoshikawa
2011-06-09 14:18   ` Ingo Molnar
2011-06-12 15:47     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110609230352.4cc6fcea.takuya.yoshikawa@gmail.com \
    --to=takuya.yoshikawa@gmail.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mtosatti@redhat.com \
    --cc=yoshikawa.takuya@oss.ntt.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox