public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	KVM list <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/10] KVM MMU: fix for calculating gpa in invlpg code
Date: Fri, 23 Apr 2010 15:11:34 +0300	[thread overview]
Message-ID: <4BD18E76.5000708@redhat.com> (raw)
In-Reply-To: <4BD18CFD.4090102@cn.fujitsu.com>

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.


  reply	other threads:[~2010-04-23 12:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4BCFE3D5.5070105@cn.fujitsu.com>
2010-04-22  6:12 ` [PATCH 1/10] KVM MMU: fix for calculating gpa in invlpg code Xiao Guangrong
2010-04-23 11:23   ` Avi Kivity
2010-04-23 12:05     ` Xiao Guangrong
2010-04-23 12:11       ` Avi Kivity [this message]
2010-04-22  6:12 ` [PATCH 2/10] KVM MMU: convert mmu tracepoints Xiao Guangrong
2010-04-22  6:12 ` [PATCH 3/10] KVM MMU: move unsync/sync tracpoints to proper place Xiao Guangrong
2010-04-22  6:12 ` [PATCH 4/10] KVM MMU: Move invlpg code out of paging_tmpl.h Xiao Guangrong
2010-04-23 11:27   ` Avi Kivity
2010-04-23 11:43     ` Avi Kivity
2010-04-23 13:21       ` Xiao Guangrong
2010-04-23 13:27         ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD18E76.5000708@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=xiaoguangrong@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox