lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <16313365-b51e-47d2-aae8-633dbfc8a3fa@kylinos.cn>
Date: Wed, 21 Jan 2026 16:12:30 +0800
From: Feng Jiang <jiangfeng@...inos.cn>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...el.com>, pjw@...nel.org,
 palmer@...belt.com, aou@...s.berkeley.edu, alex@...ti.fr,
 akpm@...ux-foundation.org, kees@...nel.org, andy@...nel.org,
 ebiggers@...nel.org, martin.petersen@...cle.com, ardb@...nel.org,
 charlie@...osinc.com, conor.dooley@...rochip.com, ajones@...tanamicro.com,
 linus.walleij@...aro.org, nathan@...nel.org,
 linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3 0/8] riscv: optimize string functions and add kunit
 tests

On 2026/1/21 15:01, Andy Shevchenko wrote:
> On Wed, Jan 21, 2026 at 8:44 AM Feng Jiang <jiangfeng@...inos.cn> wrote:
>> On 2026/1/20 15:36, Andy Shevchenko wrote:
>>> On Tue, Jan 20, 2026 at 02:58:44PM +0800, Feng Jiang wrote:
> 
> ...
>>>> word-at-a-time logic, showing significant gains as the string length
>>>> increases.
>>>
>>> Hmm... Have you tried to optimise the generic implementation to use
>>> word-at-a-time logic and compare?
>>
>> Regarding the generic implementation, even if we were to optimize the C code
>> to use word-at-a-time logic (the has_zero() style bit-manipulation), it still
>> wouldn't match the Zbb version's efficiency.
>>
>> The traditional C-based word-level detection requires a sequence of arithmetic
>> operations to identify NUL bytes. In contrast, the RISC-V orc.b instruction
>> collapses this entire check into a single hardware cycle. I've focused on this
>> architectural approach to fully leverage these specific Zbb features, which
>> provides a level of instruction density that generic C math cannot achieve.
> 
> I understand that. My point is if we move the generic implementation
> to use word-at-a-time technique the difference should not go 4x,
> right? Perhaps 1.5x or so. I believe this will be a very useful
> exercise.
> 

That is a very insightful point, thanks for the suggestion. I'll look into
optimizing the generic string library as a follow-up task to see if we can
bring some improvements there as well. 

Thanks again for the guidance.

-- 
With Best Regards,
Feng Jiang


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ