Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5078579rdb; Sat, 16 Sep 2023 01:52:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBNTOvGtCoUCtW7cj5goYeqg5THKr829reoUXPHxFBukdC+wQYzEyVbTYAOQJ4aFOkv3jm X-Received: by 2002:ae9:e643:0:b0:76d:a03e:73bf with SMTP id x3-20020ae9e643000000b0076da03e73bfmr3926152qkl.32.1694854323600; Sat, 16 Sep 2023 01:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694854323; cv=none; d=google.com; s=arc-20160816; b=io8tpsevJf3ubFjsr+P00j0/W23jBWXGBMRrpu8CMlTf+G09c+UP9M8xC9EzyL//UP N+ygyOoDjBZTKKIsNRLJLnkyHcW8lLPFnREJH/WN9aYR/LhtVVGUE/rizpSJOXrvcU0v Atr/HEc/v8w5Wm8GR+PeAR2bdZSvMoV2vsdMEpQKGSLvrWDhiJwHxqX6veGoT82Zofuo 7HbcQAAUEmPtNpgtHbgsfB/FWeEEaVUNSTJHd5YAuG7vntamKbNfkPK0APPVAB0e3B0R g22NLMLnGykZwkfr5CMZNBHLY4SVSKySGE0nk5H/jJtsJBFusBTub/JhNxP9JUkskxLf 4dxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=z+bTRr81Pb6rB0DL/zdIENH8dKo1sV7U9Ax3J7NPfQg=; fh=tO/lcMJ3vGu8ZcXExs9o7YHAcRH2d2ZInzY70+XfvRQ=; b=chqy8WKtlTDMLYs/PnzbcZIf39xdUeSvazmBYHLDudH/7kfdjchmZjeDBFGLqsjgxA FUEY7zg0j6KDDg38iE11yaGjUFbwmgcAYlEHEEFMdCo4QHtkCH7yYd7SJB6M26yWDyup b35ZPRItlHQoTLAAg6skmG6+hK5LTi9A3Fs/nXdfbXS1mH9inFcc3hTkrwEByGa42fYe 3Uu4bl3Ip7XqS+YG7ZbtpUwCB77u32B20L03b9xFyREkALNc7deKUY/d44XFKzP1xc73 ymocqXh4Mby8SVjMzCpbDPnG0nHOgrETmCu7vijJynxM8t9Y9whUkjb69lQ2C53rL2R7 NZ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gC+VjBFi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b6-20020a63d806000000b0056fa1bc208esi4409109pgh.722.2023.09.16.01.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 01:52:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gC+VjBFi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 85C6C83B6FBC; Sat, 16 Sep 2023 01:51:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232142AbjIPIvM (ORCPT + 99 others); Sat, 16 Sep 2023 04:51:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237743AbjIPIuq (ORCPT ); Sat, 16 Sep 2023 04:50:46 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71826CF8; Sat, 16 Sep 2023 01:50:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05AADC433C7; Sat, 16 Sep 2023 08:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694854241; bh=40ylAetvH2D45aO5J/08CkEvM05rm1lwgoMuurgAuH0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gC+VjBFi06GNrUV4aejNhpXtveOVkoTOJURdSDxNPs+L1wLQuki8wXleFcffnq9Xj X6PW2HOI5TlnVkKC591doTM7l1THmFUSQB1Jlhx+3uRq0UhlHHiZ3+p97Na0Qtfg2K bsD5I6szMJPGak1RUxwzIs6upcyErp1/s+Xp1mHqDjtHjnkTugyv7vANcepK86Xpa+ aFAIMbolhjbh59Ge0hy1eVd/nWSAq2zQOF8PmqxOcN11bATns2sTU/wkdxq3y7jdaK kQBUNNwtA6EDXCOucwung84Z5syZ82le1aiY0yVEe+oxASsns0Wn/HTYHuajwtILlm l9AVHz3LY2Zhg== Date: Sat, 16 Sep 2023 09:50:36 +0100 From: Conor Dooley To: Charlie Jenkins Cc: Palmer Dabbelt , Samuel Holland , David Laight , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Paul Walmsley , Albert Ou , Arnd Bergmann Subject: Re: [PATCH v6 1/4] asm-generic: Improve csum_fold Message-ID: <20230916-jackpot-guy-01c2024c6a63@spud> References: <20230915-optimize_checksum-v6-0-14a6cf61c618@rivosinc.com> <20230915-optimize_checksum-v6-1-14a6cf61c618@rivosinc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="60Aaxr3gdQT472cE" Content-Disposition: inline In-Reply-To: <20230915-optimize_checksum-v6-1-14a6cf61c618@rivosinc.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 16 Sep 2023 01:51:42 -0700 (PDT) --60Aaxr3gdQT472cE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 15, 2023 at 10:01:17AM -0700, Charlie Jenkins wrote: > This csum_fold implementation introduced into arch/arc by Vineet Gupta > is better than the default implementation on at least arc, x86, and > riscv. Using GCC trunk and compiling non-inlined version, this > implementation has 41.6667%, 25% fewer instructions on riscv64, x86-64 > respectively with -O3 optimization. Most implmentations override this > default in asm, but this should be more performant than all of those > other implementations except for arm which has barrel shifting and > sparc32 which has a carry flag. >=20 > Signed-off-by: Charlie Jenkins > Reviewed-by: David Laight > --- > include/asm-generic/checksum.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) >=20 > diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksu= m.h > index 43e18db89c14..37f5ec70ac93 100644 > --- a/include/asm-generic/checksum.h > +++ b/include/asm-generic/checksum.h > @@ -31,9 +31,7 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned i= nt ihl); > static inline __sum16 csum_fold(__wsum csum) > { > u32 sum =3D (__force u32)csum; > - sum =3D (sum & 0xffff) + (sum >> 16); > - sum =3D (sum & 0xffff) + (sum >> 16); > - return (__force __sum16)~sum; > + return (__force __sum16)((~sum - ror32(sum, 16)) >> 16); Breaks the build on RISC-V in a way that is repaired by later patches in the series, so you likely did not notice: =2E/include/asm-generic/checksum.h:34:35: error: call to undeclared functio= n 'ror32'; ISO C99 and later do not support implicit function declarations = [-Wimplicit-function-declaration] =2E./include/linux/bitops.h:134:21: error: static declaration of 'ror32' fo= llows non-static declaration Cheers, Conor. --60Aaxr3gdQT472cE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZQVsXAAKCRB4tDGHoIJi 0mnEAQCTLnl3iMEBVo3Tzp6o42hU6amG6PduNyUQd8smnnQAVAD/RhsXtPuthkcC tk+v8xXjpz227mU8sGL65Usl2rfDRgk= =GX46 -----END PGP SIGNATURE----- --60Aaxr3gdQT472cE--