[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55F3DD01.9020507@c-s.fr>
Date: Sat, 12 Sep 2015 10:06:25 +0200
From: christophe leroy <christophe.leroy@....fr>
To: Scott Wood <scottwood@...escale.com>,
Michael Ellerman <mpe@...erman.id.au>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>, sojkam1@....cvut.cz,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v3] powerpc32: memcpy: only use dcbz once cache is enabled
Le 11/09/2015 23:35, Scott Wood a écrit :
> On Fri, 2015-09-11 at 16:33 +0200, Christophe Leroy wrote:
>> memcpy() uses instruction dcbz to speed up copy by not wasting time
>> loading cache line with data that will be overwritten.
>> Some platform like mpc52xx do no have cache active at startup and
>> can therefore not use memcpy(). Allthough no part of the code
>> explicitly uses memcpy(), GCC makes calls to it.
>>
>> This patch modifies memcpy() such that at startup, memcpy()
>> unconditionally jumps to generic_memcpy() which doesn't use
>> the dcbz instruction.
>>
>> Once the initial MMU is set up, in machine_init() we patch memcpy()
>> by replacing this inconditional jump by a NOP
>>
>> Reported-by: Michal Sojka <sojkam1@....cvut.cz>
>> Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
>> ---
>> changes in v2:
>> Using feature-fixups instead of hardcoded call to patch_instruction()
>> Handling of memset() added
>> changes in v3:
>> Not using anymore feature-fixups
>> Handling of memset() removed
> Why was handling of memset() removed?
>
>
Initially, the issue was reported for memcpy() only. v1 was only
handling memcpy()
When it came to using fixups with v2, it took the opportunity to also
handle memset() just in case, as it was quite simple.
Now with v3, we are back to using simple solution with
patch_instruction() as recommended by Michael, having to point to the
instruction to be replaced by a NOP.
For memcpy() it is quite easy, we just put a jump to generic_memcpy() as
first instruction of memcpy().
For memset() we don't have a generic_memset() to jump to in the begining
of memset(). We have to skip the handling of complete cache lines (block
starting with "clrlwi r7,r6,32-LG_CACHELINE_BYTES"). This means we
have to add a global symbol for that to use with patch_instruction()
memset() doesn't seem to be an issue for the time being. Should we do it
anyway ?
Christophe
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists