linux/include/trace/events/random.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#undef TRACE_SYSTEM
   3#define TRACE_SYSTEM random
   4
   5#if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
   6#define _TRACE_RANDOM_H
   7
   8#include <linux/writeback.h>
   9#include <linux/tracepoint.h>
  10
  11TRACE_EVENT(add_device_randomness,
  12        TP_PROTO(int bytes, unsigned long IP),
  13
  14        TP_ARGS(bytes, IP),
  15
  16        TP_STRUCT__entry(
  17                __field(          int,  bytes                   )
  18                __field(unsigned long,  IP                      )
  19        ),
  20
  21        TP_fast_assign(
  22                __entry->bytes          = bytes;
  23                __entry->IP             = IP;
  24        ),
  25
  26        TP_printk("bytes %d caller %pS",
  27                __entry->bytes, (void *)__entry->IP)
  28);
  29
  30DECLARE_EVENT_CLASS(random__mix_pool_bytes,
  31        TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  32
  33        TP_ARGS(pool_name, bytes, IP),
  34
  35        TP_STRUCT__entry(
  36                __field( const char *,  pool_name               )
  37                __field(          int,  bytes                   )
  38                __field(unsigned long,  IP                      )
  39        ),
  40
  41        TP_fast_assign(
  42                __entry->pool_name      = pool_name;
  43                __entry->bytes          = bytes;
  44                __entry->IP             = IP;
  45        ),
  46
  47        TP_printk("%s pool: bytes %d caller %pS",
  48                  __entry->pool_name, __entry->bytes, (void *)__entry->IP)
  49);
  50
  51DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
  52        TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  53
  54        TP_ARGS(pool_name, bytes, IP)
  55);
  56
  57DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
  58        TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  59
  60        TP_ARGS(pool_name, bytes, IP)
  61);
  62
  63TRACE_EVENT(credit_entropy_bits,
  64        TP_PROTO(const char *pool_name, int bits, int entropy_count,
  65                 int entropy_total, unsigned long IP),
  66
  67        TP_ARGS(pool_name, bits, entropy_count, entropy_total, IP),
  68
  69        TP_STRUCT__entry(
  70                __field( const char *,  pool_name               )
  71                __field(          int,  bits                    )
  72                __field(          int,  entropy_count           )
  73                __field(          int,  entropy_total           )
  74                __field(unsigned long,  IP                      )
  75        ),
  76
  77        TP_fast_assign(
  78                __entry->pool_name      = pool_name;
  79                __entry->bits           = bits;
  80                __entry->entropy_count  = entropy_count;
  81                __entry->entropy_total  = entropy_total;
  82                __entry->IP             = IP;
  83        ),
  84
  85        TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
  86                  "caller %pS", __entry->pool_name, __entry->bits,
  87                  __entry->entropy_count, __entry->entropy_total,
  88                  (void *)__entry->IP)
  89);
  90
  91TRACE_EVENT(push_to_pool,
  92        TP_PROTO(const char *pool_name, int pool_bits, int input_bits),
  93
  94        TP_ARGS(pool_name, pool_bits, input_bits),
  95
  96        TP_STRUCT__entry(
  97                __field( const char *,  pool_name               )
  98                __field(          int,  pool_bits               )
  99                __field(          int,  input_bits              )
 100        ),
 101
 102        TP_fast_assign(
 103                __entry->pool_name      = pool_name;
 104                __entry->pool_bits      = pool_bits;
 105                __entry->input_bits     = input_bits;
 106        ),
 107
 108        TP_printk("%s: pool_bits %d input_pool_bits %d",
 109                  __entry->pool_name, __entry->pool_bits,
 110                  __entry->input_bits)
 111);
 112
 113TRACE_EVENT(debit_entropy,
 114        TP_PROTO(const char *pool_name, int debit_bits),
 115
 116        TP_ARGS(pool_name, debit_bits),
 117
 118        TP_STRUCT__entry(
 119                __field( const char *,  pool_name               )
 120                __field(          int,  debit_bits              )
 121        ),
 122
 123        TP_fast_assign(
 124                __entry->pool_name      = pool_name;
 125                __entry->debit_bits     = debit_bits;
 126        ),
 127
 128        TP_printk("%s: debit_bits %d", __entry->pool_name,
 129                  __entry->debit_bits)
 130);
 131
 132TRACE_EVENT(add_input_randomness,
 133        TP_PROTO(int input_bits),
 134
 135        TP_ARGS(input_bits),
 136
 137        TP_STRUCT__entry(
 138                __field(          int,  input_bits              )
 139        ),
 140
 141        TP_fast_assign(
 142                __entry->input_bits     = input_bits;
 143        ),
 144
 145        TP_printk("input_pool_bits %d", __entry->input_bits)
 146);
 147
 148TRACE_EVENT(add_disk_randomness,
 149        TP_PROTO(dev_t dev, int input_bits),
 150
 151        TP_ARGS(dev, input_bits),
 152
 153        TP_STRUCT__entry(
 154                __field(        dev_t,  dev                     )
 155                __field(          int,  input_bits              )
 156        ),
 157
 158        TP_fast_assign(
 159                __entry->dev            = dev;
 160                __entry->input_bits     = input_bits;
 161        ),
 162
 163        TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry->dev),
 164                  MINOR(__entry->dev), __entry->input_bits)
 165);
 166
 167TRACE_EVENT(xfer_secondary_pool,
 168        TP_PROTO(const char *pool_name, int xfer_bits, int request_bits,
 169                 int pool_entropy, int input_entropy),
 170
 171        TP_ARGS(pool_name, xfer_bits, request_bits, pool_entropy,
 172                input_entropy),
 173
 174        TP_STRUCT__entry(
 175                __field( const char *,  pool_name               )
 176                __field(          int,  xfer_bits               )
 177                __field(          int,  request_bits            )
 178                __field(          int,  pool_entropy            )
 179                __field(          int,  input_entropy           )
 180        ),
 181
 182        TP_fast_assign(
 183                __entry->pool_name      = pool_name;
 184                __entry->xfer_bits      = xfer_bits;
 185                __entry->request_bits   = request_bits;
 186                __entry->pool_entropy   = pool_entropy;
 187                __entry->input_entropy  = input_entropy;
 188        ),
 189
 190        TP_printk("pool %s xfer_bits %d request_bits %d pool_entropy %d "
 191                  "input_entropy %d", __entry->pool_name, __entry->xfer_bits,
 192                  __entry->request_bits, __entry->pool_entropy,
 193                  __entry->input_entropy)
 194);
 195
 196DECLARE_EVENT_CLASS(random__get_random_bytes,
 197        TP_PROTO(int nbytes, unsigned long IP),
 198
 199        TP_ARGS(nbytes, IP),
 200
 201        TP_STRUCT__entry(
 202                __field(          int,  nbytes                  )
 203                __field(unsigned long,  IP                      )
 204        ),
 205
 206        TP_fast_assign(
 207                __entry->nbytes         = nbytes;
 208                __entry->IP             = IP;
 209        ),
 210
 211        TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP)
 212);
 213
 214DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
 215        TP_PROTO(int nbytes, unsigned long IP),
 216
 217        TP_ARGS(nbytes, IP)
 218);
 219
 220DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
 221        TP_PROTO(int nbytes, unsigned long IP),
 222
 223        TP_ARGS(nbytes, IP)
 224);
 225
 226DECLARE_EVENT_CLASS(random__extract_entropy,
 227        TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
 228                 unsigned long IP),
 229
 230        TP_ARGS(pool_name, nbytes, entropy_count, IP),
 231
 232        TP_STRUCT__entry(
 233                __field( const char *,  pool_name               )
 234                __field(          int,  nbytes                  )
 235                __field(          int,  entropy_count           )
 236                __field(unsigned long,  IP                      )
 237        ),
 238
 239        TP_fast_assign(
 240                __entry->pool_name      = pool_name;
 241                __entry->nbytes         = nbytes;
 242                __entry->entropy_count  = entropy_count;
 243                __entry->IP             = IP;
 244        ),
 245
 246        TP_printk("%s pool: nbytes %d entropy_count %d caller %pS",
 247                  __entry->pool_name, __entry->nbytes, __entry->entropy_count,
 248                  (void *)__entry->IP)
 249);
 250
 251
 252DEFINE_EVENT(random__extract_entropy, extract_entropy,
 253        TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
 254                 unsigned long IP),
 255
 256        TP_ARGS(pool_name, nbytes, entropy_count, IP)
 257);
 258
 259DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
 260        TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
 261                 unsigned long IP),
 262
 263        TP_ARGS(pool_name, nbytes, entropy_count, IP)
 264);
 265
 266TRACE_EVENT(random_read,
 267        TP_PROTO(int got_bits, int need_bits, int pool_left, int input_left),
 268
 269        TP_ARGS(got_bits, need_bits, pool_left, input_left),
 270
 271        TP_STRUCT__entry(
 272                __field(          int,  got_bits                )
 273                __field(          int,  need_bits               )
 274                __field(          int,  pool_left               )
 275                __field(          int,  input_left              )
 276        ),
 277
 278        TP_fast_assign(
 279                __entry->got_bits       = got_bits;
 280                __entry->need_bits      = need_bits;
 281                __entry->pool_left      = pool_left;
 282                __entry->input_left     = input_left;
 283        ),
 284
 285        TP_printk("got_bits %d still_needed_bits %d "
 286                  "blocking_pool_entropy_left %d input_entropy_left %d",
 287                  __entry->got_bits, __entry->got_bits, __entry->pool_left,
 288                  __entry->input_left)
 289);
 290
 291TRACE_EVENT(urandom_read,
 292        TP_PROTO(int got_bits, int pool_left, int input_left),
 293
 294        TP_ARGS(got_bits, pool_left, input_left),
 295
 296        TP_STRUCT__entry(
 297                __field(          int,  got_bits                )
 298                __field(          int,  pool_left               )
 299                __field(          int,  input_left              )
 300        ),
 301
 302        TP_fast_assign(
 303                __entry->got_bits       = got_bits;
 304                __entry->pool_left      = pool_left;
 305                __entry->input_left     = input_left;
 306        ),
 307
 308        TP_printk("got_bits %d nonblocking_pool_entropy_left %d "
 309                  "input_entropy_left %d", __entry->got_bits,
 310                  __entry->pool_left, __entry->input_left)
 311);
 312
 313#endif /* _TRACE_RANDOM_H */
 314
 315/* This part must be outside protection */
 316#include <trace/define_trace.h>
 317