From: Avi Kivity <avi@redhat.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, KVM list <kvm@vger.kernel.org>
Subject: mmu_notifers, pte_dirty questions
Date: Sun, 06 Jun 2010 15:07:27 +0300 [thread overview]
Message-ID: <4C0B8F7F.507@redhat.com> (raw)
Why no notifer when testing and clearing the dirty bit?
(*clear_flush_dirty)(...).
> static int page_mkclean_one(struct page *page, struct vm_area_struct *vma,
> unsigned long address)
> {
> struct mm_struct *mm = vma->vm_mm;
> pte_t *pte;
> spinlock_t *ptl;
> int ret = 0;
>
> pte = page_check_address(page, mm, address, &ptl, 1);
> if (!pte)
> goto out;
>
> if (pte_dirty(*pte) || pte_write(*pte)) {
> pte_t entry;
>
> flush_cache_page(vma, address, pte_pfn(*pte));
> entry = ptep_clear_flush_notify(vma, address, pte);
> entry = pte_wrprotect(entry);
> entry = pte_mkclean(entry);
> set_pte_at(mm, address, pte, entry);
set_pte_at_notify()? without this (or clear_flush_dirty) Linux will
assume all ptes are now clean; if the guest writes to a page nothing
will catch it.
-> with set_pte_at_notify(), we can drop the spte and mark the page as
dirty, so the next write will re-instantiate the spte
-> with ->clear_flush_dirty(), we can track the dirty state without
dropping the spte.
> ret = 1;
> }
>
> pte_unmap_unlock(pte, ptl);
> out:
> return ret;
I'm probably missing something big as I can't see how this works.
--
error compiling committee.c: too many arguments to function
next reply other threads:[~2010-06-06 12:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-06 12:07 Avi Kivity [this message]
2010-06-06 18:36 ` mmu_notifers, pte_dirty questions Andrea Arcangeli
2010-06-07 5:09 ` 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=4C0B8F7F.507@redhat.com \
--to=avi@redhat.com \
--cc=aarcange@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox