[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3734021d-1756-3a09-6595-14ca58c64bf9@synopsys.com>
Date: Tue, 14 Jan 2020 21:36:15 +0000
From: Vineet Gupta <Vineet.Gupta1@...opsys.com>
To: Arnd Bergmann <arnd@...db.de>
CC: Khalid Aziz <khalid.aziz@...cle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Peter Zijlstra" <peterz@...radead.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Kees Cook <keescook@...omium.org>,
"Ingo Molnar" <mingo@...nel.org>, Aleksa Sarai <cyphar@...har.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"open list:SYNOPSYS ARC ARCHITECTURE"
<linux-snps-arc@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [RFC 4/4] ARC: uaccess: use optimized generic
__strnlen_user/__strncpy_from_user
On 1/14/20 12:42 PM, Arnd Bergmann wrote:
> On Tue, Jan 14, 2020 at 9:08 PM Vineet Gupta <Vineet.Gupta1@...opsys.com> wrote:
>
>> diff --git a/arch/arc/include/asm/word-at-a-time.h b/arch/arc/include/asm/word-at-a-time.h
>> new file mode 100644
>> index 000000000000..00e92be70987
>> --- /dev/null
>> +++ b/arch/arc/include/asm/word-at-a-time.h
>> @@ -0,0 +1,49 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Copyright (C) 2020 Synopsys Inc.
>> + */
>> +#ifndef __ASM_ARC_WORD_AT_A_TIME_H
>> +#define __ASM_ARC_WORD_AT_A_TIME_H
>> +
>> +#ifdef __LITTLE_ENDIAN__
>> +
>> +#include <linux/kernel.h>
>> +
>> +struct word_at_a_time {
>> + const unsigned long one_bits, high_bits;
>> +};
>
> What's wrong with the generic version on little-endian? Any
> chance you can find a way to make it work as well for you as
> this copy?
find_zero() by default doesn't use pop count instructions. I didn't like the copy
either but wasn't sure of the best way to make this 4 API interface reusable. Are
you suggesting we allow partial over-ride starting with #ifndef find_zero ?
>> +static inline unsigned long find_zero(unsigned long mask)
>> +{
>> +#ifdef CONFIG_64BIT
>> + return fls64(mask) >> 3;
>> +#else
>> + return fls(mask) >> 3;
>> +#endif
>
> The CONFIG_64BIT check not be needed, unless you are adding
> support for 64-bit ARC really soon.
:-) Indeed that was the premise !
Thx for the quick review.
-Vineet
Powered by blists - more mailing lists