linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: leroy christophe <christophe.leroy@c-s.fr>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"paulus@samba.org" <paulus@samba.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v3 2/2] powerpc/8xx: use _PAGE_RO instead of _PAGE_RW
Date: Tue, 6 Jan 2015 19:21:06 -0600	[thread overview]
Message-ID: <1420593666.4961.40.camel@freescale.com> (raw)
In-Reply-To: <54AB88C2.7040901@c-s.fr>

On Tue, 2015-01-06 at 08:03 +0100, leroy christophe wrote:
> Le 05/01/2015 19:12, Joakim Tjernlund a écrit :
> > On Mon, 2014-12-22 at 11:14 +0100, Christophe Leroy wrote:
> >> On powerpc 8xx, in TLB entries, 0x400 bit is set to 1 for read-only pages
> >> and is set to 0 for RW pages. So we should use _PAGE_RO instead of _PAGE_RW
> >>
> >> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> > Hi Christophe, been meaning to look over all you recent 8xx MMU/TLB patches
> > but got so little time :(
> >
> > This is very cool (not sure if there will be a performance gain)  but ..
> I think every saved cycle is worth it.
> Before I did any modification:
> * ITLBMiss was 28 instructions.
> * DTLBMiss was 32 instructions.
> Now, (No MODULES, no CPU6, no CPU15):
> * ITLBMiss is 15 instructions
> * DTLBMiss is 24 instructions
> >>
> >>
> >> diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
> >> index caf094a..b4e0c3b 100644
> >> --- a/arch/powerpc/include/asm/pgtable-ppc32.h
> >> +++ b/arch/powerpc/include/asm/pgtable-ppc32.h
> >> @@ -178,9 +178,10 @@ static inline unsigned long pte_update(pte_t *p,
> >>          andc    %1,%0,%5\n\
> >>          or      %1,%1,%6\n\
> >>          /* 0x200 == Extended encoding, bit 22 */ \
> >> -       /* Bit 22 has to be 1 if neither _PAGE_USER nor _PAGE_RW are set */ \
> >> +       /* Bit 22 has to be 1 when _PAGE_USER is unset and _PAGE_RO is set */ \
> >>          rlwimi  %1,%1,32-2,0x200\n /* get _PAGE_USER */ \
> >> -       rlwinm  %3,%1,32-1,0x200\n /* get _PAGE_RW */ \
> >> +       rlwinm  %3,%1,32-1,0x200\n /* get _PAGE_RO */ \
> >> +       xori    %3,%3,0x200\n \
> >>          or      %1,%3,%1\n\
> >>          xori    %1,%1,0x200\n"
> >>   "      stwcx.  %1,0,%4\n\
> > ... here I expected to loose the existing xori insn instead of adding one?
> >
> >
> Well, I could have xored the PAGE_USER bit instead, but in that case, it 
> is not anymore an 'or' but an 'and' that has to be performed between the 
> bits, and then all other bits must be set to 1, or the result of the 
> 'and' shall be inserted using 'rlwimi'. So it would be more 
> modifications than just adding an xori, and not less instructions.

How about "andc %3,%3,%1; rlwimi %1,%3,0,0x200" instead of the "xori,
or, xori" sequence?

-Scott

      parent reply	other threads:[~2015-01-07  1:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 10:14 [PATCH v3 2/2] powerpc/8xx: use _PAGE_RO instead of _PAGE_RW Christophe Leroy
2015-01-05 18:12 ` Joakim Tjernlund
2015-01-06  7:03   ` leroy christophe
2015-01-06 13:05     ` Joakim Tjernlund
2015-01-07  1:21     ` Scott Wood [this message]

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=1420593666.4961.40.camel@freescale.com \
    --to=scottwood@freescale.com \
    --cc=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --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).