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 -V3 03/11] arch/powerpc: Convert virtual address to vpn
Date: Mon, 23 Jul 2012 11:24:37 +0530 [thread overview]
Message-ID: <87ipdfhvj6.fsf@skywalker.in.ibm.com> (raw)
In-Reply-To: <20120722234203.GC17790@bloggs.ozlabs.ibm.com>
Paul Mackerras <paulus@samba•org> writes:
> On Mon, Jul 09, 2012 at 06:43:33PM +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.
>
> Some comments inline below...
>
>> +/*
>> + * encode page number shift.
>> + * Inorder to fit the 78 bit va in a 64 bit variable we shift the va by
> ^ "in order"
>
>> + * 12 bits. This enable us to address upto 76 bit va.
> ^ "up to"
>
>> + * For hpt hash from a va we can ignore the page size bits of va and for
>> + * hpte encoding we ignore upto 23 bits of va. So ignoring lower 12 bits ensure
>> + * we work in all cases including 4k page size.
>> + */
>> +#define VPN_SHIFT 12
>
> This can't be more than 12 bits because we sometimes use 4k pages even
> in a kernel configured for 64k pages (e.g. with the subpage_protection
> system call).
Yes, I wanted to make that explicit, ie this is not a virtual page
number and hence all these BUG_ON. I actually updated few of them
to BUILD_BUG_ON() based of earlier review.
>
>> +static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,
>> + int ssize)
>> +{
>> + unsigned long v;
>> + /*
>> + * The AVA field omits the low-order 23 bits of the 78 bits VA.
>> + * These bits are not needed in the PTE, because the
>> + * low-order b of these bits are part of the byte offset
>> + * into the virtual page and, if b < 23, the high-order
>> + * 23-b of these bits are always used in selecting the
>> + * PTEGs to be searched
>> + */
>> + BUG_ON(VPN_SHIFT > 23);
>
> I don't think we need this. If VPN_SHIFT was computed by some complex
> expression whose value is not obvious, then BUG_ON (or BUILD_BUG_ON)
> would be appropriate, but since it's just a #define, a comment at the
> site of the definition will suffice.
>
>> static inline unsigned long hpt_hash(unsigned long va, unsigned int shift,
>> int ssize)
>> {
>> + int mask;
>> unsigned long hash, vsid;
>>
>> + BUG_ON(shift < VPN_SHIFT);
>
> So VPN_SHIFT can be at most 12, since 12 is the smallest shift value
> possible here.
>
>> -static inline void __tlbiel(unsigned long va, int psize, int ssize)
>> +static inline void __tlbiel(unsigned long vpn, int psize, int ssize)
>> {
>> + unsigned long va;
>> unsigned int penc;
>>
>> + BUG_ON((77 - 65) > VPN_SHIFT);
>> + va = vpn << VPN_SHIFT;
>
> So VPN_SHIFT has to be at least 12. What is the significance of 77
> and 65 here?
>
It is the other way around . I updated that in 77guccfav.fsf@skywalker•in.ibm.com
BUILD_BUG_ON(VPN_SHIFT > (77 - 65));
tlbiel says we can only ignore bits above 65 of va. hence the math of 77- 65.
-aneesh
next prev parent reply other threads:[~2012-07-23 5:54 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 13:13 [PATCH -V3 0/11] arch/powerpc: Add 64TB support to ppc64 Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 01/11] arch/powerpc: Use hpt_va to compute virtual address Aneesh Kumar K.V
2012-07-22 23:17 ` Paul Mackerras
2012-07-09 13:13 ` [PATCH -V3 02/11] arch/powerpc: Simplify hpte_decode Aneesh Kumar K.V
2012-07-22 23:26 ` Paul Mackerras
2012-07-23 5:41 ` Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 03/11] arch/powerpc: Convert virtual address to vpn Aneesh Kumar K.V
2012-07-09 22:41 ` Stephen Rothwell
2012-07-10 6:12 ` Aneesh Kumar K.V
2012-07-09 23:06 ` Stephen Rothwell
2012-07-10 6:15 ` Aneesh Kumar K.V
2012-07-22 23:42 ` Paul Mackerras
2012-07-23 5:54 ` Aneesh Kumar K.V [this message]
2012-07-09 13:13 ` [PATCH -V3 04/11] arch/powerpc: Rename va " Aneesh Kumar K.V
2012-07-22 23:46 ` Paul Mackerras
2012-07-23 6:14 ` Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 05/11] arch/powerpc: remove masking top 16 bit of va in tlb invalidate Aneesh Kumar K.V
2012-07-22 23:56 ` Paul Mackerras
2012-07-23 1:22 ` Benjamin Herrenschmidt
2012-07-23 3:49 ` Paul Mackerras
2012-07-23 6:44 ` Aneesh Kumar K.V
2012-07-23 6:48 ` Benjamin Herrenschmidt
2012-07-09 13:13 ` [PATCH -V3 06/11] arch/powerpc: Make KERN_VIRT_SIZE not dependend on PGTABLE_RANGE Aneesh Kumar K.V
2012-07-22 23:57 ` Paul Mackerras
2012-07-09 13:13 ` [PATCH -V3 07/11] arch/powerpc: Increase the slice range to 64TB Aneesh Kumar K.V
2012-07-23 0:00 ` Paul Mackerras
2012-07-23 7:13 ` Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 08/11] arch/powerpc: Make some of the PGTABLE_RANGE dependency explicit Aneesh Kumar K.V
2012-07-23 0:20 ` Paul Mackerras
2012-07-23 7:29 ` Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 09/11] arch/powerpc: Use 50 bits of VSID in slbmte Aneesh Kumar K.V
2012-07-23 0:06 ` Paul Mackerras
2012-07-23 8:21 ` Aneesh Kumar K.V
2012-07-23 9:36 ` Paul Mackerras
2012-07-23 10:22 ` Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 10/11] arch/powerpc: Use 32bit array for slb cache Aneesh Kumar K.V
2012-07-23 0:27 ` Paul Mackerras
2012-07-23 8:25 ` Aneesh Kumar K.V
2012-07-09 13:13 ` [PATCH -V3 11/11] arch/powerpc: Add 64TB support Aneesh Kumar K.V
2012-07-23 0:15 ` Paul Mackerras
2012-07-23 8:49 ` Aneesh Kumar K.V
2012-07-23 9:39 ` Paul Mackerras
2012-07-23 10:22 ` Aneesh Kumar K.V
2012-07-23 11:06 ` Paul Mackerras
2012-07-24 8:37 ` Aneesh Kumar K.V
2012-07-24 9:14 ` Aneesh Kumar K.V
2012-07-24 19:50 ` Aneesh Kumar K.V
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=87ipdfhvj6.fsf@skywalker.in.ibm.com \
--to=aneesh.kumar@linux$(echo .)vnet.ibm.com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=paulus@samba$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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