237
237
#include <asm/irq_regs.h>
238
238
#include <asm/io.h>
239
239
240
- #define CREATE_TRACE_POINTS
241
- #include <trace/events/random.h>
242
-
243
240
enum {
244
241
POOL_BITS = BLAKE2S_HASH_SIZE * 8 ,
245
242
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)
315
312
{
316
313
unsigned long flags ;
317
314
318
- trace_mix_pool_bytes (nbytes , _RET_IP_ );
319
315
spin_lock_irqsave (& input_pool .lock , flags );
320
316
_mix_pool_bytes (in , nbytes );
321
317
spin_unlock_irqrestore (& input_pool .lock , flags );
@@ -389,8 +385,6 @@ static void credit_entropy_bits(size_t nbits)
389
385
entropy_count = min_t (unsigned int , POOL_BITS , orig + add );
390
386
} while (cmpxchg (& input_pool .entropy_count , orig , entropy_count ) != orig );
391
387
392
- trace_credit_entropy_bits (nbits , entropy_count , _RET_IP_ );
393
-
394
388
if (crng_init < 2 && entropy_count >= POOL_MIN_BITS )
395
389
crng_reseed ();
396
390
}
@@ -721,7 +715,6 @@ void add_device_randomness(const void *buf, size_t size)
721
715
if (!crng_ready () && size )
722
716
crng_slow_load (buf , size );
723
717
724
- trace_add_device_randomness (size , _RET_IP_ );
725
718
spin_lock_irqsave (& input_pool .lock , flags );
726
719
_mix_pool_bytes (buf , size );
727
720
_mix_pool_bytes (& time , sizeof (time ));
@@ -800,7 +793,6 @@ void add_input_randomness(unsigned int type, unsigned int code,
800
793
last_value = value ;
801
794
add_timer_randomness (& input_timer_state ,
802
795
(type << 4 ) ^ code ^ (code >> 4 ) ^ value );
803
- trace_add_input_randomness (input_pool .entropy_count );
804
796
}
805
797
EXPORT_SYMBOL_GPL (add_input_randomness );
806
798
@@ -880,7 +872,6 @@ void add_disk_randomness(struct gendisk *disk)
880
872
return ;
881
873
/* first major is 1, so we get >= 0x200 here */
882
874
add_timer_randomness (disk -> random , 0x100 + disk_devt (disk ));
883
- trace_add_disk_randomness (disk_devt (disk ), input_pool .entropy_count );
884
875
}
885
876
EXPORT_SYMBOL_GPL (add_disk_randomness );
886
877
#endif
@@ -905,8 +896,6 @@ static void extract_entropy(void *buf, size_t nbytes)
905
896
} block ;
906
897
size_t i ;
907
898
908
- trace_extract_entropy (nbytes , input_pool .entropy_count );
909
-
910
899
for (i = 0 ; i < ARRAY_SIZE (block .rdseed ); ++ i ) {
911
900
if (!arch_get_random_seed_long (& block .rdseed [i ]) &&
912
901
!arch_get_random_long (& block .rdseed [i ]))
@@ -978,8 +967,6 @@ static void _get_random_bytes(void *buf, size_t nbytes)
978
967
u8 tmp [CHACHA_BLOCK_SIZE ];
979
968
size_t len ;
980
969
981
- trace_get_random_bytes (nbytes , _RET_IP_ );
982
-
983
970
if (!nbytes )
984
971
return ;
985
972
@@ -1176,7 +1163,6 @@ size_t __must_check get_random_bytes_arch(void *buf, size_t nbytes)
1176
1163
size_t left = nbytes ;
1177
1164
u8 * p = buf ;
1178
1165
1179
- trace_get_random_bytes_arch (left , _RET_IP_ );
1180
1166
while (left ) {
1181
1167
unsigned long v ;
1182
1168
size_t chunk = min_t (size_t , left , sizeof (unsigned long ));
@@ -1260,16 +1246,6 @@ void rand_initialize_disk(struct gendisk *disk)
1260
1246
}
1261
1247
#endif
1262
1248
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
-
1273
1249
static ssize_t urandom_read (struct file * file , char __user * buf , size_t nbytes ,
1274
1250
loff_t * ppos )
1275
1251
{
@@ -1282,7 +1258,7 @@ static ssize_t urandom_read(struct file *file, char __user *buf, size_t nbytes,
1282
1258
current -> comm , nbytes );
1283
1259
}
1284
1260
1285
- return urandom_read_nowarn ( file , buf , nbytes , ppos );
1261
+ return get_random_bytes_user ( buf , nbytes );
1286
1262
}
1287
1263
1288
1264
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,
1293
1269
ret = wait_for_random_bytes ();
1294
1270
if (ret != 0 )
1295
1271
return ret ;
1296
- return urandom_read_nowarn ( file , buf , nbytes , ppos );
1272
+ return get_random_bytes_user ( buf , nbytes );
1297
1273
}
1298
1274
1299
1275
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,
1454
1430
if (unlikely (ret ))
1455
1431
return ret ;
1456
1432
}
1457
- return urandom_read_nowarn ( NULL , buf , count , NULL );
1433
+ return get_random_bytes_user ( buf , count );
1458
1434
}
1459
1435
1460
1436
/********************************************************************
0 commit comments