From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH -V7 04/12] arch/powerpc: Convert virtual address to vpn
Date: Wed, 05 Sep 2012 20:15:11 +0530 [thread overview]
Message-ID: <87392wcyvc.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120905082629.GB22688@bloggs.ozlabs.ibm.com>
Paul Mackerras <paulus@samba.org> writes:
> On Tue, Sep 04, 2012 at 02:31:21PM +0530, Aneesh Kumar K.V wrote:
>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>>
>> This patch convert different functions to take virtual page number
>> instead of virtual address. Virtual page number is virtual address
>> shifted right by VPN_SHIFT (12) bits. This enable us to have an
>> address range of upto 76 bits.
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>
> A few comments below...
>
>> diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
>> index 1c65a59..d3a1139 100644
>> --- a/arch/powerpc/include/asm/mmu-hash64.h
>> +++ b/arch/powerpc/include/asm/mmu-hash64.h
>> @@ -15,6 +15,10 @@
>> #include <asm/asm-compat.h>
>> #include <asm/page.h>
>>
>> +#ifndef __ASSEMBLY__
>> +#include <linux/bug.h>
>> +#endif
>> +
>
> This is unnecessary, since you haven't added any BUG_ONs or WARN_ONs
> in this file.
>
>> @@ -233,13 +276,19 @@ static inline unsigned long hpt_va(unsigned long ea, unsigned long vsid,
>> static inline unsigned long hpt_hash(unsigned long va, unsigned int shift,
>> int ssize)
>> {
>> + int mask;
>> unsigned long hash, vsid;
>>
>> + /* VPN_SHIFT can be atmost 12 */
>> if (ssize == MMU_SEGSIZE_256M) {
>> - hash = (va >> 28) ^ ((va & 0x0fffffffUL) >> shift);
>> + mask = (1ul << (SID_SHIFT - VPN_SHIFT)) - 1;
>> + hash = ((va >> (SID_SHIFT - VPN_SHIFT)) & 0x0000007fffffffff) ^
>
> You have added the "& 0x0000007fffffffff" part, which is unnecessary
> since the result is anded with that same value before being returned.
>
>> + (((va & mask) >> (shift - VPN_SHIFT)) & 0xffff);
>
> Similarly the "& 0xffff" is completely redundant, since you have anded
> the va (really vpn) with the mask already.
>
>> } else {
>> - vsid = va >> 40;
>> - hash = vsid ^ (vsid << 25) ^ ((va & 0xffffffffffUL) >> shift);
>> + mask = (1ul << (SID_SHIFT_1T - VPN_SHIFT)) - 1;
>> + vsid = va >> (SID_SHIFT_1T - VPN_SHIFT);
>> + hash = (vsid & 0xffffff) ^ ((vsid << 25) & 0x7fffffffff) ^
>
> Here the "vsid & 0xffffff" is actually wrong, since the architecture
> says that this term takes the whole VSID, not just the bottom 24 bits.
> I realise you were copying what happened before, where the VSID was
> restricted to 24 bits anyway because the VA was restricted to 64 bits,
> but now that you are extending the VA size you need to include the
> whole VSID.
>
> As in the previous case, the "& 0x7fffffffff" part is redundant.
Updated the patch with all the above changes.
>
> Also, it's very confusing to review this patch with variables called
> "va" containing vpns. It would actually be easier to review if you
> combined this patch and the following one (that renames va to vpn).
One of the reason i avoided va -> vpn rename is to avoid unnecessary
hunks. But then what i can do is to apply the name to those part of the
hunks which is being touched in this patch. Will that help. Or do you
want me to fold the two patches ?
>
>> + (((va & mask) >> (shift - VPN_SHIFT)) & 0xfffffff);
>
> Once again the "& 0xfffffff" is redundant because the "& mask" has
> already removed any bits that the second and would remove.
>
done
Thanks for the review
-aneesh
next prev parent reply other threads:[~2012-09-05 14:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-04 9:01 [PATCH -V7 0/12] arch/powerpc: Add 64TB support to ppc64 Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 01/12] arch/powerpc: Replace open coded CONTEXT_BITS value Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 02/12] arch/powerpc: Use hpt_va to compute virtual address Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 03/12] arch/powerpc: Simplify hpte_decode Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 04/12] arch/powerpc: Convert virtual address to vpn Aneesh Kumar K.V
2012-09-05 8:26 ` Paul Mackerras
2012-09-05 14:45 ` Aneesh Kumar K.V [this message]
2012-09-06 1:24 ` Paul Mackerras
2012-09-04 9:01 ` [PATCH -V7 05/12] arch/powerpc: Rename va " Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 06/12] arch/powerpc: Make KERN_VIRT_SIZE not dependend on PGTABLE_RANGE Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 07/12] arch/powerpc: Increase the slice range to 64TB Aneesh Kumar K.V
2012-09-05 23:47 ` Paul Mackerras
2012-09-04 9:01 ` [PATCH -V7 08/12] arch/powerpc: Make some of the PGTABLE_RANGE dependency explicit Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 09/12] arch/powerpc: Use the required number of VSID bits in slbmte Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 10/12] arch/powerpc: Use 32bit array for slb cache Aneesh Kumar K.V
2012-09-04 9:01 ` [PATCH -V7 11/12] arch/powerpc: Add 64TB support Aneesh Kumar K.V
2012-09-06 1:21 ` Paul Mackerras
2012-09-04 9:01 ` [PATCH -V7 12/12] arch/powerpc: Update VSID allocation documentation Aneesh Kumar K.V
2012-09-06 1:23 ` Paul Mackerras
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=87392wcyvc.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/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;
as well as URLs for NNTP newsgroup(s).