public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Izik Eidus <izike@qumranet.com>
To: kvm-devel <kvm-devel@lists.sourceforge.net>,
	Avi Kivity <avi@qumranet.com>
Subject: [PATCH] fixing dirty bit setting for calls of rmap_write_protect
Date: Tue, 12 Feb 2008 18:05:58 +0200	[thread overview]
Message-ID: <47B1C3E6.3050906@qumranet.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]


-- 
woof.


[-- Attachment #2: 0004-KVM-mmu-fixing-dirty-bit-setting-for-calls-of-rmap.patch --]
[-- Type: text/x-patch, Size: 1319 bytes --]

>From 8a849eb0cedacb384676aa7416e8997d89fe9b0f Mon Sep 17 00:00:00 2001
From: Izik Eidus <izike@qumranet.com>
Date: Tue, 12 Feb 2008 17:56:43 +0200
Subject: [PATCH] KVM: mmu: fixing dirty bit setting for calls of rmap_write_protect

when mmu_set_spte is checking if a page related to spte should be release as
dirty or clean,
it check if the shadow pte was writeble, but in case rmap_write_protect get
called it is possible for shadow ptes that were writeble to become readonly
and therefor mmu_set_spte will release the pages of the sptes as clean
and not as dirty.
this patch fix this issue by marking the page as dirty inside rmap_write_protect

Signed-off-by: Izik Eidus <izike@qumranet.com>
---
 arch/x86/kvm/mmu.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 635e70c..83136f2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -520,8 +520,14 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
 		}
 		spte = rmap_next(kvm, rmapp, spte);
 	}
-	if (write_protected)
+	if (write_protected) {
+		struct page *page;
+
+		spte = rmap_next(kvm, rmapp, NULL);
+		page = pfn_to_page((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT);
+		SetPageDirty(page);
 		kvm_flush_remote_tlbs(kvm);
+	}
 }
 
 #ifdef MMU_DEBUG
-- 
1.5.3.6


[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 158 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

                 reply	other threads:[~2008-02-12 16:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47B1C3E6.3050906@qumranet.com \
    --to=izike@qumranet.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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