lkml.org 
[lkml]   [2010]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/11] KVM: MMU: fix direct sp's access corruptted
On Thu, Jul 01, 2010 at 08:50:58AM +0800, Xiao Guangrong wrote:
>
>
> Marcelo Tosatti wrote:
>
> >> - if (is_shadow_present_pte(*sptep) && !is_large_pte(*sptep))
> >> - continue;
> >> + if (is_shadow_present_pte(*sptep) && !is_large_pte(*sptep)) {
> >> + struct kvm_mmu_page *child;
> >> + unsigned direct_access;
> >> +
> >> + if (level != gw->level)
> >> + continue;
> >
> > This will skip the check for the sp at level 1 when emulating 1GB pages
> > with 4k host pages (where there are direct sp's at level 2 and 1).
> > Should be > instead of !=.
> >
>
> Marcelo,
>
> I think the patch is right.
>
> Every level's direct sp has the same access in the mapping since while we setup the
> mapping we find the direct sp with the same access.
> (Note: we have encode the D bit to the sp->role.access)
>
> Consider guest 1G writable clean pages and host 4K pages, the shadow pages mapping
> is like this:
>
> indirect L4 --> indirect L3 --> direct ReadOnly L2 --> direct ReadOnly L1
>
> When change guest pte to dirty, we update L3' spte and find the direct writable L2 sp,
> assume it's A, then we can sure that A's children sps should also writable, the final
> mapping is like this:
>
> indirect L4 --> indirect L3 --> direct Writable L2 --> direct Writable L1.
>
> So, i think we not broken anything in this patch :-)

You're right. Applied.


\
 
 \ /
  Last update: 2010-07-01 14:11    [W:0.034 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site