Skip to content

Commit 14c1746

Browse files
committed
random: remove unused tracepoints
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 <[email protected]> Reviewed-by: Dominik Brodowski <[email protected]> Reviewed-by: Eric Biggers <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 95e6060 commit 14c1746

File tree

3 files changed

+3
-241
lines changed

3 files changed

+3
-241
lines changed

drivers/char/random.c

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,6 @@
237237
#include <asm/irq_regs.h>
238238
#include <asm/io.h>
239239

240-
#define CREATE_TRACE_POINTS
241-
#include <trace/events/random.h>
242-
243240
enum {
244241
POOL_BITS = BLAKE2S_HASH_SIZE * 8,
245242
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)
315312
{
316313
unsigned long flags;
317314

318-
trace_mix_pool_bytes(nbytes, _RET_IP_);
319315
spin_lock_irqsave(&input_pool.lock, flags);
320316
_mix_pool_bytes(in, nbytes);
321317
spin_unlock_irqrestore(&input_pool.lock, flags);
@@ -389,8 +385,6 @@ static void credit_entropy_bits(size_t nbits)
389385
entropy_count = min_t(unsigned int, POOL_BITS, orig + add);
390386
} while (cmpxchg(&input_pool.entropy_count, orig, entropy_count) != orig);
391387

392-
trace_credit_entropy_bits(nbits, entropy_count, _RET_IP_);
393-
394388
if (crng_init < 2 && entropy_count >= POOL_MIN_BITS)
395389
crng_reseed();
396390
}
@@ -721,7 +715,6 @@ void add_device_randomness(const void *buf, size_t size)
721715
if (!crng_ready() && size)
722716
crng_slow_load(buf, size);
723717

724-
trace_add_device_randomness(size, _RET_IP_);
725718
spin_lock_irqsave(&input_pool.lock, flags);
726719
_mix_pool_bytes(buf, size);
727720
_mix_pool_bytes(&time, sizeof(time));
@@ -800,7 +793,6 @@ void add_input_randomness(unsigned int type, unsigned int code,
800793
last_value = value;
801794
add_timer_randomness(&input_timer_state,
802795
(type << 4) ^ code ^ (code >> 4) ^ value);
803-
trace_add_input_randomness(input_pool.entropy_count);
804796
}
805797
EXPORT_SYMBOL_GPL(add_input_randomness);
806798

@@ -880,7 +872,6 @@ void add_disk_randomness(struct gendisk *disk)
880872
return;
881873
/* first major is 1, so we get >= 0x200 here */
882874
add_timer_randomness(disk->random, 0x100 + disk_devt(disk));
883-
trace_add_disk_randomness(disk_devt(disk), input_pool.entropy_count);
884875
}
885876
EXPORT_SYMBOL_GPL(add_disk_randomness);
886877
#endif
@@ -905,8 +896,6 @@ static void extract_entropy(void *buf, size_t nbytes)
905896
} block;
906897
size_t i;
907898

908-
trace_extract_entropy(nbytes, input_pool.entropy_count);
909-
910899
for (i = 0; i < ARRAY_SIZE(block.rdseed); ++i) {
911900
if (!arch_get_random_seed_long(&block.rdseed[i]) &&
912901
!arch_get_random_long(&block.rdseed[i]))
@@ -978,8 +967,6 @@ static void _get_random_bytes(void *buf, size_t nbytes)
978967
u8 tmp[CHACHA_BLOCK_SIZE];
979968
size_t len;
980969

981-
trace_get_random_bytes(nbytes, _RET_IP_);
982-
983970
if (!nbytes)
984971
return;
985972

@@ -1176,7 +1163,6 @@ size_t __must_check get_random_bytes_arch(void *buf, size_t nbytes)
11761163
size_t left = nbytes;
11771164
u8 *p = buf;
11781165

1179-
trace_get_random_bytes_arch(left, _RET_IP_);
11801166
while (left) {
11811167
unsigned long v;
11821168
size_t chunk = min_t(size_t, left, sizeof(unsigned long));
@@ -1260,16 +1246,6 @@ void rand_initialize_disk(struct gendisk *disk)
12601246
}
12611247
#endif
12621248

1263-
static ssize_t urandom_read_nowarn(struct file *file, char __user *buf,
1264-
size_t nbytes, loff_t *ppos)
1265-
{
1266-
ssize_t ret;
1267-
1268-
ret = get_random_bytes_user(buf, nbytes);
1269-
trace_urandom_read(nbytes, input_pool.entropy_count);
1270-
return ret;
1271-
}
1272-
12731249
static ssize_t urandom_read(struct file *file, char __user *buf, size_t nbytes,
12741250
loff_t *ppos)
12751251
{
@@ -1282,7 +1258,7 @@ static ssize_t urandom_read(struct file *file, char __user *buf, size_t nbytes,
12821258
current->comm, nbytes);
12831259
}
12841260

1285-
return urandom_read_nowarn(file, buf, nbytes, ppos);
1261+
return get_random_bytes_user(buf, nbytes);
12861262
}
12871263

12881264
static ssize_t random_read(struct file *file, char __user *buf, size_t nbytes,
@@ -1293,7 +1269,7 @@ static ssize_t random_read(struct file *file, char __user *buf, size_t nbytes,
12931269
ret = wait_for_random_bytes();
12941270
if (ret != 0)
12951271
return ret;
1296-
return urandom_read_nowarn(file, buf, nbytes, ppos);
1272+
return get_random_bytes_user(buf, nbytes);
12971273
}
12981274

12991275
static __poll_t random_poll(struct file *file, poll_table *wait)
@@ -1454,7 +1430,7 @@ SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, unsigned int,
14541430
if (unlikely(ret))
14551431
return ret;
14561432
}
1457-
return urandom_read_nowarn(NULL, buf, count, NULL);
1433+
return get_random_bytes_user(buf, count);
14581434
}
14591435

14601436
/********************************************************************

include/trace/events/random.h

Lines changed: 0 additions & 212 deletions
This file was deleted.

lib/random32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <linux/bitops.h>
4242
#include <linux/slab.h>
4343
#include <asm/unaligned.h>
44-
#include <trace/events/random.h>
4544

4645
/**
4746
* prandom_u32_state - seeded pseudo-random number generator.
@@ -387,7 +386,6 @@ u32 prandom_u32(void)
387386
struct siprand_state *state = get_cpu_ptr(&net_rand_state);
388387
u32 res = siprand_u32(state);
389388

390-
trace_prandom_u32(res);
391389
put_cpu_ptr(&net_rand_state);
392390
return res;
393391
}

0 commit comments

Comments
 (0)