linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <dwg@au1.ibm.com>
To: Simon Jeons <simon.jeons@gmail.com>
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	paulus@samba.org
Subject: Re: [PATCH -V7 18/18] powerpc: Update tlbie/tlbiel as per ISA doc
Date: Wed, 1 May 2013 21:36:43 +1000	[thread overview]
Message-ID: <20130501113643.GA13041@truffula.fritz.box> (raw)
In-Reply-To: <5180C9BE.5040002@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4123 bytes --]

On Wed, May 01, 2013 at 03:52:30PM +0800, Simon Jeons wrote:
> On 05/01/2013 03:47 PM, Aneesh Kumar K.V wrote:
> >David Gibson <dwg@au1.ibm.com> writes:
> >
> >>On Tue, Apr 30, 2013 at 10:51:00PM +0530, Aneesh Kumar K.V wrote:
> >>>David Gibson <dwg@au1.ibm.com> writes:
> >>>
> >>>>On Mon, Apr 29, 2013 at 01:07:39AM +0530, Aneesh Kumar K.V wrote:
> >>>>>From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> >>>>>
> >>>>>Encode the actual page correctly in tlbie/tlbiel. This make sure we handle
> >>>>>multiple page size segment correctly.
> >>>>As mentioned in previous comments, this commit message needs to give
> >>>>much more detail about what precisely the existing implementation is
> >>>>doing wrong.
> >>>>
> >>>>>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> >>>>>---
> >>>>>  arch/powerpc/mm/hash_native_64.c | 32 ++++++++++++++++++++++++++++++--
> >>>>>  1 file changed, 30 insertions(+), 2 deletions(-)
> >>>>>
> >>>>>diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
> >>>>>index bb920ee..6a2aead 100644
> >>>>>--- a/arch/powerpc/mm/hash_native_64.c
> >>>>>+++ b/arch/powerpc/mm/hash_native_64.c
> >>>>>@@ -61,7 +61,10 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize)
> >>>>>  	switch (psize) {
> >>>>>  	case MMU_PAGE_4K:
> >>>>>+		/* clear out bits after (52) [0....52.....63] */
> >>>>>+		va &= ~((1ul << (64 - 52)) - 1);
> >>>>>  		va |= ssize << 8;
> >>>>>+		va |= mmu_psize_defs[apsize].sllp << 6;
> >>>>>  		asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2)
> >>>>>  			     : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206)
> >>>>>  			     : "memory");
> >>>>>@@ -69,9 +72,20 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize)
> >>>>>  	default:
> >>>>>  		/* We need 14 to 14 + i bits of va */
> >>>>>  		penc = mmu_psize_defs[psize].penc[apsize];
> >>>>>-		va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
> >>>>>+		va &= ~((1ul << mmu_psize_defs[apsize].shift) - 1);
> >>>>>  		va |= penc << 12;
> >>>>>  		va |= ssize << 8;
> >>>>>+		/* Add AVAL part */
> >>>>>+		if (psize != apsize) {
> >>>>>+			/*
> >>>>>+			 * MPSS, 64K base page size and 16MB parge page size
> >>>>>+			 * We don't need all the bits, but rest of the bits
> >>>>>+			 * must be ignored by the processor.
> >>>>>+			 * vpn cover upto 65 bits of va. (0...65) and we need
> >>>>>+			 * 58..64 bits of va.
> >>>>I can't understand what this comment is saying.  Why do we need to do
> >>>>something different in the psize != apsize case?
> >>>>
> >>>>>+			 */
> >>>>>+			va |= (vpn & 0xfe);
> >>>>>+		}
> >>>That is as per ISA doc. It says if base page size == actual page size,
> >>>(RB)56:62 must be zeros, which must be ignored by the processor.
> >>>Otherwise it should be filled with the selected bits of VA as explained above.
> >>What you've just said here makes much more sense than what's written
> >>in the comment in the code.
> >>
> >>>We only support MPSS with base page size = 64K and actual page size = 16MB.
> >>Is that actually relevant to this code though?
> >In a way yes. The number of bits we we select out of VA depends on the
> >base page size and actual page size. We have a math around that
> >documented in ISA. Now since we support only 64K and 16MB we can make it
> >simpler by only selecting required bits and not making it a
> >function. But then it is also not relevant to the code in that ISA also
> >state other bits in (RB)56:62 must be zero. I wanted to capture both the
> >details in the comment.
> 
> What's the benefit of ppc use hash-based page table instead of
> tree-based page table? If you said that hash is faster, could x86
> change to it?

Complex and debatable at best.  But in any case it's a fixed property
of the CPU, not something that can be changed in software.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2013-05-01 12:08 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28 19:37 [PATCH -V7 00/18] THP support for PPC64 (Patchset 1) Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 01/18] mm/THP: HPAGE_SHIFT is not a #define on some arch Aneesh Kumar K.V
2013-04-30  2:21   ` David Gibson
2013-04-30  2:24     ` David Gibson
2013-04-30  3:42     ` Aneesh Kumar K.V
2013-04-30  5:01       ` David Gibson
2013-05-03 18:51         ` Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 02/18] mm/THP: Add pmd args to pgtable deposit and withdraw APIs Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 03/18] mm/THP: withdraw the pgtable after pmdp related operations Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 04/18] powerpc: Use signed formatting when printing error Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 05/18] powerpc: Save DAR and DSISR in pt_regs on MCE Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 06/18] powerpc: Don't hard code the size of pte page Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 07/18] powerpc: Don't truncate pgd_index wrongly Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 08/18] powerpc: New hugepage directory format Aneesh Kumar K.V
2013-04-30  5:16   ` David Gibson
2013-04-28 19:37 ` [PATCH -V7 09/18] powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format Aneesh Kumar K.V
2013-04-30  5:17   ` David Gibson
2013-06-06 22:42   ` Scott Wood
2013-06-07  3:55     ` Aneesh Kumar K.V
2013-06-07 19:17       ` Scott Wood
2013-06-08 16:57         ` Aneesh Kumar K.V
2013-06-11 20:53           ` Scott Wood
2013-06-11 22:50             ` Scott Wood
2013-06-12  6:30               ` Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 10/18] powerpc: Reduce the PTE_INDEX_SIZE Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 11/18] powerpc: Move the pte free routines from common header Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 12/18] powerpc: Reduce PTE table memory wastage Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 13/18] powerpc: Use encode avpn where we need only avpn values Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 14/18] powerpc: Decode the pte-lp-encoding bits correctly Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 15/18] powerpc: Fix hpte_decode to use the correct decoding for page sizes Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 16/18] powerpc: print both base and actual page size on hash failure Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 17/18] powerpc: Print page size info during boot Aneesh Kumar K.V
2013-04-28 19:37 ` [PATCH -V7 18/18] powerpc: Update tlbie/tlbiel as per ISA doc Aneesh Kumar K.V
2013-04-30  6:15   ` David Gibson
2013-04-30 17:21     ` Aneesh Kumar K.V
2013-05-01  5:26       ` David Gibson
2013-05-01  7:47         ` Aneesh Kumar K.V
2013-05-01  7:52           ` Simon Jeons
2013-05-01 11:36             ` David Gibson [this message]
2013-05-02  5:23           ` David Gibson

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=20130501113643.GA13041@truffula.fritz.box \
    --to=dwg@au1.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=simon.jeons@gmail.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;
as well as URLs for NNTP newsgroup(s).