Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2952439pxk; Mon, 21 Sep 2020 01:03:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBjelFuK/jaVonyQmsfZge+uEMVdGna0UL1MDkl+4KDfZaHxGpyaN8Cn4oECal2wKt33hv X-Received: by 2002:a17:906:46d5:: with SMTP id k21mr47390272ejs.247.1600675428415; Mon, 21 Sep 2020 01:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600675428; cv=none; d=google.com; s=arc-20160816; b=BUSYo/cHcmP/hTqIeeV6WDJCiV6RLR7Yjqd6SAz0as4ZwMs3CUZKyyShVX9PMdQ3yR qjYfN7HZy86vjIFWoT86M2O6u0DpkfnjBscBlK0vavae02RrwfZgI60NfAYKeT2cN0B/ 7QIx7jdP9oUlWyDNhUFPt9kAsCtOKGcav7ZlBEFb9cy60oWSFre42Q8r03hPr5RXDLZX VtYAT/JfQNWHhv/UnlJ55bx56iAuFoTaQSeVtaJKsu+k1PArRLpOjKAeH1hdNH/i6/Si wamFHOgZuawACbuouDk2cK0NpnHk8dqBYNz0pX4jRjH8LKrRE/QQt5t7wvl8NEEHqAue sJaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xuVkhNDSWFqyMDOWTdmImk/6CuSRul6i9d1aYSpAYM8=; b=naKjtHoYlOdyHyl1YFiSvO4dytVktU29HGaZmpn3i/rXtqFld9W/Cgzm6dhQdTkFSQ uWh+2EtT0Dlava+npjbV3q3U8MyNPuoIKOIfCYMzVOiR206d0qfRM1sx40wdeab8CgDs f1fdIO+PjbGN8bA6A3osbm+gTJhyYPBJggnvC1rU7yQIVcah8vqkCx5nmtgxrbw2GrQq 3vM3PSj4Ray/pUV5eZku+saNBLN1VLHt91ff4LtiKORl+5IIl098CvwnbNAL/p5011oI vTQluv0GTruyTsKbrYLefSuUiJgvnPALm/bmk1q5Uv+lcDZdszssbQ9vzYtMdv95igP6 B36g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si7425829edp.136.2020.09.21.01.03.25; Mon, 21 Sep 2020 01:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbgIUIBh (ORCPT + 99 others); Mon, 21 Sep 2020 04:01:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:57142 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbgIUH7j (ORCPT ); Mon, 21 Sep 2020 03:59:39 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 874A5B52A; Mon, 21 Sep 2020 08:00:06 +0000 (UTC) From: Nicolai Stange To: "Theodore Y. Ts'o" Cc: linux-crypto@vger.kernel.org, LKML , Arnd Bergmann , Greg Kroah-Hartman , "Eric W. Biederman" , "Alexander E. Patrakov" , "Ahmed S. Darwish" , Willy Tarreau , Matthew Garrett , Vito Caputo , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , Andy Lutomirski , Florian Weimer , Lennart Poettering , Peter Matthias , Marcelo Henrique Cerri , Roman Drahtmueller , Neil Horman , Randy Dunlap , Julia Lawall , Dan Carpenter , Andy Lavr , Eric Biggers , "Jason A. Donenfeld" , =?UTF-8?q?Stephan=20M=C3=BCller?= , Torsten Duwe , Petr Tesarik , Nicolai Stange Subject: [RFC PATCH 30/41] random: add a queued_entropy instance to struct fast_pool Date: Mon, 21 Sep 2020 09:58:46 +0200 Message-Id: <20200921075857.4424-31-nstange@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075857.4424-1-nstange@suse.de> References: <20200921075857.4424-1-nstange@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When health tests are introduced with upcoming patches, it will become necessary to keep entropy queued across add_interrupt_randomness() invocations for later dispatch to the global balance. Prepare for this by adding a struct queued_entropy member to the per-CPU fast_pool. Use it in place of that queue with automatic storage duration in add_interrupt_randomness(). Signed-off-by: Nicolai Stange --- drivers/char/random.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 55e784a5a2ec..37746df53acf 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -885,6 +885,7 @@ struct fast_pool { unsigned short reg_idx; unsigned char count; int event_entropy_shift; + struct queued_entropy q; }; /* @@ -1655,7 +1656,7 @@ void add_interrupt_randomness(int irq, int irq_flags) __u32 c_high, j_high; __u64 ip; bool reseed; - struct queued_entropy q = { 0 }; + struct queued_entropy *q = &fast_pool->q; unsigned int nfrac; if (cycles == 0) @@ -1700,9 +1701,9 @@ void add_interrupt_randomness(int irq, int irq_flags) nfrac = fast_pool_entropy(fast_pool->count, fast_pool->event_entropy_shift); } - __queue_entropy(r, &q, nfrac); + __queue_entropy(r, q, nfrac); __mix_pool_bytes(r, &fast_pool->pool, sizeof(fast_pool->pool)); - reseed = __dispatch_queued_entropy_fast(r, &q); + reseed = __dispatch_queued_entropy_fast(r, q); spin_unlock(&r->lock); fast_pool->last = now; -- 2.26.2