]> asedeno.scripts.mit.edu Git - linux.git/commit
ARCv2: lib: memcpy: fix doing prefetchw outside of buffer
authorEugeniy Paltsev <eugeniy.paltsev@synopsys.com>
Wed, 30 Jan 2019 16:32:40 +0000 (19:32 +0300)
committerVineet Gupta <vgupta@synopsys.com>
Thu, 21 Feb 2019 19:03:16 +0000 (11:03 -0800)
commitf8a15f97664178f27dfbf86a38f780a532cb6df0
tree50efe7e5154fbbbc77f8c46b2a53c6773e2b6493
parent252f6e8eae909bc075a1b1e3b9efb095ae4c0b56
ARCv2: lib: memcpy: fix doing prefetchw outside of buffer

ARCv2 optimized memcpy uses PREFETCHW instruction for prefetching the
next cache line but doesn't ensure that the line is not past the end of
the buffer. PRETECHW changes the line ownership and marks it dirty,
which can cause data corruption if this area is used for DMA IO.

Fix the issue by avoiding the PREFETCHW. This leads to performance
degradation but it is OK as we'll introduce new memcpy implementation
optimized for unaligned memory access using.

We also cut off all PREFETCH instructions at they are quite useless
here:
 * we call PREFETCH right before LOAD instruction call.
 * we copy 16 or 32 bytes of data (depending on CONFIG_ARC_HAS_LL64)
   in a main logical loop. so we call PREFETCH 4 times (or 2 times)
   for each L1 cache line (in case of 64B L1 cache Line which is
   default case). Obviously this is not optimal.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/lib/memcpy-archs.S