[PATCH] PowerPC - A2 memcpy cache line size initialization
Ryan S. Arnold
ryan.arnold@gmail.com
Wed Jan 25 17:13:00 GMT 2012
On Tue, Jan 24, 2012 at 10:59 AM, Adhemerval Zanella
<azanella@linux.vnet.ibm.com> wrote:
> The PPC A2 memcpy implementation relies on a correct __cache_line_size value
> which is currently initialized on '__libc_start_main'
> (sysdeps/unix/sysv/linux/powerpc/libc-start.c).
>
> In some conditions (a dso constructor for instance) the cache line
> size is not yet initialized and calling memset may result in a
> SEGFAULT. This patch checks if the cache line size is initialized
> and if not, uses simple memcpy algorithm without any prefetch (dcbz)
> instructions.
>
> ---
>
> 2012-01-19 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
>
> * sysdeps/powerpc/powerpc32/a2/memcpy.S: Fix for when cache line size is
> not set.
> * sysdeps/powerpc/powerpc64/a2/memcpy.S: Likewise.
Ack.
We discussed this patch and it covers the case where the loader, in
encountering a zeroed cacheline_size can't make assumptions about what
that cacheline size might be because it could conflict with what's
been set by firmware. In such a case using data-cache-block-zeroing
instructions could overwrite. So this patch, by necessity can't use
dcbz.
Ryan S. Arnold
More information about the Libc-alpha
mailing list