[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F753E3B.4040308@linux.vnet.ibm.com>
Date: Fri, 30 Mar 2012 13:01:47 +0800
From: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
To: Avi Kivity <avi@...hat.com>
CC: Marcelo Tosatti <mtosatti@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH 04/13] KVM: MMU: introduce FNAME(get_sp_gpa)
On 03/29/2012 09:07 PM, Avi Kivity wrote:
> On 03/29/2012 11:22 AM, Xiao Guangrong wrote:
>> It can calculate the base gpa of the specified shadow page on any level,
>> let it instead of FNAME(get_level1_sp_gpa)
>>
>>
>> +static gpa_t FNAME(get_sp_gpa)(struct kvm_mmu_page *sp)
>> +{
>
> Maybe worth adding a pte index and calling it get_spte_gpa(), depends on
> the next patches I guess.
>
Yes.
But FNAME(get_sp_gpa) is still needed by FNAME(sync_page) path which sync
all sptes. I will introduce get_spte_gpa() as you mentioned which will be
used in invlpg path and in the later patch.
>> + int offset, shift;
>> +
>> + shift = PAGE_SHIFT - (PT_LEVEL_BITS - PT64_LEVEL_BITS) * sp->role.level;
>> + offset = sp->role.quadrant << shift;
>
> if you add '& ~PAGE_MASK' the compiler may be smart enough to drop the
> whole thing for 64-bit ptes.
>
Sorry. how to do that?
But if you want to remove the unnecessary workload, i will change it
like this:
static gpa_t FNAME(get_sp_gpa)(struct kvm_mmu_page *sp)
{
int offset = 0;
#if PTTYPE == 32
int shift;
shift = PAGE_SHIFT - (PT_LEVEL_BITS - PT64_LEVEL_BITS) * sp->role.level;
offset = sp->role.quadrant << shift;
#endif
return gfn_to_gpa(sp->gfn) + offset;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists