From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 497CAC43461 for ; Tue, 18 May 2021 21:31:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1997B6135C for ; Tue, 18 May 2021 21:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236935AbhERVcd (ORCPT ); Tue, 18 May 2021 17:32:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:51602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236729AbhERVcc (ORCPT ); Tue, 18 May 2021 17:32:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90A876124C; Tue, 18 May 2021 21:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621373474; bh=d0+hSpHTltY5juyqwHwyL+G+xHCIlY0BOiHIqPiFSTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K3IkDYf5WzG84qZdrk493mElmsqetEgx7UtrgyRD92P25kMU/2NnsR1jUS/IdYBj1 KpHfDimRF4fXrFQ75vN7kAoaJxW4DtlpllTLXKjN74Jpdfzywy0nuBMQU4uNjPLvzq YcCKMH0JQ/3Yj+KZUonoDZ7j2+U6eZbzWHXYcHSkRoTnTwDSQ7iepxk8u6YzIuknPW nBT2zx6uFojpxjdgasR5X+VLrmXSALrJceUxQ1Qi8sZNBiFNgek49YbyWhFHhYoGLM Sr6kLztyMyuHVPK+zmrSMFT6aM6wrdbq9TagKSMB9QL/nSAfL+JlINx3IkVwMWq/xO KG87Ke2bRZjyQ== Date: Tue, 18 May 2021 14:31:12 -0700 From: Eric Biggers To: Arnd Bergmann Cc: Linus Torvalds , "Jason A. Donenfeld" , linux-arch , Vineet Gupta , Russell King , Herbert Xu , "David S. Miller" , Thomas Bogendoerfer , Linux ARM , Linux Kernel Mailing List , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "open list:BROADCOM NVRAM DRIVER" , Nobuhiro Iwamatsu Subject: Re: [PATCH v2 07/13] asm-generic: unaligned always use struct helpers Message-ID: References: <20210514100106.3404011-1-arnd@kernel.org> <20210514100106.3404011-8-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, May 18, 2021 at 10:51:23PM +0200, Arnd Bergmann wrote: > > > zstd looks very similar to lz4. > > > End result: at a minimum, I'd suggest using > > "-fno-tree-loop-vectorize", although somebody should check that NEON > > case. > > > And I still think that using O3 for anything halfway complicated > > should be considered odd and need some strong numbers to enable. > > Agreed. I think there is a fairly strong case for just using -O2 on lz4 > and backport that to stable. > Searching for lz4 bugs with -O3 also finds several reports including > one that I sent myself: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65709 > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69702 > > I see that user space zstd is built with -O3 in Debian, but it the changelog > also lists "Improved : better speed on clang and gcc -O2, thanks to Eric > Biggers", so maybe Eric has some useful ideas on whether we should > just use -O2 for the in-kernel version. > In my opinion, -O2 is a good default even for compression code. I generally don't see any benefit from -O3 in compression code I've written. That being said, -O2 is what I usually use during development. Other people could write code that relies on -O3 to be optimized well. The Makefiles for lz4 and zstd use -O3 by default, which is a little concerning. I do expect that they're still well-written enough to do well with -O2 too, but it would require doing benchmarks to tell for sure. (As Arnd noted, it happens that I did do such benchmarks on zstd about 5 years ago, and I found an issue where some functions weren't marked inline when they should be, causing them to be inlined at -O3 but not at -O2. That got fixed.) - Eric From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66F5BC433B4 for ; Tue, 18 May 2021 21:32:56 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA96761244 for ; Tue, 18 May 2021 21:32:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA96761244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=K+dex1sFWUGC1tDRu/9golEXdf1RNEV0IR715tMvxso=; b=FivpBNMiEb5MmaGxykM8aC6o0 C6GmsVqIAvxQ3X28kWMP5dLbDii2Un1i3Q75P7u7QBqdmFa+zff5fa1E8A9EB6f+GMOXvSjJx0CfX QCEUQ+qN5Ct53l8siek9Ar02R7hszb/c/9ASEJ6tp6SDjVt9/GLcFDV1WsJlOyhk+PRbH+nLz/ctV 49sBFmZhgg6Do0GYEehX53sSnScsBtNC9Ok6KU+BsPncOmq4qYAFdOViQbxnknz/UK2HDZt7GLGnX aUfbhLojCmdESCdSKvFuAorz3/JFn17GDufTOiPKWa+iFupcxy11UUbEBim1VMRchGhR+D1hiQqj3 ji0zTdw9w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lj7JA-001wHM-7W; Tue, 18 May 2021 21:31:20 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj7J8-001wHA-0a for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 21:31:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jmm4f0ZEw/M5y6dx5c4ZnGMkjHBYhzLCB88Rg3dWKKo=; b=bAQB685zPTAQDm4g/6Bndh6WQH +o6djbiwvsyMIbXO2jYeNuOLM0/hlZXVye7IixLywwpR34TkTS5qTbqR2/VaRyfZbyR+6R0hWY9U+ 5T2xbFZY+fipaLYRwxQ/J9sQkQ951NAznOPvI6J08dI8R3koPHAd3fEkGrZp+UlIZjAUGp3MTFXnd 7i7ap2ZeeXKXYa+xjiEWilALtSnKmKjvPOHpgLoyBdObODWwBLJ9iTeHy7orDVyAYfWOlaav5PVwS jhrTk4LuHmFFEizsLPlr0vVyYZgr/bWgRRpSufRqUI/vuiLhRCLa6gZjbkkY4XLjUV2z3B2InfzHp nEtQ3SsQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj7J4-00EyhE-JG for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 21:31:16 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90A876124C; Tue, 18 May 2021 21:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621373474; bh=d0+hSpHTltY5juyqwHwyL+G+xHCIlY0BOiHIqPiFSTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K3IkDYf5WzG84qZdrk493mElmsqetEgx7UtrgyRD92P25kMU/2NnsR1jUS/IdYBj1 KpHfDimRF4fXrFQ75vN7kAoaJxW4DtlpllTLXKjN74Jpdfzywy0nuBMQU4uNjPLvzq YcCKMH0JQ/3Yj+KZUonoDZ7j2+U6eZbzWHXYcHSkRoTnTwDSQ7iepxk8u6YzIuknPW nBT2zx6uFojpxjdgasR5X+VLrmXSALrJceUxQ1Qi8sZNBiFNgek49YbyWhFHhYoGLM Sr6kLztyMyuHVPK+zmrSMFT6aM6wrdbq9TagKSMB9QL/nSAfL+JlINx3IkVwMWq/xO KG87Ke2bRZjyQ== Date: Tue, 18 May 2021 14:31:12 -0700 From: Eric Biggers To: Arnd Bergmann Cc: Linus Torvalds , "Jason A. Donenfeld" , linux-arch , Vineet Gupta , Russell King , Herbert Xu , "David S. Miller" , Thomas Bogendoerfer , Linux ARM , Linux Kernel Mailing List , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "open list:BROADCOM NVRAM DRIVER" , Nobuhiro Iwamatsu Subject: Re: [PATCH v2 07/13] asm-generic: unaligned always use struct helpers Message-ID: References: <20210514100106.3404011-1-arnd@kernel.org> <20210514100106.3404011-8-arnd@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_143114_677152_75B44C85 X-CRM114-Status: GOOD ( 19.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 18, 2021 at 10:51:23PM +0200, Arnd Bergmann wrote: > > > zstd looks very similar to lz4. > > > End result: at a minimum, I'd suggest using > > "-fno-tree-loop-vectorize", although somebody should check that NEON > > case. > > > And I still think that using O3 for anything halfway complicated > > should be considered odd and need some strong numbers to enable. > > Agreed. I think there is a fairly strong case for just using -O2 on lz4 > and backport that to stable. > Searching for lz4 bugs with -O3 also finds several reports including > one that I sent myself: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65709 > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69702 > > I see that user space zstd is built with -O3 in Debian, but it the changelog > also lists "Improved : better speed on clang and gcc -O2, thanks to Eric > Biggers", so maybe Eric has some useful ideas on whether we should > just use -O2 for the in-kernel version. > In my opinion, -O2 is a good default even for compression code. I generally don't see any benefit from -O3 in compression code I've written. That being said, -O2 is what I usually use during development. Other people could write code that relies on -O3 to be optimized well. The Makefiles for lz4 and zstd use -O3 by default, which is a little concerning. I do expect that they're still well-written enough to do well with -O2 too, but it would require doing benchmarks to tell for sure. (As Arnd noted, it happens that I did do such benchmarks on zstd about 5 years ago, and I found an issue where some functions weren't marked inline when they should be, causing them to be inlined at -O3 but not at -O2. That got fixed.) - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel