random.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM random
  3. #if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_RANDOM_H
  5. #include <linux/writeback.h>
  6. #include <linux/tracepoint.h>
  7. TRACE_EVENT(add_device_randomness,
  8. TP_PROTO(int bytes, unsigned long IP),
  9. TP_ARGS(bytes, IP),
  10. TP_STRUCT__entry(
  11. __field( int, bytes )
  12. __field(unsigned long, IP )
  13. ),
  14. TP_fast_assign(
  15. __entry->bytes = bytes;
  16. __entry->IP = IP;
  17. ),
  18. TP_printk("bytes %d caller %pF",
  19. __entry->bytes, (void *)__entry->IP)
  20. );
  21. DECLARE_EVENT_CLASS(random__mix_pool_bytes,
  22. TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  23. TP_ARGS(pool_name, bytes, IP),
  24. TP_STRUCT__entry(
  25. __field( const char *, pool_name )
  26. __field( int, bytes )
  27. __field(unsigned long, IP )
  28. ),
  29. TP_fast_assign(
  30. __entry->pool_name = pool_name;
  31. __entry->bytes = bytes;
  32. __entry->IP = IP;
  33. ),
  34. TP_printk("%s pool: bytes %d caller %pF",
  35. __entry->pool_name, __entry->bytes, (void *)__entry->IP)
  36. );
  37. DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
  38. TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  39. TP_ARGS(pool_name, bytes, IP)
  40. );
  41. DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
  42. TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  43. TP_ARGS(pool_name, bytes, IP)
  44. );
  45. TRACE_EVENT(credit_entropy_bits,
  46. TP_PROTO(const char *pool_name, int bits, int entropy_count,
  47. int entropy_total, unsigned long IP),
  48. TP_ARGS(pool_name, bits, entropy_count, entropy_total, IP),
  49. TP_STRUCT__entry(
  50. __field( const char *, pool_name )
  51. __field( int, bits )
  52. __field( int, entropy_count )
  53. __field( int, entropy_total )
  54. __field(unsigned long, IP )
  55. ),
  56. TP_fast_assign(
  57. __entry->pool_name = pool_name;
  58. __entry->bits = bits;
  59. __entry->entropy_count = entropy_count;
  60. __entry->entropy_total = entropy_total;
  61. __entry->IP = IP;
  62. ),
  63. TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
  64. "caller %pF", __entry->pool_name, __entry->bits,
  65. __entry->entropy_count, __entry->entropy_total,
  66. (void *)__entry->IP)
  67. );
  68. TRACE_EVENT(push_to_pool,
  69. TP_PROTO(const char *pool_name, int pool_bits, int input_bits),
  70. TP_ARGS(pool_name, pool_bits, input_bits),
  71. TP_STRUCT__entry(
  72. __field( const char *, pool_name )
  73. __field( int, pool_bits )
  74. __field( int, input_bits )
  75. ),
  76. TP_fast_assign(
  77. __entry->pool_name = pool_name;
  78. __entry->pool_bits = pool_bits;
  79. __entry->input_bits = input_bits;
  80. ),
  81. TP_printk("%s: pool_bits %d input_pool_bits %d",
  82. __entry->pool_name, __entry->pool_bits,
  83. __entry->input_bits)
  84. );
  85. DECLARE_EVENT_CLASS(random__get_random_bytes,
  86. TP_PROTO(int nbytes, unsigned long IP),
  87. TP_ARGS(nbytes, IP),
  88. TP_STRUCT__entry(
  89. __field( int, nbytes )
  90. __field(unsigned long, IP )
  91. ),
  92. TP_fast_assign(
  93. __entry->nbytes = nbytes;
  94. __entry->IP = IP;
  95. ),
  96. TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP)
  97. );
  98. DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
  99. TP_PROTO(int nbytes, unsigned long IP),
  100. TP_ARGS(nbytes, IP)
  101. );
  102. DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
  103. TP_PROTO(int nbytes, unsigned long IP),
  104. TP_ARGS(nbytes, IP)
  105. );
  106. DECLARE_EVENT_CLASS(random__extract_entropy,
  107. TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
  108. unsigned long IP),
  109. TP_ARGS(pool_name, nbytes, entropy_count, IP),
  110. TP_STRUCT__entry(
  111. __field( const char *, pool_name )
  112. __field( int, nbytes )
  113. __field( int, entropy_count )
  114. __field(unsigned long, IP )
  115. ),
  116. TP_fast_assign(
  117. __entry->pool_name = pool_name;
  118. __entry->nbytes = nbytes;
  119. __entry->entropy_count = entropy_count;
  120. __entry->IP = IP;
  121. ),
  122. TP_printk("%s pool: nbytes %d entropy_count %d caller %pF",
  123. __entry->pool_name, __entry->nbytes, __entry->entropy_count,
  124. (void *)__entry->IP)
  125. );
  126. DEFINE_EVENT(random__extract_entropy, extract_entropy,
  127. TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
  128. unsigned long IP),
  129. TP_ARGS(pool_name, nbytes, entropy_count, IP)
  130. );
  131. DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
  132. TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
  133. unsigned long IP),
  134. TP_ARGS(pool_name, nbytes, entropy_count, IP)
  135. );
  136. #endif /* _TRACE_RANDOM_H */
  137. /* This part must be outside protection */
  138. #include <trace/define_trace.h>