linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Scott Wood <scottwood@freescale.com>
Cc: Christophe LEROY <christophe.leroy@c-s.fr>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	sojkam1@fel.cvut.cz, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3] powerpc32: memset: only use dcbz once cache is enabled
Date: Tue, 15 Sep 2015 09:52:15 +1000	[thread overview]
Message-ID: <1442274735.6342.1.camel@ellerman.id.au> (raw)
In-Reply-To: <1442247213.2909.71.camel@freescale.com>

On Mon, 2015-09-14 at 11:13 -0500, Scott Wood wrote:
> On Mon, 2015-09-14 at 17:44 +0200, Christophe LEROY wrote:
> > Le 14/09/2015 17:20, Scott Wood a écrit :
> > > On Mon, 2015-09-14 at 08:21 +0200, Christophe Leroy wrote:
> > > > diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
> > > > index da5847d..68a59d4 100644
> > > > --- a/arch/powerpc/lib/copy_32.S
> > > > +++ b/arch/powerpc/lib/copy_32.S
> > > > @@ -73,8 +73,13 @@ CACHELINE_MASK = (L1_CACHE_BYTES-1)
> > > > @@ -122,6 +127,16 @@ _GLOBAL(memset)
> > > >        bdnz    8b
> > > >        blr
> > > >   
> > > > +/* Simple version of memset used during early boot until cache is 
> > > > enabled
> > > > */
> > > > +simple_memset:
> > > > +     cmplwi  cr0,r5,0
> > > > +     addi    r6,r3,-1
> > > > +     beqlr
> > > > +     mtctr   r5
> > > > +1:   stbu    r4,1(r6)
> > > > +     bdnz    1b
> > > > +     blr
> > > Instead couldn't you use the generic memset at label 2: and patch the "bne
> > > 2f"?
> > 
> > Yes I could but it means adding a global symbol there at the "bne 2f". I 
> > thought it was what Michael didn't like in my v1 of memcpy().
> > What name could I give to that symbol ? Something like 
> > memcpy_nocache_patch: ?
> > What would be the best ? Having b 2f, and replacing it with bne 2f ? Or 
> > have b 2f just above and replace it by nop once cache is up ?
> 
> I'm not sure why a global symbol for an instruction to be patched would be a 
> big deal (similar to kvm_emul.S)...  I thought Michael just wanted existing 
> infrastructure to be used if it's practical to do so.

Yeah, I don't mind adding a global if you need it.

I'm not wedded to either approach, I'm just trying to find the least intrusive
option that uses the most existing code, and is the most maintainable into the
future.

cheers

      reply	other threads:[~2015-09-14 23:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14  6:21 [PATCH v3] powerpc32: memset: only use dcbz once cache is enabled Christophe Leroy
2015-09-14  7:15 ` Michal Sojka
2015-09-14 15:20 ` Scott Wood
2015-09-14 15:44   ` Christophe LEROY
2015-09-14 16:13     ` Scott Wood
2015-09-14 23:52       ` Michael Ellerman [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=1442274735.6342.1.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=scottwood@freescale.com \
    --cc=sojkam1@fel.cvut.cz \
    /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).