Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3010925imw; Wed, 6 Jul 2022 15:55:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tS1FXbZjMLx7Ec3+e/c5oHAWIctIb/C8dt49nVZ9/H9s3/2LWGPB9U6BZk0tLE73ecrkh7 X-Received: by 2002:a05:6402:b9b:b0:43a:5aac:ed6 with SMTP id cf27-20020a0564020b9b00b0043a5aac0ed6mr24500285edb.131.1657148110244; Wed, 06 Jul 2022 15:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657148110; cv=none; d=google.com; s=arc-20160816; b=dP/gYk1EUurW1Ik+tu+gvLSPwpfPLin8ZrVhFg73uMiYveZRf8HKykn7tePSD0KSJM iEGO0n2fTnt7eTOVYi4eRPhxIvt4Q8cZLGFvsvfrVWkQipYMraKWIxJVoLozsUbfmNBr tsZoSSJw/Y+mdvFJTebiP5/Y6EZdUlBzD9rEtATA7reLGfxXRcH84sxmEaFvEvv4wIvZ 35Zca5p5WovQQc4K+KFgP/Ppiu7hpqM2IYukztQIPjxMJmDrWIL13+UUEOyZ4bz/xVzK 9duRbo7lSStnwTn+GYpbSnlVmUV1HJ1KzVGHv5GIQyo9AdnfxxnhGapLSMaatDlaHQJm /rHA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IuVxuJqdylU3gWij8O/TNNT+VdlEevMmcCcayulVOng=; b=Iv2XkB1aKplPNyyVeGJaj+dF3B7vG76K4BrgCfiCOrO+z13WFIiZV8nTNinq/RfhxH 9EZTS6hx7j+5hWGtcqZ1xw6NsOf+n8IOk11347qftQY8uXHJDCNIgspwHLXLCi5NIbHU 2LC+VSTkoLH7SgN9tCuuUk2jClRZibdpt4Xz0x5ecr8WCmhEgx5Wrqiu1m0dR9HZnpSu FtQ0udtxY2h1GO7jEgmyr1eZKfc/4oqgvR5zjxzjKzJ9JxxHPqjR24nl1FJW736/dA3n QANftVSvVR4CtSYD67tZW5g+im/mGYD1hCUBRg18QftWZBenqSSYpW0DuYjjeJLz7slU vZ7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=J5jWKyqR; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr32-20020a1709073fa000b0072aec5535acsi8313281ejc.888.2022.07.06.15.54.33; Wed, 06 Jul 2022 15:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=J5jWKyqR; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233898AbiGFWe5 (ORCPT + 99 others); Wed, 6 Jul 2022 18:34:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbiGFWe5 (ORCPT ); Wed, 6 Jul 2022 18:34:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB4F17071; Wed, 6 Jul 2022 15:34:55 -0700 (PDT) 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 78C1DB81F19; Wed, 6 Jul 2022 22:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 205DAC3411C; Wed, 6 Jul 2022 22:34:52 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="J5jWKyqR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1657146890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IuVxuJqdylU3gWij8O/TNNT+VdlEevMmcCcayulVOng=; b=J5jWKyqRuIR+5+6lP6fAsgea065aj+YhHC34hgIt8CeB5GwNxbGD/EfcqhdBcft4xt+fQc 5XMtx1NcH/A1u2zq98w5I2HyV9AzShngM4nlbZ1GH7wI0QoL+CRt2TofY9AFYJJyWra7yY AkLi4xk7cVLnZA/bFv5lO9KvqgP97tM= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 25a43ca3 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 6 Jul 2022 22:34:49 +0000 (UTC) Date: Thu, 7 Jul 2022 00:34:44 +0200 From: "Jason A. Donenfeld" To: Christian Borntraeger Cc: Harald Freudenberger , Holger Dengler , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Juergen Christ , linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH v1 1/1] s390/arch_random: Buffer true random data Message-ID: References: <20220705112712.4433-1-dengler@linux.ibm.com> <20220705112712.4433-2-dengler@linux.ibm.com> <9a0561c0-68f7-b630-4440-3ca32bf28dc2@linux.ibm.com> <7e65130c6e66ce7a9f9eb469eb7e64e0@linux.ibm.com> <386ec16c-2561-2fcf-2eea-deaab45f349c@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <386ec16c-2561-2fcf-2eea-deaab45f349c@linux.ibm.com> X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Christian, On Wed, Jul 06, 2022 at 08:29:49PM +0200, Christian Borntraeger wrote: > >> However, with so few invocations it should not make any harm when there > >> is a > >> even very expensive trng() invocation in interrupt context. > >> > >> But I think we should check, if this is really something to backport to > >> the older > >> kernels where arch_get_random_seed_long() is called really frequency. > > > > I backported the current random.c design to old kernels, so the > > situation there should be the same as in 5.19-rc5. > > > > So if you feel such rare usage is find even in_hardirq(), then I suppose > > there's nothing more to do here? > > I think up to 190µs in interrupt can result in unwanted latencies. Yes it does not > happen that often and it is smaller than most timeslices of hypervisors. > So I would likely turn that question around > what happens if we return false if in_hardirq is true? Any noticeable > delays in code that uses random numbers? I think I already answered this here with mention of the hwrng driver: https://lore.kernel.org/all/YsSAn2qXqlFkS5sH@zx2c4.com/ Anyway, I would recommend keeping it available in all contexts, so that s390 isn't a special case to keep in mind, and because Harald said he couldn't measure an actual problem existing for real. Plus, it's not as though we're talking about RT kernels or a problem that would affect RT. But if you're convinced that even the extremely rare case poses a issue, doing the !in_hardirq() thing won't be the end of the world either and is partly mitigated by the hwrng driver mentioned earlier. So I think it's mostly up to you guys on what the tradeoffs are and what's realistic and such. Jason