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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF884C433FE for ; Sun, 24 Apr 2022 10:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239152AbiDXKym (ORCPT ); Sun, 24 Apr 2022 06:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236640AbiDXKyl (ORCPT ); Sun, 24 Apr 2022 06:54:41 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 578D22494F; Sun, 24 Apr 2022 03:51:40 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id EFE3992009C; Sun, 24 Apr 2022 12:51:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id E14B792009B; Sun, 24 Apr 2022 11:51:38 +0100 (BST) Date: Sun, 24 Apr 2022 11:51:38 +0100 (BST) From: "Maciej W. Rozycki" To: "Jason A. Donenfeld" cc: Thomas Bogendoerfer , LKML , Linux Crypto Mailing List , Thomas Gleixner , Arnd Bergmann , Theodore Ts'o , Dominik Brodowski , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Paul Walmsley , Palmer Dabbelt , Albert Ou , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Chris Zankel , Max Filippov , John Stultz , Stephen Boyd , Dinh Nguyen , linux-arm-kernel , linux-m68k , "open list:BROADCOM NVRAM DRIVER" , linux-riscv , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, X86 ML , linux-xtensa@linux-xtensa.org Subject: Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero In-Reply-To: Message-ID: References: <20220413115411.21489-1-Jason@zx2c4.com> <20220413115411.21489-5-Jason@zx2c4.com> <20220413122546.GA11860@alpha.franken.de> <20220418071005.GA4075@alpha.franken.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Sun, 24 Apr 2022, Jason A. Donenfeld wrote: > > unconditionally. I think this discovery asks for code optimisation, which > > I'll try to cook up sometime. > > At some point too, by the way, we might also consider putting that into > a .c file rather than a static inline in the .h, since that function is > starting to get sort of big. This code is supposed to produce one to a couple of machine instructions for the majority of configurations. This is because the conditionals used are usually compile-time constants. Therefore I think it will be good to continue having it as `static inline' functions. Cf. the analysis in commit 06947aaaf9bf ("MIPS: Implement random_get_entropy with CP0 Random"). If this code does expand to a longer sequence for some platforms, then either they need to be verified whether they can be optimised (just as I note here for the DEC systems) or we can consider making these functions `extern inline' instead, with out-of-line code available from a .a file in case the compiler decides the code is too large for inlining to be worth doing after all. Though I don't expect the latter case to be required really. Maciej 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6BFD1C433F5 for ; Sun, 24 Apr 2022 10:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To: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=DZUQXJ5DUVNdOjkBfS13YRv5u4j5JwC7mrIHADF4nO8=; b=MLSyW5zVL9g3sM LZjLHC1J1M74RlxdvHHBwsv9D/CCPfXdOhAGXrx11+H1KNo+325NdJQlxtMYRSjkm1q68PsHdxg8O c0YS6/fV/kzw2S3FX3RJnvhoccLbJs1dr6M8w2CGERyyCXD547p9wqvhHCjDYGx8xkB/xDT5xchqC k898zZ5e3CKa2Epw4pIeF+a69rw4l7/lCNwBm7fZEZsoPf/Mn+HIje84nujqTVXv71bSzJxON4TKi m0gGj8Ej2O/5G5JlOsc63uM7NA4I/585EsuE4HkGnBxsHXdUEm9yWrAt1kCFDokVEXhes5iVLMDh6 epjdxG/Ahb4z+CYZAvwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niZqR-006PSv-8C; Sun, 24 Apr 2022 10:51:59 +0000 Received: from angie.orcam.me.uk ([78.133.224.34]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niZqB-006PPD-Dj; Sun, 24 Apr 2022 10:51:45 +0000 Received: by angie.orcam.me.uk (Postfix, from userid 500) id EFE3992009C; Sun, 24 Apr 2022 12:51:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id E14B792009B; Sun, 24 Apr 2022 11:51:38 +0100 (BST) Date: Sun, 24 Apr 2022 11:51:38 +0100 (BST) From: "Maciej W. Rozycki" To: "Jason A. Donenfeld" cc: Thomas Bogendoerfer , LKML , Linux Crypto Mailing List , Thomas Gleixner , Arnd Bergmann , Theodore Ts'o , Dominik Brodowski , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Paul Walmsley , Palmer Dabbelt , Albert Ou , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Chris Zankel , Max Filippov , John Stultz , Stephen Boyd , Dinh Nguyen , linux-arm-kernel , linux-m68k , "open list:BROADCOM NVRAM DRIVER" , linux-riscv , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, X86 ML , linux-xtensa@linux-xtensa.org Subject: Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero In-Reply-To: Message-ID: References: <20220413115411.21489-1-Jason@zx2c4.com> <20220413115411.21489-5-Jason@zx2c4.com> <20220413122546.GA11860@alpha.franken.de> <20220418071005.GA4075@alpha.franken.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_035143_664627_C1475060 X-CRM114-Status: GOOD ( 16.24 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Sun, 24 Apr 2022, Jason A. Donenfeld wrote: > > unconditionally. I think this discovery asks for code optimisation, which > > I'll try to cook up sometime. > > At some point too, by the way, we might also consider putting that into > a .c file rather than a static inline in the .h, since that function is > starting to get sort of big. This code is supposed to produce one to a couple of machine instructions for the majority of configurations. This is because the conditionals used are usually compile-time constants. Therefore I think it will be good to continue having it as `static inline' functions. Cf. the analysis in commit 06947aaaf9bf ("MIPS: Implement random_get_entropy with CP0 Random"). If this code does expand to a longer sequence for some platforms, then either they need to be verified whether they can be optimised (just as I note here for the DEC systems) or we can consider making these functions `extern inline' instead, with out-of-line code available from a .a file in case the compiler decides the code is too large for inlining to be worth doing after all. Though I don't expect the latter case to be required really. Maciej _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 913A4C433EF for ; Sun, 24 Apr 2022 10:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To: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=5Kro5gS5G1oxydh/KSHgc6XOv8BXdO64nEX/C5oR8fo=; b=jmC616ZGLoAX5n Oc0YaOOfG8B18LTv4dxsClZvKbXRbzePXoP1Mmfch75v+fIVtqEXNGIIKWfDxQ2a/+RfmAu2HidFK y5lzzdqLNCSb3hICOIg1aS5QvC/rr2+yaOsiLWdTNyCNkeA0Vem12q3nG28KLY8Jm/inAIYe7TsaX OfsZD6HQqEC5grCve1C7qx7+nJWrCW+2CDkDRI+oGSFyy8/OwGFO5saKoZlT9+/xRUqsNz6Jv6HF2 sz1pqjZf2DvfGEIGyIxj/MoDx/Fjk9A2KUA7cTI8RNSNajCpzjusGHzN1kjfd3OoUZKrRFk7QHsbz mOmvIqjSkO6ChwaKDEjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niZqE-006PQ4-Jb; Sun, 24 Apr 2022 10:51:46 +0000 Received: from angie.orcam.me.uk ([78.133.224.34]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niZqB-006PPD-Dj; Sun, 24 Apr 2022 10:51:45 +0000 Received: by angie.orcam.me.uk (Postfix, from userid 500) id EFE3992009C; Sun, 24 Apr 2022 12:51:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id E14B792009B; Sun, 24 Apr 2022 11:51:38 +0100 (BST) Date: Sun, 24 Apr 2022 11:51:38 +0100 (BST) From: "Maciej W. Rozycki" To: "Jason A. Donenfeld" cc: Thomas Bogendoerfer , LKML , Linux Crypto Mailing List , Thomas Gleixner , Arnd Bergmann , Theodore Ts'o , Dominik Brodowski , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Paul Walmsley , Palmer Dabbelt , Albert Ou , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Chris Zankel , Max Filippov , John Stultz , Stephen Boyd , Dinh Nguyen , linux-arm-kernel , linux-m68k , "open list:BROADCOM NVRAM DRIVER" , linux-riscv , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, X86 ML , linux-xtensa@linux-xtensa.org Subject: Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero In-Reply-To: Message-ID: References: <20220413115411.21489-1-Jason@zx2c4.com> <20220413115411.21489-5-Jason@zx2c4.com> <20220413122546.GA11860@alpha.franken.de> <20220418071005.GA4075@alpha.franken.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_035143_664627_C1475060 X-CRM114-Status: GOOD ( 16.24 ) 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 Sun, 24 Apr 2022, Jason A. Donenfeld wrote: > > unconditionally. I think this discovery asks for code optimisation, which > > I'll try to cook up sometime. > > At some point too, by the way, we might also consider putting that into > a .c file rather than a static inline in the .h, since that function is > starting to get sort of big. This code is supposed to produce one to a couple of machine instructions for the majority of configurations. This is because the conditionals used are usually compile-time constants. Therefore I think it will be good to continue having it as `static inline' functions. Cf. the analysis in commit 06947aaaf9bf ("MIPS: Implement random_get_entropy with CP0 Random"). If this code does expand to a longer sequence for some platforms, then either they need to be verified whether they can be optimised (just as I note here for the DEC systems) or we can consider making these functions `extern inline' instead, with out-of-line code available from a .a file in case the compiler decides the code is too large for inlining to be worth doing after all. Though I don't expect the latter case to be required really. Maciej _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel