Skip to content

Commit 95e6060

Browse files
committed
random: remove ifdef'd out interrupt bench
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 <[email protected]> Reviewed-by: Eric Biggers <[email protected]> Reviewed-by: Dominik Brodowski <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 0791e8b commit 95e6060

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

Documentation/admin-guide/sysctl/kernel.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,15 +1041,6 @@ This is a directory, with the following entries:
10411041
are woken up. This file is writable for compatibility purposes, but
10421042
writing to it has no effect on any RNG behavior.
10431043

1044-
If ``drivers/char/random.c`` is built with ``ADD_INTERRUPT_BENCH``
1045-
defined, these additional entries are present:
1046-
1047-
* ``add_interrupt_avg_cycles``: the average number of cycles between
1048-
interrupts used to feed the pool;
1049-
1050-
* ``add_interrupt_avg_deviation``: the standard deviation seen on the
1051-
number of cycles between interrupts used to feed the pool.
1052-
10531044

10541045
randomize_va_space
10551046
==================

drivers/char/random.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,6 @@
240240
#define CREATE_TRACE_POINTS
241241
#include <trace/events/random.h>
242242

243-
/* #define ADD_INTERRUPT_BENCH */
244-
245243
enum {
246244
POOL_BITS = BLAKE2S_HASH_SIZE * 8,
247245
POOL_MIN_BITS = POOL_BITS /* No point in settling for less. */
@@ -808,27 +806,6 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
808806

809807
static DEFINE_PER_CPU(struct fast_pool, irq_randomness);
810808

811-
#ifdef ADD_INTERRUPT_BENCH
812-
static unsigned long avg_cycles, avg_deviation;
813-
814-
#define AVG_SHIFT 8 /* Exponential average factor k=1/256 */
815-
#define FIXED_1_2 (1 << (AVG_SHIFT - 1))
816-
817-
static void add_interrupt_bench(cycles_t start)
818-
{
819-
long delta = random_get_entropy() - start;
820-
821-
/* Use a weighted moving average */
822-
delta = delta - ((avg_cycles + FIXED_1_2) >> AVG_SHIFT);
823-
avg_cycles += delta;
824-
/* And average deviation */
825-
delta = abs(delta) - ((avg_deviation + FIXED_1_2) >> AVG_SHIFT);
826-
avg_deviation += delta;
827-
}
828-
#else
829-
#define add_interrupt_bench(x)
830-
#endif
831-
832809
static u32 get_reg(struct fast_pool *f, struct pt_regs *regs)
833810
{
834811
u32 *ptr = (u32 *)regs;
@@ -865,7 +842,6 @@ void add_interrupt_randomness(int irq)
865842
(sizeof(ip) > 4) ? ip >> 32 : get_reg(fast_pool, regs);
866843

867844
fast_mix(fast_pool);
868-
add_interrupt_bench(cycles);
869845

870846
if (unlikely(crng_init == 0)) {
871847
if (fast_pool->count >= 64 &&
@@ -1574,22 +1550,6 @@ static struct ctl_table random_table[] = {
15741550
.mode = 0444,
15751551
.proc_handler = proc_do_uuid,
15761552
},
1577-
#ifdef ADD_INTERRUPT_BENCH
1578-
{
1579-
.procname = "add_interrupt_avg_cycles",
1580-
.data = &avg_cycles,
1581-
.maxlen = sizeof(avg_cycles),
1582-
.mode = 0444,
1583-
.proc_handler = proc_doulongvec_minmax,
1584-
},
1585-
{
1586-
.procname = "add_interrupt_avg_deviation",
1587-
.data = &avg_deviation,
1588-
.maxlen = sizeof(avg_deviation),
1589-
.mode = 0444,
1590-
.proc_handler = proc_doulongvec_minmax,
1591-
},
1592-
#endif
15931553
{ }
15941554
};
15951555

0 commit comments

Comments
 (0)