public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* shadow prefetch
@ 2008-01-02  6:52 Dong, Eddie
       [not found] ` <10EA09EFD8728347A513008B6B0DA77A02976A8E-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dong, Eddie @ 2008-01-02  6:52 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Current shadow code do prefetch in FNAME(prefetch_page), but it is only
used 
to choose shadow_notrap_nonpresent_pte or shadow_trap_nonpresent_pte.

At least for L1 shadow, prefetching to get exact shadow L1 pte won't
cause 
performance regression (though handling time increases slightly ) since
it 
won't generate a new write protected page.

for those L2+ shadow page tables, we can do similar for those pointed
gfn which
is already shadowed.

Comments?
Eddie

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shadow prefetch
       [not found] ` <10EA09EFD8728347A513008B6B0DA77A02976A8E-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2008-01-02  9:51   ` Avi Kivity
       [not found]     ` <477B5E94.30301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2008-01-02  9:51 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dong, Eddie wrote:
> Current shadow code do prefetch in FNAME(prefetch_page), but it is only
> used 
> to choose shadow_notrap_nonpresent_pte or shadow_trap_nonpresent_pte.
>
> At least for L1 shadow, prefetching to get exact shadow L1 pte won't
> cause 
> performance regression (though handling time increases slightly ) since
> it 
> won't generate a new write protected page.
>
>   
I'm not sure that "slightly" is accurate, we need to fetch 512 or 1024 
entries.  On the other hand, we have the benefit of batching (a call to 
get_user_pages() with n = 512 is much faster than 512 calls.  I think 
that this will improve fork()s, but reduce performance with 
sparsely-accessed memory maps, or with fork() followed by exec() 
immediately.

Only benchmarking can tell if it is an overall win.

Xen limits the prefetch to a subset of the pages, maybe that's a better 
approach.


> for those L2+ shadow page tables, we can do similar for those pointed
> gfn which
> is already shadowed

I think L2s are very rare compared to L1 page tables, so any benefit 
would be minor.

-- 
error compiling committee.c: too many arguments to function


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: shadow prefetch
       [not found]     ` <477B5E94.30301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2008-01-02 12:56       ` Dong, Eddie
  0 siblings, 0 replies; 3+ messages in thread
From: Dong, Eddie @ 2008-01-02 12:56 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

>Dong, Eddie wrote:
>> Current shadow code do prefetch in FNAME(prefetch_page), but 
>it is only
>> used 
>> to choose shadow_notrap_nonpresent_pte or shadow_trap_nonpresent_pte.
>>
>> At least for L1 shadow, prefetching to get exact shadow L1 pte won't
>> cause 
>> performance regression (though handling time increases 
>slightly ) since
>> it 
>> won't generate a new write protected page.
>>
>>   
>I'm not sure that "slightly" is accurate, we need to fetch 512 or 1024 
>entries.  On the other hand, we have the benefit of batching 
>(a call to 
>get_user_pages() with n = 512 is much faster than 512 calls.  I think 

Yes, that means we have to copy the guest page to kernel buffer.

>that this will improve fork()s, but reduce performance with 
>sparsely-accessed memory maps, or with fork() followed by exec() 
>immediately.

I saw pf_fixed reduced. Specifically the shadow fault is reduced, but
overal perf gain with kernel build is minor.

>
>Only benchmarking can tell if it is an overall win.
>
>Xen limits the prefetch to a subset of the pages, maybe that's 
>a better 
>approach.
>
>
>> for those L2+ shadow page tables, we can do similar for those pointed
>> gfn which
>> is already shadowed
>
>I think L2s are very rare compared to L1 page tables, so any benefit 
>would be minor.
>
Agree it happens rare.
Eddie

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-02 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-02  6:52 shadow prefetch Dong, Eddie
     [not found] ` <10EA09EFD8728347A513008B6B0DA77A02976A8E-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-01-02  9:51   ` Avi Kivity
     [not found]     ` <477B5E94.30301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-02 12:56       ` Dong, Eddie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox