All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
To: gleb@redhat.com, pbonzini@redhat.com, mtosatti@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH 1/3] KVM: MMU: Clean up set_spte()'s ACC_WRITE_MASK handling
Date: Thu, 9 May 2013 15:44:33 +0900	[thread overview]
Message-ID: <20130509154433.d8b62a0f.yoshikawa_takuya_b1@lab.ntt.co.jp> (raw)
In-Reply-To: <20130509154350.15b956c4.yoshikawa_takuya_b1@lab.ntt.co.jp>

Rather than clearing the ACC_WRITE_MASK bit of pte_access in the
"if (mmu_need_write_protect())" block not to call mark_page_dirty() in
the following if statement, simply moving the call into the appropriate
else block is better.

Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
---
 arch/x86/kvm/mmu.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 004cc87..08119a8 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2386,14 +2386,11 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
 			pgprintk("%s: found shadow page for %llx, marking ro\n",
 				 __func__, gfn);
 			ret = 1;
-			pte_access &= ~ACC_WRITE_MASK;
 			spte &= ~(PT_WRITABLE_MASK | SPTE_MMU_WRITEABLE);
-		}
+		} else
+			mark_page_dirty(vcpu->kvm, gfn);
 	}
 
-	if (pte_access & ACC_WRITE_MASK)
-		mark_page_dirty(vcpu->kvm, gfn);
-
 set_pte:
 	if (mmu_spte_update(sptep, spte))
 		kvm_flush_remote_tlbs(vcpu->kvm);
-- 
1.7.5.4


  reply	other threads:[~2013-05-09  6:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09  6:43 [PATCH 0/3] KVM: MMU: Simple mmu cleanups Takuya Yoshikawa
2013-05-09  6:44 ` Takuya Yoshikawa [this message]
2013-05-09 10:16   ` [PATCH 1/3] KVM: MMU: Clean up set_spte()'s ACC_WRITE_MASK handling Xiao Guangrong
2013-05-09 11:18     ` Gleb Natapov
2013-05-09 12:16       ` Xiao Guangrong
2013-05-10  1:33         ` Takuya Yoshikawa
2013-05-09  6:45 ` [PATCH 2/3] KVM: MMU: Use kvm_mmu_sync_roots() in kvm_mmu_load() Takuya Yoshikawa
2013-05-09 10:18   ` Xiao Guangrong
2013-05-12 11:53   ` Gleb Natapov
2013-05-09  6:46 ` [PATCH 3/3] KVM: MMU: Consolidate common code in mmu_free_roots() Takuya Yoshikawa
2013-05-09 10:11   ` Xiao Guangrong
2013-05-10  1:05     ` Takuya Yoshikawa
2013-05-10  1:43       ` Xiao Guangrong
2013-05-13 11:24         ` Gleb Natapov
2013-05-13 13:02           ` Xiao Guangrong
2013-05-13 13:20             ` Takuya Yoshikawa

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=20130509154433.d8b62a0f.yoshikawa_takuya_b1@lab.ntt.co.jp \
    --to=yoshikawa_takuya_b1@lab.ntt.co.jp \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    /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 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.