[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100714140626.GA28485@amt.cnet>
Date: Wed, 14 Jul 2010 11:06:26 -0300
From: Marcelo Tosatti <mtosatti@...hat.com>
To: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
Cc: Avi Kivity <avi@...hat.com>, LKML <linux-kernel@...r.kernel.org>,
KVM list <kvm@...r.kernel.org>
Subject: Re: [PATCH 3/4] KVM: MMU: track dirty page in speculative path
properly
On Wed, Jul 14, 2010 at 09:18:58PM +0800, Xiao Guangrong wrote:
>
>
> Marcelo Tosatti wrote:
> > On Wed, Jul 14, 2010 at 09:24:22AM +0800, Xiao Guangrong wrote:
> >>
> >> Marcelo Tosatti wrote:
> >>> On Tue, Jul 13, 2010 at 05:45:27PM +0800, Xiao Guangrong wrote:
> >>>> In speculative path, the page is not real write-access, no need mark it
> >>>> dirty, so clear dirty bit in this path and later examine this bit when
> >>>> we release the page
> >>>>
> >>>> Signed-off-by: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
> >>>> ---
> >>>> arch/x86/kvm/mmu.c | 24 +++++++++++-------------
> >>>> 1 files changed, 11 insertions(+), 13 deletions(-)
> >>> Unfortunately all pages that kvm creates translations for are marked
> >>> dirty due to get_user_pages(w=1), except KSM which makes them read-only
> >>> later.
> >> Marcelo, i have looked into get_user_pages() function, but not catch where
> >> to make page dirty, could you point it out for me? :-)
> >
> > See set_page_dirty call in mm/memory.c::follow_page.
>
> Yeah, you are right, and i want to use another way to do it since track dirty bit
> is too heavy, also it's dangerous if we miss to set page dirty.
>
> How about just track access bit for speculative path, we set page both accessed and
> dirty(if it's writable) only if the access bit is set?
A useful thing to do would be to allow read-only mappings, in the fault
path (Lai sent a few patches in that direction sometime ago but there
was no follow up).
So in the case of a read-only fault from the guest, you'd inform
get_user_pages() that read-only access is acceptable (so swapcache pages
can be mapped, or qemu can mprotect(PROT_READ) guest memory).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists