* Is there shadow page table cache during context switch?
@ 2010-07-08 19:27 Gu, Zhongshu
2010-07-10 11:55 ` Xiao Guangrong
0 siblings, 1 reply; 4+ messages in thread
From: Gu, Zhongshu @ 2010-07-08 19:27 UTC (permalink / raw)
To: kvm
Hi all:
Recently i am looking at the code of the implementation of
shadow page table of kvm. There is one thing that i am confused. Is
there implementation for caching the shadow page table during context
switch? From the code, when there is action of setting cr3 in the
guest os, it will call new_cr3 which will free the mmu roots. When
entering the guest again, because the root pages are invalid page now,
it will load mmu and allocate roots again. So for every context
switch, the shadow page table will be re-constructed. Is that right?
Thanks
--
Zhongshu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is there shadow page table cache during context switch?
2010-07-08 19:27 Is there shadow page table cache during context switch? Gu, Zhongshu
@ 2010-07-10 11:55 ` Xiao Guangrong
2010-07-10 13:11 ` Gu, Zhongshu
0 siblings, 1 reply; 4+ messages in thread
From: Xiao Guangrong @ 2010-07-10 11:55 UTC (permalink / raw)
To: Gu, Zhongshu; +Cc: kvm
Gu, Zhongshu wrote:
> Hi all:
> Recently i am looking at the code of the implementation of
> shadow page table of kvm. There is one thing that i am confused. Is
> there implementation for caching the shadow page table during context
> switch? From the code, when there is action of setting cr3 in the
> guest os, it will call new_cr3 which will free the mmu roots. When
> entering the guest again, because the root pages are invalid page now,
> it will load mmu and allocate roots again. So for every context
> switch, the shadow page table will be re-constructed. Is that right?
>
Generally, The old mmu root is not freed, is still in shadow page cache,
then when the guest switch to the old root, it can find the corresponding
shadow page form the cache, unless the old root's shadow page is invalid
(it's zapped for the shadow page number control)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is there shadow page table cache during context switch?
2010-07-10 11:55 ` Xiao Guangrong
@ 2010-07-10 13:11 ` Gu, Zhongshu
2010-07-11 12:12 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Gu, Zhongshu @ 2010-07-10 13:11 UTC (permalink / raw)
To: Xiao Guangrong; +Cc: kvm
On Sat, Jul 10, 2010 at 7:55 AM, Xiao Guangrong
<xiaoguangrong@cn.fujitsu.com> wrote:
>
>
> Gu, Zhongshu wrote:
>> Hi all:
>> Recently i am looking at the code of the implementation of
>> shadow page table of kvm. There is one thing that i am confused. Is
>> there implementation for caching the shadow page table during context
>> switch? From the code, when there is action of setting cr3 in the
>> guest os, it will call new_cr3 which will free the mmu roots. When
>> entering the guest again, because the root pages are invalid page now,
>> it will load mmu and allocate roots again. So for every context
>> switch, the shadow page table will be re-constructed. Is that right?
>>
>
> Generally, The old mmu root is not freed, is still in shadow page cache,
> then when the guest switch to the old root, it can find the corresponding
> shadow page form the cache, unless the old root's shadow page is invalid
> (it's zapped for the shadow page number control)
>
Thank you for your answer. There is another thing that i am not sure.
Is there any mechanism in the kvm to make sure that it will zap the
mmu root's pages if the process that use this root has terminated in
the guest? Or does it just use kvm_mmu_free_some_pages to make sure
that the number of free mmu pages is above the specified limit?
Thanks
--
Zhongshu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is there shadow page table cache during context switch?
2010-07-10 13:11 ` Gu, Zhongshu
@ 2010-07-11 12:12 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-07-11 12:12 UTC (permalink / raw)
To: Gu, Zhongshu; +Cc: Xiao Guangrong, kvm
On 07/10/2010 04:11 PM, Gu, Zhongshu wrote:
>
> Thank you for your answer. There is another thing that i am not sure.
> Is there any mechanism in the kvm to make sure that it will zap the
> mmu root's pages if the process that use this root has terminated in
> the guest? Or does it just use kvm_mmu_free_some_pages to make sure
> that the number of free mmu pages is above the specified limit?
>
The root will not be zapped on process termination (kvm is not aware of
guest processes). However, if the page is written to several times
without being used, kvm will unshadow the page.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-11 12:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-08 19:27 Is there shadow page table cache during context switch? Gu, Zhongshu
2010-07-10 11:55 ` Xiao Guangrong
2010-07-10 13:11 ` Gu, Zhongshu
2010-07-11 12:12 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox