Messages in this thread | | | Date | Fri, 23 Apr 2010 15:11:34 +0300 | From | Avi Kivity <> | Subject | Re: [PATCH 1/10] KVM MMU: fix for calculating gpa in invlpg code |
| |
On 04/23/2010 03:05 PM, Xiao Guangrong wrote: > > >>> @@ -478,9 +478,14 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, >>> gva_t gva) >>> ((level == PT_DIRECTORY_LEVEL&& is_large_pte(*sptep))) || >>> ((level == PT_PDPE_LEVEL&& is_large_pte(*sptep)))) { >>> struct kvm_mmu_page *sp = page_header(__pa(sptep)); >>> + int offset = 0; >>> + >>> + if (PTTYPE == 32) >>> + offset = sp->role.quadrant<< PT64_LEVEL_BITS;; >>> >>> >> Wrong for PT_DIRECTORY_LEVEL (should be q<< 8). Also, too many >> semicolons. >> >> > I guess you mean 'PT64_LEVEL_BITS' not 'PT_DIRECTORY_LEVEL' here :-) >
No, I mean if level == PT_DIRECTORY_LEVEL, then we want role.quadrant << 8, not 9.
> It should be q<< 8 here? it hardly understand, take leve = 1 for example, > 32-bit guest PTE page table mapping range is 2^(10+12), PAE's PTE page table > mapping range is 2^(9+12),
For level == PT_DIRECTORY_LEVEL, quadrant is in the range 0..3. Each sp maps 1GB, while the guest page table maps 4GB. So the upper two bits become the quadrant.
> so, i think it's quadrant<< 9 here, and other > function like FNAME(prefetch_page), FNAME(sync_page) also are q<< 9 >
They only work for PT_PAGE_TABLE_LEVEL, so for them 9 is correct.
-- Do not meddle in the internals of kernels, for they are subtle and quick to panic.
| |