From: Stephan Mueller Subject: Re: [PATCH v28 11/12] LRNG - add interface for gathering of raw entropy Date: Thu, 16 Jan 2020 07:52:38 +0100 Message-ID: <5678860.LzzLIogE2D@tauon.chronox.de> References: <6157374.ptSnyUpaCn@positron.chronox.de> <9116265.6Va6cPe1zF@tauon.chronox.de> <72a57d93-737a-c6c1-82c4-e14f73054ad5@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <72a57d93-737a-c6c1-82c4-e14f73054ad5@infradead.org> Sender: linux-crypto-owner@vger.kernel.org To: Randy Dunlap Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-crypto@vger.kernel.org, LKML , linux-api@vger.kernel.org, "Eric W. Biederman" , "Alexander E. Patrakov" , "Ahmed S. Darwish" , "Theodore Y. Ts'o" , Willy Tarreau , Matthew Garrett , Vito Caputo , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , Andy Lutomirski , Florian Weimer , Lennart Poettering , Nicolai Stange List-Id: linux-api@vger.kernel.org Am Donnerstag, 16. Januar 2020, 07:48:20 CET schrieb Randy Dunlap: Hi Randy, > On 1/15/20 10:43 PM, Stephan Mueller wrote: > > Am Donnerstag, 16. Januar 2020, 01:18:18 CET schrieb Randy Dunlap: > >=20 > > Hi Randy, > >=20 > >> On 1/15/20 2:35 AM, Stephan M=FCller wrote: > >>> CC: "Eric W. Biederman" > >>> CC: "Alexander E. Patrakov" > >>> CC: "Ahmed S. Darwish" > >>> CC: "Theodore Y. Ts'o" > >>> CC: Willy Tarreau > >>> CC: Matthew Garrett > >>> CC: Vito Caputo > >>> CC: Andreas Dilger > >>> CC: Jan Kara > >>> CC: Ray Strode > >>> CC: William Jon McCann > >>> CC: zhangjs > >>> CC: Andy Lutomirski > >>> CC: Florian Weimer > >>> CC: Lennart Poettering > >>> CC: Nicolai Stange > >>> Reviewed-by: Roman Drahtmueller > >>> Tested-by: Roman Drahtm=FCller > >>> Tested-by: Marcelo Henrique Cerri > >>> Tested-by: Neil Horman > >>> Signed-off-by: Stephan Mueller > >>> --- > >>>=20 > >>> drivers/char/lrng/Kconfig | 16 ++ > >>> drivers/char/lrng/Makefile | 1 + > >>> drivers/char/lrng/lrng_testing.c | 271 +++++++++++++++++++++++++++++= ++ > >>> 3 files changed, 288 insertions(+) > >>> create mode 100644 drivers/char/lrng/lrng_testing.c > >>>=20 > >>> diff --git a/drivers/char/lrng/lrng_testing.c > >>> b/drivers/char/lrng/lrng_testing.c new file mode 100644 > >>> index 000000000000..0e287eccd622 > >>> --- /dev/null > >>> +++ b/drivers/char/lrng/lrng_testing.c > >>> @@ -0,0 +1,271 @@ > >>> +// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause > >>> +/* > >>> + * Linux Random Number Generator (LRNG) Raw entropy collection tool > >>> + * > >>> + * Copyright (C) 2019 - 2020, Stephan Mueller > >>> + */ > >>> + > >>> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > >>> + > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> + > >>> +#include "lrng_internal.h" > >>> + > >>> +#define LRNG_TESTING_RINGBUFFER_SIZE 1024 > >>> +#define LRNG_TESTING_RINGBUFFER_MASK=09 (LRNG_TESTING_RINGBUFFER_SIZE - 1) > >>> + > >>> +static u32 lrng_testing_rb[LRNG_TESTING_RINGBUFFER_SIZE]; > >>> +static u32 lrng_rb_reader =3D 0; > >>> +static u32 lrng_rb_writer =3D 0; > >>> +static atomic_t lrng_testing_enabled =3D ATOMIC_INIT(0); > >>> + > >>> +static DECLARE_WAIT_QUEUE_HEAD(lrng_raw_read_wait); > >>> +static DEFINE_SPINLOCK(lrng_raw_lock); > >>> + > >>> +/* > >>> + * 0 =3D=3D> No boot test, gathering of runtime data allowed > >>> + * 1 =3D=3D> Boot test enabled and ready for collecting data, gather= ing > >>> runtime + * data is disabled > >>> + * 2 =3D=3D> Boot test completed and disabled, gathering of runtime = data is > >>> + * disabled > >>> + */ > >>> +static u32 boot_test =3D 0; > >>> +module_param(boot_test, uint, 0644); > >>> +MODULE_PARM_DESC(boot_test, "Enable gathering boot time entropy of t= he > >>> first" + " entropy events"); > >>=20 > >> One line for the string, please. > >=20 > > may I ask the question whether this should be done for all lines with > > printk statements? As checkpatch.pl will complain if you have lines > > larger than 80 chars and complains about line-broken printk statements,= I > > am always unsure which way to go. > >=20 > > All printk statements in the patch series have line-broken printk > > statements. > It's for grep-ability of the strings. > grepping for partial strings would work as is, but then one would need to > know what partial string to search for. Ok, I am changing all these strings to one-liners even though checkpatch.pl= =20 will complain. Thank you. Ciao Stephan