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 A086CC433EF for ; Mon, 21 Feb 2022 02:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245449AbiBUCbJ (ORCPT ); Sun, 20 Feb 2022 21:31:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245416AbiBUCbI (ORCPT ); Sun, 20 Feb 2022 21:31:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 671B0443D9; Sun, 20 Feb 2022 18:30:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30D99B80DAA; Mon, 21 Feb 2022 02:30:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B475C340E8; Mon, 21 Feb 2022 02:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645410643; bh=2uZ8sUorAwc5X3MugMskJmqF4rEOcD2jddBSqZuXQ94=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a4p4Olw7vCl4s6q6MSZpDlvKV/OoTwTavJHkHfDKou9FFFeX4dwMnS68tB/2h0TPM eQLy4baewlJdqhFvQxmmpRnVqrIFSLlOG7ap4E+wwlGs9IXSkWAy0j7LUDApSP61k4 qB7BzfIPtLdWa7QqnKuTEeFTyVmRtKfLJ+jzOq6Vx3xX+v33aShYjsQP42Q2IlR6/s JRCe3aKugs6BxFTzdyzKkxfe/sNK1qVoo2jnrlMpSskaZhMG5hJi5bhnSHxKgzJEJ/ rXgwpbDNJ6JgM0dlKfNayyGmJcg5krpGZyr4OCzcgrHSqHyg2yzwC134TX2aAtXw1w YM31HHbU1No9A== Date: Sun, 20 Feb 2022 18:30:42 -0800 From: Eric Biggers To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Sebastian Andrzej Siewior , Thomas Gleixner , Peter Zijlstra , Theodore Ts'o , Sultan Alsawaf , Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Andy Lutomirski Subject: Re: [PATCH v4 1/2] random: remove batched entropy locking Message-ID: References: <20220209125644.533876-1-Jason@zx2c4.com> <20220209125644.533876-2-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220209125644.533876-2-Jason@zx2c4.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Feb 09, 2022 at 01:56:43PM +0100, Jason A. Donenfeld wrote: > Rather than use spinlocks to protect batched entropy, we can instead > disable interrupts locally, since we're dealing with per-cpu data, and > manage resets with a basic generation counter. At the same time, we > can't quite do this on PREEMPT_RT, where we still want spinlocks-as- > mutexes semantics. So we use a local_lock_t, which provides the right > behavior for each. Because this is a per-cpu lock, that generation > counter is still doing the necessary CPU-to-CPU communication. > > This should improve performance a bit. It will also fix the linked splat > that Jonathan received with a PROVE_RAW_LOCK_NESTING=y. > > Suggested-by: Andy Lutomirski > Reported-by: Jonathan Neuschäfer > Tested-by: Jonathan Neuschäfer > Link: https://lore.kernel.org/lkml/YfMa0QgsjCVdRAvJ@latitude/ > Cc: Sebastian Andrzej Siewior > Cc: Sultan Alsawaf > Signed-off-by: Jason A. Donenfeld > --- > drivers/char/random.c | 55 ++++++++++++++++++++++--------------------- > 1 file changed, 28 insertions(+), 27 deletions(-) Reviewed-by: Eric Biggers - Eric