Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp656468pxb; Sat, 11 Sep 2021 17:12:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwp7GAYS9hVa60STM0cBjQtKwjmIM2FRT6vmtnkp/xWd3sRYxNmJzXan2uCbdSv1XiM6TH X-Received: by 2002:a17:906:1ec9:: with SMTP id m9mr4827214ejj.115.1631405543926; Sat, 11 Sep 2021 17:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631405543; cv=none; d=google.com; s=arc-20160816; b=c/AIk+5ZPRqxIqOiVc4f9N9kZsCf0X5BHhyjF/eBtDZRRq0WF07DdQTQRC+0chrAWK Ud0w5MZ0n2iopfyyVq/rSHSGXAE86bJaQB6hLOaomVUO5rtG6DqU11RBmAedLEHCPosP 4MKL1IpdPJYo7hmTRrzX9LtA4ufFlGrQZ7P+OYK+V/9R1Z4ARU5b3SzMuFWmlJ45JepG UY1RcrkuUUaR0Dv6kvqr4BIChKalGEHq5v51h0DkRFKCRjizYPXNV/zEWfzbecmvB4m5 V3atb28koOOeYFYLq3bHzCtgcc/0k71NTdOwX4xKmJSHr2PCPmPKC34OMQ+i55FBZujW cx3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ReGWMTCsa1v9TzcRx4PjkqrpWVHAOMyXQczx14MxL/c=; b=cVeiL4QbJ8coqNLWupvWE9q/iHc3vq4DF4iS1ENnHPJSe9+ruwgO9VbeGmsS60Hysp 4f8gbabmylEhwUS0OLeArwIqW92ckxRJOhnV+LJZmRCLOxGUb8DdhDsxazGWFCjnopbg T4y69M34yVFYlDEXHvs4G/ygtYvK/OEQvN5d6ALx+GLDdMxbCAfE8d1aTb1ZEQZUhyqp PD0FFZf7/zNDZzMhn/z6+/KKkrVyg+jkqEUVuYPV6dzAw6w+B5A2DmngTpJmNcE296/U P+sad4gLTEM/rdD3IwDTbZlLIK+Kp+CKKF7NBJWDyRye86qfk3buc73+zpM5s2/dKzY0 og9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eXuEzLq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si3096920ejh.227.2021.09.11.17.11.59; Sat, 11 Sep 2021 17:12:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eXuEzLq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232655AbhILAL4 (ORCPT + 99 others); Sat, 11 Sep 2021 20:11:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:52608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbhILALy (ORCPT ); Sat, 11 Sep 2021 20:11:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D09CE61205; Sun, 12 Sep 2021 00:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631405440; bh=rjXQJPoGjJXG/Hc2aV6Aw8sNh7EVkz9yWcAzCNbbEjs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=eXuEzLq6GWHkqS3CpXkj35rzzLmxtu2nj5NqNytbZT/1eFTIsvL4Y4RTc/JBBAv3q rxBBSupQIwdCxZduZrnRITpU7VCaLA2MIi0fQOaTBaw4cnorgMbjtcqn8rXABv/LPA a2XvU4N/hAd7xNdxkcmcDE/h/OP3R7/KZC7qWCLZhuGseNlzFvGfgrltPlHAndUddF DkZ28vkxhg4a4AclC/WiGdgvGnuGGRlvN6/6GvyBno6TK8/StfVRE+hcC+28CYaTH4 UwznNCQh89sEPHMiHR4nzmK+9xQPcEGQ5DMvKuqDZGrHz6OsXPXWu9zwtPW+fJv4zO 69retl15t86nw== Received: by mail-lj1-f170.google.com with SMTP id l18so9903847lji.12; Sat, 11 Sep 2021 17:10:40 -0700 (PDT) X-Gm-Message-State: AOAM530HuNSpE7/FRL8aDkPtSSS4BuVCpc/TRLLm0uvW8aC44e7CSVcO IYP/Q/CBuuUGzBTqnOpQfwl7XMT1sAauexXlln0= X-Received: by 2002:a2e:9ac7:: with SMTP id p7mr4002766ljj.72.1631405439084; Sat, 11 Sep 2021 17:10:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Guo Ren Date: Sun, 12 Sep 2021 08:10:27 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] riscv: use the generic string routines To: Palmer Dabbelt Cc: Matteo Croce , linux-riscv , Linux Kernel Mailing List , linux-arch , Paul Walmsley , Albert Ou , Atish Patra , Emil Renner Berthing , Akira Tsukamoto , Drew Fustini , Bin Meng , David Laight , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 11, 2021 at 11:49 AM Palmer Dabbelt wrote: > > On Thu, 05 Aug 2021 03:31:04 PDT (-0700), mcroce@linux.microsoft.com wrote: > > On Wed, Aug 4, 2021 at 10:40 PM Palmer Dabbelt wrote: > >> > >> On Tue, 03 Aug 2021 09:54:34 PDT (-0700), mcroce@linux.microsoft.com wrote: > >> > On Mon, Jul 19, 2021 at 1:44 PM Matteo Croce wrote: > >> >> > >> >> From: Matteo Croce > >> >> > >> >> Use the generic routines which handle alignment properly. > >> >> > >> >> These are the performances measured on a BeagleV machine for a > >> >> 32 mbyte buffer: > >> >> > >> >> memcpy: > >> >> original aligned: 75 Mb/s > >> >> original unaligned: 75 Mb/s > >> >> new aligned: 114 Mb/s > >> >> new unaligned: 107 Mb/s > >> >> > >> >> memset: > >> >> original aligned: 140 Mb/s > >> >> original unaligned: 140 Mb/s > >> >> new aligned: 241 Mb/s > >> >> new unaligned: 241 Mb/s > >> >> > >> >> TCP throughput with iperf3 gives a similar improvement as well. > >> >> > >> >> This is the binary size increase according to bloat-o-meter: > >> >> > >> >> add/remove: 0/0 grow/shrink: 4/2 up/down: 432/-36 (396) > >> >> Function old new delta > >> >> memcpy 36 324 +288 > >> >> memset 32 148 +116 > >> >> strlcpy 116 132 +16 > >> >> strscpy_pad 84 96 +12 > >> >> strlcat 176 164 -12 > >> >> memmove 76 52 -24 > >> >> Total: Before=1225371, After=1225767, chg +0.03% > >> >> > >> >> Signed-off-by: Matteo Croce > >> >> Signed-off-by: Emil Renner Berthing > >> >> --- > >> > > >> > Hi, > >> > > >> > can someone have a look at this change and share opinions? > >> > >> This LGTM. How are the generic string routines landing? I'm happy to > >> take this into my for-next, but IIUC we need the optimized generic > >> versions first so we don't have a performance regression falling back to > >> the trivial ones for a bit. Is there a shared tag I can pull in? > > > > Hi, > > > > I see them only in linux-next by now. > > These ended up getting rejected by Linus, so I'm going to hold off on > this for now. If they're really out of lib/ then I'll take the C > routines in arch/riscv, but either way it's an issue for the next > release. Agree, we should take the C routine in arch/riscv for common implementation. If any vendor what custom implementation they could use the alternative framework in errata for string operations. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/