All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] random: maintenance administrivia
@ 2022-02-10 15:50 Jason A. Donenfeld
  2022-02-10 15:50 ` [PATCH 1/3] random: remove ifdef'd out interrupt bench Jason A. Donenfeld
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 15:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jason A. Donenfeld, Greg Kroah-Hartman, Theodore Ts'o,
	Dominik Brodowski

These patches aren't very interesting: removing unused debugging code
and switching to SPDX. I'm not aware of any special ritual being
required to SPDXify a file aside from just doing it, but please correct
me if I'm wrong; none of the copyright info changes.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>

Jason A. Donenfeld (3):
  random: remove ifdef'd out interrupt bench
  random: remove unused tracepoints
  random: add proper SPDX header

 drivers/char/random.c         | 110 +-----------------
 include/linux/random.h        |   5 -
 include/trace/events/random.h | 206 ----------------------------------
 lib/random32.c                |   2 -
 4 files changed, 5 insertions(+), 318 deletions(-)
 delete mode 100644 include/trace/events/random.h

-- 
2.35.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/3] random: remove ifdef'd out interrupt bench
  2022-02-10 15:50 [PATCH 0/3] random: maintenance administrivia Jason A. Donenfeld
@ 2022-02-10 15:50 ` Jason A. Donenfeld
  2022-02-10 16:43   ` Dominik Brodowski
  2022-02-21  4:26   ` Eric Biggers
  2022-02-10 15:50 ` [PATCH 2/3] random: remove unused tracepoints Jason A. Donenfeld
  2022-02-10 15:50 ` [PATCH 3/3] random: add proper SPDX header Jason A. Donenfeld
  2 siblings, 2 replies; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 15:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jason A. Donenfeld, Theodore Ts'o, Dominik Brodowski

With tools like kbench9000 giving more finegrained responses, and this
basically never having been used ever since it was initially added,
let's just get rid of this. There *is* still work to be done on the
interrupt handler, but this really isn't the way it's being developed.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 57d36f13e3a6..cf535596d1bc 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -240,8 +240,6 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/random.h>
 
-/* #define ADD_INTERRUPT_BENCH */
-
 enum {
 	POOL_BITS = BLAKE2S_HASH_SIZE * 8,
 	POOL_MIN_BITS = POOL_BITS /* No point in settling for less. */
@@ -806,27 +804,6 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
 
 static DEFINE_PER_CPU(struct fast_pool, irq_randomness);
 
-#ifdef ADD_INTERRUPT_BENCH
-static unsigned long avg_cycles, avg_deviation;
-
-#define AVG_SHIFT 8 /* Exponential average factor k=1/256 */
-#define FIXED_1_2 (1 << (AVG_SHIFT - 1))
-
-static void add_interrupt_bench(cycles_t start)
-{
-	long delta = random_get_entropy() - start;
-
-	/* Use a weighted moving average */
-	delta = delta - ((avg_cycles + FIXED_1_2) >> AVG_SHIFT);
-	avg_cycles += delta;
-	/* And average deviation */
-	delta = abs(delta) - ((avg_deviation + FIXED_1_2) >> AVG_SHIFT);
-	avg_deviation += delta;
-}
-#else
-#define add_interrupt_bench(x)
-#endif
-
 static u32 get_reg(struct fast_pool *f, struct pt_regs *regs)
 {
 	u32 *ptr = (u32 *)regs;
@@ -885,7 +862,6 @@ void add_interrupt_randomness(int irq)
 		(sizeof(ip) > 4) ? ip >> 32 : get_reg(fast_pool, regs);
 
 	fast_mix(fast_pool);
-	add_interrupt_bench(cycles);
 	new_count = ++fast_pool->count;
 
 	if (unlikely(crng_init == 0)) {
@@ -1595,22 +1571,6 @@ static struct ctl_table random_table[] = {
 		.mode		= 0444,
 		.proc_handler	= proc_do_uuid,
 	},
-#ifdef ADD_INTERRUPT_BENCH
-	{
-		.procname	= "add_interrupt_avg_cycles",
-		.data		= &avg_cycles,
-		.maxlen		= sizeof(avg_cycles),
-		.mode		= 0444,
-		.proc_handler	= proc_doulongvec_minmax,
-	},
-	{
-		.procname	= "add_interrupt_avg_deviation",
-		.data		= &avg_deviation,
-		.maxlen		= sizeof(avg_deviation),
-		.mode		= 0444,
-		.proc_handler	= proc_doulongvec_minmax,
-	},
-#endif
 	{ }
 };
 
-- 
2.35.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/3] random: remove unused tracepoints
  2022-02-10 15:50 [PATCH 0/3] random: maintenance administrivia Jason A. Donenfeld
  2022-02-10 15:50 ` [PATCH 1/3] random: remove ifdef'd out interrupt bench Jason A. Donenfeld
@ 2022-02-10 15:50 ` Jason A. Donenfeld
  2022-02-10 16:43   ` Dominik Brodowski
  2022-02-21  4:28   ` Eric Biggers
  2022-02-10 15:50 ` [PATCH 3/3] random: add proper SPDX header Jason A. Donenfeld
  2 siblings, 2 replies; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 15:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jason A. Donenfeld, Theodore Ts'o, Dominik Brodowski

These explicit tracepoints aren't really used and show sign of aging.
It's work to keep these up to date, and before I attempted to keep them
up to date, they weren't up to date, which indicates that they're not
really used. These days there are better ways of introspecting anyway.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c         |  30 +----
 include/trace/events/random.h | 206 ----------------------------------
 lib/random32.c                |   2 -
 3 files changed, 3 insertions(+), 235 deletions(-)
 delete mode 100644 include/trace/events/random.h

diff --git a/drivers/char/random.c b/drivers/char/random.c
index cf535596d1bc..30a3c0717e3e 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -237,9 +237,6 @@
 #include <asm/irq_regs.h>
 #include <asm/io.h>
 
-#define CREATE_TRACE_POINTS
-#include <trace/events/random.h>
-
 enum {
 	POOL_BITS = BLAKE2S_HASH_SIZE * 8,
 	POOL_MIN_BITS = POOL_BITS /* No point in settling for less. */
@@ -315,7 +312,6 @@ static void mix_pool_bytes(const void *in, size_t nbytes)
 {
 	unsigned long flags;
 
-	trace_mix_pool_bytes(nbytes, _RET_IP_);
 	spin_lock_irqsave(&input_pool.lock, flags);
 	_mix_pool_bytes(in, nbytes);
 	spin_unlock_irqrestore(&input_pool.lock, flags);
@@ -390,8 +386,6 @@ static void credit_entropy_bits(size_t nbits)
 		entropy_count = min_t(unsigned int, POOL_BITS, orig + add);
 	} while (cmpxchg(&input_pool.entropy_count, orig, entropy_count) != orig);
 
-	trace_credit_entropy_bits(nbits, entropy_count, _RET_IP_);
-
 	if (crng_init < 2 && entropy_count >= POOL_MIN_BITS)
 		crng_reseed();
 }
@@ -719,7 +713,6 @@ void add_device_randomness(const void *buf, size_t size)
 	if (!crng_ready() && size)
 		crng_slow_load(buf, size);
 
-	trace_add_device_randomness(size, _RET_IP_);
 	spin_lock_irqsave(&input_pool.lock, flags);
 	_mix_pool_bytes(buf, size);
 	_mix_pool_bytes(&time, sizeof(time));
@@ -798,7 +791,6 @@ void add_input_randomness(unsigned int type, unsigned int code,
 	last_value = value;
 	add_timer_randomness(&input_timer_state,
 			     (type << 4) ^ code ^ (code >> 4) ^ value);
-	trace_add_input_randomness(input_pool.entropy_count);
 }
 EXPORT_SYMBOL_GPL(add_input_randomness);
 
@@ -900,7 +892,6 @@ void add_disk_randomness(struct gendisk *disk)
 		return;
 	/* first major is 1, so we get >= 0x200 here */
 	add_timer_randomness(disk->random, 0x100 + disk_devt(disk));
-	trace_add_disk_randomness(disk_devt(disk), input_pool.entropy_count);
 }
 EXPORT_SYMBOL_GPL(add_disk_randomness);
 #endif
@@ -925,8 +916,6 @@ static void extract_entropy(void *buf, size_t nbytes)
 	} block;
 	size_t i;
 
-	trace_extract_entropy(nbytes, input_pool.entropy_count);
-
 	for (i = 0; i < ARRAY_SIZE(block.rdseed); ++i) {
 		if (!arch_get_random_seed_long(&block.rdseed[i]) &&
 		    !arch_get_random_long(&block.rdseed[i]))
@@ -998,8 +987,6 @@ static void _get_random_bytes(void *buf, size_t nbytes)
 	u8 tmp[CHACHA_BLOCK_SIZE];
 	size_t len;
 
-	trace_get_random_bytes(nbytes, _RET_IP_);
-
 	if (!nbytes)
 		return;
 
@@ -1197,7 +1184,6 @@ size_t __must_check get_random_bytes_arch(void *buf, size_t nbytes)
 	size_t left = nbytes;
 	u8 *p = buf;
 
-	trace_get_random_bytes_arch(left, _RET_IP_);
 	while (left) {
 		unsigned long v;
 		size_t chunk = min_t(size_t, left, sizeof(unsigned long));
@@ -1281,16 +1267,6 @@ void rand_initialize_disk(struct gendisk *disk)
 }
 #endif
 
-static ssize_t urandom_read_nowarn(struct file *file, char __user *buf,
-				   size_t nbytes, loff_t *ppos)
-{
-	ssize_t ret;
-
-	ret = get_random_bytes_user(buf, nbytes);
-	trace_urandom_read(nbytes, input_pool.entropy_count);
-	return ret;
-}
-
 static ssize_t urandom_read(struct file *file, char __user *buf, size_t nbytes,
 			    loff_t *ppos)
 {
@@ -1303,7 +1279,7 @@ static ssize_t urandom_read(struct file *file, char __user *buf, size_t nbytes,
 				  current->comm, nbytes);
 	}
 
-	return urandom_read_nowarn(file, buf, nbytes, ppos);
+	return get_random_bytes_user(buf, nbytes);
 }
 
 static ssize_t random_read(struct file *file, char __user *buf, size_t nbytes,
@@ -1314,7 +1290,7 @@ static ssize_t random_read(struct file *file, char __user *buf, size_t nbytes,
 	ret = wait_for_random_bytes();
 	if (ret != 0)
 		return ret;
-	return urandom_read_nowarn(file, buf, nbytes, ppos);
+	return get_random_bytes_user(buf, nbytes);
 }
 
 static __poll_t random_poll(struct file *file, poll_table *wait)
@@ -1475,7 +1451,7 @@ SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, unsigned int,
 		if (unlikely(ret))
 			return ret;
 	}
-	return urandom_read_nowarn(NULL, buf, count, NULL);
+	return get_random_bytes_user(buf, count);
 }
 
 /********************************************************************
diff --git a/include/trace/events/random.h b/include/trace/events/random.h
deleted file mode 100644
index dd6e154f9f75..000000000000
--- a/include/trace/events/random.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM random
-
-#if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_RANDOM_H
-
-#include <linux/writeback.h>
-#include <linux/tracepoint.h>
-
-TRACE_EVENT(add_device_randomness,
-	TP_PROTO(size_t bytes, unsigned long IP),
-
-	TP_ARGS(bytes, IP),
-
-	TP_STRUCT__entry(
-		__field(size_t,		bytes	)
-		__field(unsigned long,	IP	)
-	),
-
-	TP_fast_assign(
-		__entry->bytes		= bytes;
-		__entry->IP		= IP;
-	),
-
-	TP_printk("bytes %zu caller %pS",
-		__entry->bytes, (void *)__entry->IP)
-);
-
-DECLARE_EVENT_CLASS(random__mix_pool_bytes,
-	TP_PROTO(size_t bytes, unsigned long IP),
-
-	TP_ARGS(bytes, IP),
-
-	TP_STRUCT__entry(
-		__field(size_t,		bytes	)
-		__field(unsigned long,	IP	)
-	),
-
-	TP_fast_assign(
-		__entry->bytes		= bytes;
-		__entry->IP		= IP;
-	),
-
-	TP_printk("input pool: bytes %zu caller %pS",
-		  __entry->bytes, (void *)__entry->IP)
-);
-
-DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
-	TP_PROTO(size_t bytes, unsigned long IP),
-
-	TP_ARGS(bytes, IP)
-);
-
-TRACE_EVENT(credit_entropy_bits,
-	TP_PROTO(size_t bits, size_t entropy_count, unsigned long IP),
-
-	TP_ARGS(bits, entropy_count, IP),
-
-	TP_STRUCT__entry(
-		__field(size_t,		bits			)
-		__field(size_t,		entropy_count		)
-		__field(unsigned long,	IP			)
-	),
-
-	TP_fast_assign(
-		__entry->bits		= bits;
-		__entry->entropy_count	= entropy_count;
-		__entry->IP		= IP;
-	),
-
-	TP_printk("input pool: bits %zu entropy_count %zu caller %pS",
-		  __entry->bits, __entry->entropy_count, (void *)__entry->IP)
-);
-
-TRACE_EVENT(add_input_randomness,
-	TP_PROTO(size_t input_bits),
-
-	TP_ARGS(input_bits),
-
-	TP_STRUCT__entry(
-		__field(size_t,	input_bits		)
-	),
-
-	TP_fast_assign(
-		__entry->input_bits	= input_bits;
-	),
-
-	TP_printk("input_pool_bits %zu", __entry->input_bits)
-);
-
-TRACE_EVENT(add_disk_randomness,
-	TP_PROTO(dev_t dev, size_t input_bits),
-
-	TP_ARGS(dev, input_bits),
-
-	TP_STRUCT__entry(
-		__field(dev_t,		dev			)
-		__field(size_t,		input_bits		)
-	),
-
-	TP_fast_assign(
-		__entry->dev		= dev;
-		__entry->input_bits	= input_bits;
-	),
-
-	TP_printk("dev %d,%d input_pool_bits %zu", MAJOR(__entry->dev),
-		  MINOR(__entry->dev), __entry->input_bits)
-);
-
-DECLARE_EVENT_CLASS(random__get_random_bytes,
-	TP_PROTO(size_t nbytes, unsigned long IP),
-
-	TP_ARGS(nbytes, IP),
-
-	TP_STRUCT__entry(
-		__field(size_t,		nbytes			)
-		__field(unsigned long,	IP			)
-	),
-
-	TP_fast_assign(
-		__entry->nbytes		= nbytes;
-		__entry->IP		= IP;
-	),
-
-	TP_printk("nbytes %zu caller %pS", __entry->nbytes, (void *)__entry->IP)
-);
-
-DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
-	TP_PROTO(size_t nbytes, unsigned long IP),
-
-	TP_ARGS(nbytes, IP)
-);
-
-DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
-	TP_PROTO(size_t nbytes, unsigned long IP),
-
-	TP_ARGS(nbytes, IP)
-);
-
-DECLARE_EVENT_CLASS(random__extract_entropy,
-	TP_PROTO(size_t nbytes, size_t entropy_count),
-
-	TP_ARGS(nbytes, entropy_count),
-
-	TP_STRUCT__entry(
-		__field(  size_t,	nbytes			)
-		__field(  size_t,	entropy_count		)
-	),
-
-	TP_fast_assign(
-		__entry->nbytes		= nbytes;
-		__entry->entropy_count	= entropy_count;
-	),
-
-	TP_printk("input pool: nbytes %zu entropy_count %zu",
-		  __entry->nbytes, __entry->entropy_count)
-);
-
-
-DEFINE_EVENT(random__extract_entropy, extract_entropy,
-	TP_PROTO(size_t nbytes, size_t entropy_count),
-
-	TP_ARGS(nbytes, entropy_count)
-);
-
-TRACE_EVENT(urandom_read,
-	TP_PROTO(size_t nbytes, size_t entropy_count),
-
-	TP_ARGS(nbytes, entropy_count),
-
-	TP_STRUCT__entry(
-		__field( size_t,	nbytes		)
-		__field( size_t,	entropy_count	)
-	),
-
-	TP_fast_assign(
-		__entry->nbytes		= nbytes;
-		__entry->entropy_count	= entropy_count;
-	),
-
-	TP_printk("reading: nbytes %zu entropy_count %zu",
-		  __entry->nbytes, __entry->entropy_count)
-);
-
-TRACE_EVENT(prandom_u32,
-
-	TP_PROTO(unsigned int ret),
-
-	TP_ARGS(ret),
-
-	TP_STRUCT__entry(
-		__field(   unsigned int, ret)
-	),
-
-	TP_fast_assign(
-		__entry->ret = ret;
-	),
-
-	TP_printk("ret=%u" , __entry->ret)
-);
-
-#endif /* _TRACE_RANDOM_H */
-
-/* This part must be outside protection */
-#include <trace/define_trace.h>
diff --git a/lib/random32.c b/lib/random32.c
index a57a0e18819d..3c19820796d0 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -41,7 +41,6 @@
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <asm/unaligned.h>
-#include <trace/events/random.h>
 
 /**
  *	prandom_u32_state - seeded pseudo-random number generator.
@@ -387,7 +386,6 @@ u32 prandom_u32(void)
 	struct siprand_state *state = get_cpu_ptr(&net_rand_state);
 	u32 res = siprand_u32(state);
 
-	trace_prandom_u32(res);
 	put_cpu_ptr(&net_rand_state);
 	return res;
 }
-- 
2.35.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/3] random: add proper SPDX header
  2022-02-10 15:50 [PATCH 0/3] random: maintenance administrivia Jason A. Donenfeld
  2022-02-10 15:50 ` [PATCH 1/3] random: remove ifdef'd out interrupt bench Jason A. Donenfeld
  2022-02-10 15:50 ` [PATCH 2/3] random: remove unused tracepoints Jason A. Donenfeld
@ 2022-02-10 15:50 ` Jason A. Donenfeld
  2022-02-10 16:10   ` Jason A. Donenfeld
  2 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 15:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jason A. Donenfeld, Greg Kroah-Hartman, Theodore Ts'o,
	Dominik Brodowski

Somehow this file missed the SPDXification efforts several years ago.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c  | 40 ++--------------------------------------
 include/linux/random.h |  5 -----
 2 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 30a3c0717e3e..77131f7b0f06 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1,44 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * random.c -- A strong random number generator
- *
  * Copyright (C) 2017-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
- *
  * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
- *
- * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All
- * rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * ALTERNATIVELY, this product may be distributed under the terms of
- * the GNU General Public License, in which case the provisions of the GPL are
- * required INSTEAD OF the above restrictions.  (This clause is
- * necessary due to a potential bad interaction between the GPL and
- * the restrictions contained in a BSD-style copyright.)
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
+ * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All rights reserved.
  */
 
 /*
diff --git a/include/linux/random.h b/include/linux/random.h
index e92efb39779c..1a6861aa1277 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -1,9 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-/*
- * include/linux/random.h
- *
- * Include file for the random number generator.
- */
 #ifndef _LINUX_RANDOM_H
 #define _LINUX_RANDOM_H
 
-- 
2.35.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/3] random: add proper SPDX header
  2022-02-10 15:50 ` [PATCH 3/3] random: add proper SPDX header Jason A. Donenfeld
@ 2022-02-10 16:10   ` Jason A. Donenfeld
  2022-02-10 16:16     ` [PATCH v2] " Jason A. Donenfeld
  0 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 16:10 UTC (permalink / raw)
  To: LKML; +Cc: Greg Kroah-Hartman, Theodore Ts'o, Dominik Brodowski

Somebody pointed out to me online that the original license here was
closer to BSD. I'll resubmit this, and also get linux-spdx on the
thread, as we should be careful about this.

Jason

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2] random: add proper SPDX header
  2022-02-10 16:10   ` Jason A. Donenfeld
@ 2022-02-10 16:16     ` Jason A. Donenfeld
  2022-02-10 16:49       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 16:16 UTC (permalink / raw)
  To: linux-kernel, linux-spdx
  Cc: Jason A. Donenfeld, Thomas Gleixner, Greg Kroah-Hartman,
	Theodore Ts'o, Dominik Brodowski

Somehow this file missed the SPDXification efforts several years ago.
Convert the current license into "(GPL-2.0-or-later OR BSD-3-Clause)".

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
Hi SPDX List,

I think I got this conversion right, but I would certainly appreciate a
review on this from somebody with more legal expertise than me.

Thanks,
Jason

 drivers/char/random.c  | 40 ++--------------------------------------
 include/linux/random.h |  5 -----
 2 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 324574b03120..a2bbae5a693d 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1,44 +1,8 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause)
 /*
- * random.c -- A strong random number generator
- *
  * Copyright (C) 2017-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
- *
  * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
- *
- * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All
- * rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * ALTERNATIVELY, this product may be distributed under the terms of
- * the GNU General Public License, in which case the provisions of the GPL are
- * required INSTEAD OF the above restrictions.  (This clause is
- * necessary due to a potential bad interaction between the GPL and
- * the restrictions contained in a BSD-style copyright.)
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
+ * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All rights reserved.
  */
 
 /*
diff --git a/include/linux/random.h b/include/linux/random.h
index e92efb39779c..1a6861aa1277 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -1,9 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-/*
- * include/linux/random.h
- *
- * Include file for the random number generator.
- */
 #ifndef _LINUX_RANDOM_H
 #define _LINUX_RANDOM_H
 
-- 
2.35.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/3] random: remove ifdef'd out interrupt bench
  2022-02-10 15:50 ` [PATCH 1/3] random: remove ifdef'd out interrupt bench Jason A. Donenfeld
@ 2022-02-10 16:43   ` Dominik Brodowski
  2022-02-21  4:26   ` Eric Biggers
  1 sibling, 0 replies; 19+ messages in thread
From: Dominik Brodowski @ 2022-02-10 16:43 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-kernel, Theodore Ts'o

Am Thu, Feb 10, 2022 at 04:50:10PM +0100 schrieb Jason A. Donenfeld:
> With tools like kbench9000 giving more finegrained responses, and this
> basically never having been used ever since it was initially added,
> let's just get rid of this. There *is* still work to be done on the
> interrupt handler, but this really isn't the way it's being developed.
> 
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

	Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] random: remove unused tracepoints
  2022-02-10 15:50 ` [PATCH 2/3] random: remove unused tracepoints Jason A. Donenfeld
@ 2022-02-10 16:43   ` Dominik Brodowski
  2022-02-21  4:28   ` Eric Biggers
  1 sibling, 0 replies; 19+ messages in thread
From: Dominik Brodowski @ 2022-02-10 16:43 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-kernel, Theodore Ts'o

Am Thu, Feb 10, 2022 at 04:50:11PM +0100 schrieb Jason A. Donenfeld:
> These explicit tracepoints aren't really used and show sign of aging.
> It's work to keep these up to date, and before I attempted to keep them
> up to date, they weren't up to date, which indicates that they're not
> really used. These days there are better ways of introspecting anyway.
> 
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

	Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] random: add proper SPDX header
  2022-02-10 16:16     ` [PATCH v2] " Jason A. Donenfeld
@ 2022-02-10 16:49       ` Greg Kroah-Hartman
  2022-02-10 16:53         ` Jason A. Donenfeld
  0 siblings, 1 reply; 19+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-10 16:49 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-kernel, linux-spdx, Thomas Gleixner, Theodore Ts'o,
	Dominik Brodowski

On Thu, Feb 10, 2022 at 05:16:11PM +0100, Jason A. Donenfeld wrote:
> Somehow this file missed the SPDXification efforts several years ago.

That is because it required manual review.

> Convert the current license into "(GPL-2.0-or-later OR BSD-3-Clause)".
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> Hi SPDX List,
> 
> I think I got this conversion right, but I would certainly appreciate a
> review on this from somebody with more legal expertise than me.

Where did the "or later" come from?  I don't see that in the original
text.

> 
> Thanks,
> Jason
> 
>  drivers/char/random.c  | 40 ++--------------------------------------
>  include/linux/random.h |  5 -----
>  2 files changed, 2 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 324574b03120..a2bbae5a693d 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1,44 +1,8 @@
> +// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause)
>  /*
> - * random.c -- A strong random number generator
> - *
>   * Copyright (C) 2017-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
> - *
>   * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
> - *
> - * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All
> - * rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, and the entire permission notice in its entirety,
> - *    including the disclaimer of warranties.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - * 3. The name of the author may not be used to endorse or promote
> - *    products derived from this software without specific prior
> - *    written permission.

BSD-3, great.

> - *
> - * ALTERNATIVELY, this product may be distributed under the terms of
> - * the GNU General Public License, in which case the provisions of the GPL are
> - * required INSTEAD OF the above restrictions.  (This clause is
> - * necessary due to a potential bad interaction between the GPL and
> - * the restrictions contained in a BSD-style copyright.)

I do not see a "or later" here.


> - *
> - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
> - * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
> - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
> - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> - * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
> - * DAMAGE.
> + * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All rights reserved.

Why break the line-wrap?



>   */
>  
>  /*
> diff --git a/include/linux/random.h b/include/linux/random.h
> index e92efb39779c..1a6861aa1277 100644
> --- a/include/linux/random.h
> +++ b/include/linux/random.h
> @@ -1,9 +1,4 @@
>  /* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * include/linux/random.h
> - *
> - * Include file for the random number generator.
> - */

This doesn't have to do with the SPDX change in the other file, it
belongs in a different patch, sorry.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] random: add proper SPDX header
  2022-02-10 16:49       ` Greg Kroah-Hartman
@ 2022-02-10 16:53         ` Jason A. Donenfeld
  2022-02-10 17:00           ` Greg Kroah-Hartman
  0 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 16:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: LKML, linux-spdx, Thomas Gleixner, Theodore Ts'o, Dominik Brodowski

Hi Greg,

Thanks for the review. Comments are inline below.

On Thu, Feb 10, 2022 at 5:49 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> Where did the "or later" come from?  I don't see that in the original
> text.

Yea, this part seems a little bit ambiguous:

> > - * ALTERNATIVELY, this product may be distributed under the terms of
> > - * the GNU General Public License, in which case the provisions of the GPL are
> > - * required INSTEAD OF the above restrictions.  (This clause is
> > - * necessary due to a potential bad interaction between the GPL and
> > - * the restrictions contained in a BSD-style copyright.)
>
> I do not see a "or later" here.

I don't see a "2.0" either. I think we can infer from context that it
couldn't have been < 2.0. So in the absence of a number, maybe this
means >= 2.0, and hence "or later"? Or since at the time it probably
meant 2.0, do we infer this to mean == 2.0? I really have no idea,
which is why I'm glad this list exists.

It sounds like your perspective is that this is == 2.0?

> > diff --git a/include/linux/random.h b/include/linux/random.h
> > index e92efb39779c..1a6861aa1277 100644
> > --- a/include/linux/random.h
> > +++ b/include/linux/random.h
> > @@ -1,9 +1,4 @@
> >  /* SPDX-License-Identifier: GPL-2.0 */
> > -/*
> > - * include/linux/random.h
> > - *
> > - * Include file for the random number generator.
> > - */
>
> This doesn't have to do with the SPDX change in the other file, it
> belongs in a different patch, sorry.

Ack.

Jason

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] random: add proper SPDX header
  2022-02-10 16:53         ` Jason A. Donenfeld
@ 2022-02-10 17:00           ` Greg Kroah-Hartman
  2022-02-10 17:01             ` Jason A. Donenfeld
  0 siblings, 1 reply; 19+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-10 17:00 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: LKML, linux-spdx, Thomas Gleixner, Theodore Ts'o, Dominik Brodowski

On Thu, Feb 10, 2022 at 05:53:33PM +0100, Jason A. Donenfeld wrote:
> Hi Greg,
> 
> Thanks for the review. Comments are inline below.
> 
> On Thu, Feb 10, 2022 at 5:49 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > Where did the "or later" come from?  I don't see that in the original
> > text.
> 
> Yea, this part seems a little bit ambiguous:
> 
> > > - * ALTERNATIVELY, this product may be distributed under the terms of
> > > - * the GNU General Public License, in which case the provisions of the GPL are
> > > - * required INSTEAD OF the above restrictions.  (This clause is
> > > - * necessary due to a potential bad interaction between the GPL and
> > > - * the restrictions contained in a BSD-style copyright.)
> >
> > I do not see a "or later" here.
> 
> I don't see a "2.0" either. I think we can infer from context that it
> couldn't have been < 2.0. So in the absence of a number, maybe this
> means >= 2.0, and hence "or later"? Or since at the time it probably
> meant 2.0, do we infer this to mean == 2.0? I really have no idea,
> which is why I'm glad this list exists.
> 
> It sounds like your perspective is that this is == 2.0?

Without a "or later" it has to be "2.0" as that is what the overall
kernel license is.  That's what we did for the big SPDX sweep, so that
keeps things being decided in the same manner.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] random: add proper SPDX header
  2022-02-10 17:00           ` Greg Kroah-Hartman
@ 2022-02-10 17:01             ` Jason A. Donenfeld
  2022-02-10 17:06               ` [PATCH v3] " Jason A. Donenfeld
  0 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 17:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: LKML, linux-spdx, Thomas Gleixner, Theodore Ts'o, Dominik Brodowski

On Thu, Feb 10, 2022 at 6:00 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Thu, Feb 10, 2022 at 05:53:33PM +0100, Jason A. Donenfeld wrote:
> > Hi Greg,
> >
> > Thanks for the review. Comments are inline below.
> >
> > On Thu, Feb 10, 2022 at 5:49 PM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > > Where did the "or later" come from?  I don't see that in the original
> > > text.
> >
> > Yea, this part seems a little bit ambiguous:
> >
> > > > - * ALTERNATIVELY, this product may be distributed under the terms of
> > > > - * the GNU General Public License, in which case the provisions of the GPL are
> > > > - * required INSTEAD OF the above restrictions.  (This clause is
> > > > - * necessary due to a potential bad interaction between the GPL and
> > > > - * the restrictions contained in a BSD-style copyright.)
> > >
> > > I do not see a "or later" here.
> >
> > I don't see a "2.0" either. I think we can infer from context that it
> > couldn't have been < 2.0. So in the absence of a number, maybe this
> > means >= 2.0, and hence "or later"? Or since at the time it probably
> > meant 2.0, do we infer this to mean == 2.0? I really have no idea,
> > which is why I'm glad this list exists.
> >
> > It sounds like your perspective is that this is == 2.0?
>
> Without a "or later" it has to be "2.0" as that is what the overall
> kernel license is.  That's what we did for the big SPDX sweep, so that
> keeps things being decided in the same manner.

Sounds good. v3 incoming.

Jason

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v3] random: add proper SPDX header
  2022-02-10 17:01             ` Jason A. Donenfeld
@ 2022-02-10 17:06               ` Jason A. Donenfeld
  2022-02-10 17:12                 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-10 17:06 UTC (permalink / raw)
  To: linux-kernel, linux-spdx
  Cc: Jason A. Donenfeld, Thomas Gleixner, Greg Kroah-Hartman,
	Theodore Ts'o, Dominik Brodowski

Convert the current license into the SPDX notation of "(GPL-2.0 OR
BSD-3-Clause)". This infers GPL-2.0 from the text "ALTERNATIVELY, this
product may be distributed under the terms of the GNU General Public
License, in which case the provisions of the GPL are required INSTEAD OF
the above restrictions" and it infers BSD-3-Clause from the verbatim
BSD 3 clause license in the file.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
Changes v2->v3:
- GPL-2.0-or-later is now a vanilla GPL-2.0.
- Remove non-license changes.

 drivers/char/random.c | 37 +------------------------------------
 1 file changed, 1 insertion(+), 36 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 324574b03120..ea4a89129865 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1,44 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
 /*
- * random.c -- A strong random number generator
- *
  * Copyright (C) 2017-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
- *
  * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
- *
  * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999.  All
  * rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * ALTERNATIVELY, this product may be distributed under the terms of
- * the GNU General Public License, in which case the provisions of the GPL are
- * required INSTEAD OF the above restrictions.  (This clause is
- * necessary due to a potential bad interaction between the GPL and
- * the restrictions contained in a BSD-style copyright.)
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
  */
 
 /*
-- 
2.35.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v3] random: add proper SPDX header
  2022-02-10 17:06               ` [PATCH v3] " Jason A. Donenfeld
@ 2022-02-10 17:12                 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 19+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-10 17:12 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-kernel, linux-spdx, Thomas Gleixner, Theodore Ts'o,
	Dominik Brodowski

On Thu, Feb 10, 2022 at 06:06:51PM +0100, Jason A. Donenfeld wrote:
> Convert the current license into the SPDX notation of "(GPL-2.0 OR
> BSD-3-Clause)". This infers GPL-2.0 from the text "ALTERNATIVELY, this
> product may be distributed under the terms of the GNU General Public
> License, in which case the provisions of the GPL are required INSTEAD OF
> the above restrictions" and it infers BSD-3-Clause from the verbatim
> BSD 3 clause license in the file.
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> Changes v2->v3:
> - GPL-2.0-or-later is now a vanilla GPL-2.0.
> - Remove non-license changes.
> 
>  drivers/char/random.c | 37 +------------------------------------
>  1 file changed, 1 insertion(+), 36 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/3] random: remove ifdef'd out interrupt bench
  2022-02-10 15:50 ` [PATCH 1/3] random: remove ifdef'd out interrupt bench Jason A. Donenfeld
  2022-02-10 16:43   ` Dominik Brodowski
@ 2022-02-21  4:26   ` Eric Biggers
  2022-02-21  5:18     ` Eric Biggers
  1 sibling, 1 reply; 19+ messages in thread
From: Eric Biggers @ 2022-02-21  4:26 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-kernel, Theodore Ts'o, Dominik Brodowski

On Thu, Feb 10, 2022 at 04:50:10PM +0100, Jason A. Donenfeld wrote:
> With tools like kbench9000 giving more finegrained responses, and this
> basically never having been used ever since it was initially added,
> let's just get rid of this. There *is* still work to be done on the
> interrupt handler, but this really isn't the way it's being developed.
> 
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/char/random.c | 40 ----------------------------------------
>  1 file changed, 40 deletions(-)

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] random: remove unused tracepoints
  2022-02-10 15:50 ` [PATCH 2/3] random: remove unused tracepoints Jason A. Donenfeld
  2022-02-10 16:43   ` Dominik Brodowski
@ 2022-02-21  4:28   ` Eric Biggers
  1 sibling, 0 replies; 19+ messages in thread
From: Eric Biggers @ 2022-02-21  4:28 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-kernel, Theodore Ts'o, Dominik Brodowski

On Thu, Feb 10, 2022 at 04:50:11PM +0100, Jason A. Donenfeld wrote:
> These explicit tracepoints aren't really used and show sign of aging.
> It's work to keep these up to date, and before I attempted to keep them
> up to date, they weren't up to date, which indicates that they're not
> really used. These days there are better ways of introspecting anyway.
> 
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/char/random.c         |  30 +----
>  include/trace/events/random.h | 206 ----------------------------------
>  lib/random32.c                |   2 -
>  3 files changed, 3 insertions(+), 235 deletions(-)
>  delete mode 100644 include/trace/events/random.h

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/3] random: remove ifdef'd out interrupt bench
  2022-02-21  4:26   ` Eric Biggers
@ 2022-02-21  5:18     ` Eric Biggers
  2022-02-21 15:42       ` Jason A. Donenfeld
  0 siblings, 1 reply; 19+ messages in thread
From: Eric Biggers @ 2022-02-21  5:18 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-kernel, Theodore Ts'o, Dominik Brodowski

On Sun, Feb 20, 2022 at 08:27:00PM -0800, Eric Biggers wrote:
> On Thu, Feb 10, 2022 at 04:50:10PM +0100, Jason A. Donenfeld wrote:
> > With tools like kbench9000 giving more finegrained responses, and this
> > basically never having been used ever since it was initially added,
> > let's just get rid of this. There *is* still work to be done on the
> > interrupt handler, but this really isn't the way it's being developed.
> > 
> > Cc: Theodore Ts'o <tytso@mit.edu>
> > Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> >  drivers/char/random.c | 40 ----------------------------------------
> >  1 file changed, 40 deletions(-)
> 
> Reviewed-by: Eric Biggers <ebiggers@google.com>
> 
> - Eric

Actually one comment: there is a reference to ADD_INTERRUPT_BENCH in
Documentation/admin-guide/sysctl/kernel.rst that needs to be removed.

- Eric

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/3] random: remove ifdef'd out interrupt bench
  2022-02-21  5:18     ` Eric Biggers
@ 2022-02-21 15:42       ` Jason A. Donenfeld
  2022-02-21 15:44         ` [PATCH v2] " Jason A. Donenfeld
  0 siblings, 1 reply; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-21 15:42 UTC (permalink / raw)
  To: Eric Biggers; +Cc: LKML, Theodore Ts'o, Dominik Brodowski

On Mon, Feb 21, 2022 at 6:18 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Sun, Feb 20, 2022 at 08:27:00PM -0800, Eric Biggers wrote:
> > On Thu, Feb 10, 2022 at 04:50:10PM +0100, Jason A. Donenfeld wrote:
> > > With tools like kbench9000 giving more finegrained responses, and this
> > > basically never having been used ever since it was initially added,
> > > let's just get rid of this. There *is* still work to be done on the
> > > interrupt handler, but this really isn't the way it's being developed.
> > >
> > > Cc: Theodore Ts'o <tytso@mit.edu>
> > > Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> > > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > > ---
> > >  drivers/char/random.c | 40 ----------------------------------------
> > >  1 file changed, 40 deletions(-)
> >
> > Reviewed-by: Eric Biggers <ebiggers@google.com>
> >
> > - Eric
>
> Actually one comment: there is a reference to ADD_INTERRUPT_BENCH in
> Documentation/admin-guide/sysctl/kernel.rst that needs to be removed.

Thanks, will do.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2] random: remove ifdef'd out interrupt bench
  2022-02-21 15:42       ` Jason A. Donenfeld
@ 2022-02-21 15:44         ` Jason A. Donenfeld
  0 siblings, 0 replies; 19+ messages in thread
From: Jason A. Donenfeld @ 2022-02-21 15:44 UTC (permalink / raw)
  To: ebiggers, linux-kernel
  Cc: Jason A. Donenfeld, Theodore Ts'o, Eric Biggers, Dominik Brodowski

With tools like kbench9000 giving more finegrained responses, and this
basically never having been used ever since it was initially added,
let's just get rid of this. There *is* still work to be done on the
interrupt handler, but this really isn't the way it's being developed.

Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
v2 updates kernel.rst.

 Documentation/admin-guide/sysctl/kernel.rst |  9 -----
 drivers/char/random.c                       | 40 ---------------------
 2 files changed, 49 deletions(-)

diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
index d3c6d9a501a9..5dd660aac0ae 100644
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -1041,15 +1041,6 @@ This is a directory, with the following entries:
   are woken up. This file is writable for compatibility purposes, but
   writing to it has no effect on any RNG behavior.
 
-If ``drivers/char/random.c`` is built with ``ADD_INTERRUPT_BENCH``
-defined, these additional entries are present:
-
-* ``add_interrupt_avg_cycles``: the average number of cycles between
-  interrupts used to feed the pool;
-
-* ``add_interrupt_avg_deviation``: the standard deviation seen on the
-  number of cycles between interrupts used to feed the pool.
-
 
 randomize_va_space
 ==================
diff --git a/drivers/char/random.c b/drivers/char/random.c
index c27ebf707380..35c440a0d83c 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -240,8 +240,6 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/random.h>
 
-/* #define ADD_INTERRUPT_BENCH */
-
 enum {
 	POOL_BITS = BLAKE2S_HASH_SIZE * 8,
 	POOL_MIN_BITS = POOL_BITS /* No point in settling for less. */
@@ -808,27 +806,6 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
 
 static DEFINE_PER_CPU(struct fast_pool, irq_randomness);
 
-#ifdef ADD_INTERRUPT_BENCH
-static unsigned long avg_cycles, avg_deviation;
-
-#define AVG_SHIFT 8 /* Exponential average factor k=1/256 */
-#define FIXED_1_2 (1 << (AVG_SHIFT - 1))
-
-static void add_interrupt_bench(cycles_t start)
-{
-	long delta = random_get_entropy() - start;
-
-	/* Use a weighted moving average */
-	delta = delta - ((avg_cycles + FIXED_1_2) >> AVG_SHIFT);
-	avg_cycles += delta;
-	/* And average deviation */
-	delta = abs(delta) - ((avg_deviation + FIXED_1_2) >> AVG_SHIFT);
-	avg_deviation += delta;
-}
-#else
-#define add_interrupt_bench(x)
-#endif
-
 static u32 get_reg(struct fast_pool *f, struct pt_regs *regs)
 {
 	u32 *ptr = (u32 *)regs;
@@ -865,7 +842,6 @@ void add_interrupt_randomness(int irq)
 		(sizeof(ip) > 4) ? ip >> 32 : get_reg(fast_pool, regs);
 
 	fast_mix(fast_pool);
-	add_interrupt_bench(cycles);
 
 	if (unlikely(crng_init == 0)) {
 		if (fast_pool->count >= 64 &&
@@ -1574,22 +1550,6 @@ static struct ctl_table random_table[] = {
 		.mode		= 0444,
 		.proc_handler	= proc_do_uuid,
 	},
-#ifdef ADD_INTERRUPT_BENCH
-	{
-		.procname	= "add_interrupt_avg_cycles",
-		.data		= &avg_cycles,
-		.maxlen		= sizeof(avg_cycles),
-		.mode		= 0444,
-		.proc_handler	= proc_doulongvec_minmax,
-	},
-	{
-		.procname	= "add_interrupt_avg_deviation",
-		.data		= &avg_deviation,
-		.maxlen		= sizeof(avg_deviation),
-		.mode		= 0444,
-		.proc_handler	= proc_doulongvec_minmax,
-	},
-#endif
 	{ }
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-02-21 15:45 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 15:50 [PATCH 0/3] random: maintenance administrivia Jason A. Donenfeld
2022-02-10 15:50 ` [PATCH 1/3] random: remove ifdef'd out interrupt bench Jason A. Donenfeld
2022-02-10 16:43   ` Dominik Brodowski
2022-02-21  4:26   ` Eric Biggers
2022-02-21  5:18     ` Eric Biggers
2022-02-21 15:42       ` Jason A. Donenfeld
2022-02-21 15:44         ` [PATCH v2] " Jason A. Donenfeld
2022-02-10 15:50 ` [PATCH 2/3] random: remove unused tracepoints Jason A. Donenfeld
2022-02-10 16:43   ` Dominik Brodowski
2022-02-21  4:28   ` Eric Biggers
2022-02-10 15:50 ` [PATCH 3/3] random: add proper SPDX header Jason A. Donenfeld
2022-02-10 16:10   ` Jason A. Donenfeld
2022-02-10 16:16     ` [PATCH v2] " Jason A. Donenfeld
2022-02-10 16:49       ` Greg Kroah-Hartman
2022-02-10 16:53         ` Jason A. Donenfeld
2022-02-10 17:00           ` Greg Kroah-Hartman
2022-02-10 17:01             ` Jason A. Donenfeld
2022-02-10 17:06               ` [PATCH v3] " Jason A. Donenfeld
2022-02-10 17:12                 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.