[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-ba92c635-7087-4783-baa5-2a111e0e2710@palmer-si-x1e>
Date: Tue, 13 Aug 2019 16:50:58 -0700 (PDT)
From: Palmer Dabbelt <palmer@...ive.com>
To: Christoph Hellwig <hch@...radead.org>
CC: nickhu@...estech.com, alankao@...estech.com,
Paul Walmsley <paul.walmsley@...ive.com>,
aou@...s.berkeley.edu, green.hu@...il.com, deanbo422@...il.com,
tglx@...utronix.de, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org, aryabinin@...tuozzo.com,
glider@...gle.com, dvyukov@...gle.com,
Anup Patel <Anup.Patel@....com>,
Greg KH <gregkh@...uxfoundation.org>, alexios.zavras@...el.com,
Atish Patra <Atish.Patra@....com>, zong@...estech.com,
kasan-dev@...glegroups.com
Subject: Re: [PATCH 1/2] riscv: Add memmove string operation.
On Mon, 12 Aug 2019 08:04:46 PDT (-0700), Christoph Hellwig wrote:
> On Wed, Aug 07, 2019 at 03:19:14PM +0800, Nick Hu wrote:
>> There are some features which need this string operation for compilation,
>> like KASAN. So the purpose of this porting is for the features like KASAN
>> which cannot be compiled without it.
>>
>> KASAN's string operations would replace the original string operations and
>> call for the architecture defined string operations. Since we don't have
>> this in current kernel, this patch provides the implementation.
>>
>> This porting refers to the 'arch/nds32/lib/memmove.S'.
>
> This looks sensible to me, although my stringop asm is rather rusty,
> so just an ack and not a real review-by:
>
> Acked-by: Christoph Hellwig <hch@....de>
FWIW, we just write this in C everywhere else and rely on the compiler to
unroll the loops. I always prefer C to assembly when possible, so I'd prefer
if we just adopt the string code from newlib. We have a RISC-V-specific memcpy
in there, but just use the generic memmove.
Maybe the best bet here would be to adopt the newlib memcpy/memmove as generic
Linux functions? They're both in C so they should be fine, and they both look
faster than what's in lib/string.c. Then everyone would benefit and we don't
need this tricky RISC-V assembly. Also, from the look of it the newlib code is
faster because the inner loop is unrolled.
Powered by blists - more mailing lists