linux/arch/s390/kvm/trace.h
<<
>>
Prefs
   1#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
   2#define _TRACE_KVM_H
   3
   4#include <linux/tracepoint.h>
   5#include <asm/sigp.h>
   6#include <asm/debug.h>
   7#include <asm/dis.h>
   8
   9#undef TRACE_SYSTEM
  10#define TRACE_SYSTEM kvm
  11#define TRACE_INCLUDE_PATH .
  12#undef TRACE_INCLUDE_FILE
  13#define TRACE_INCLUDE_FILE trace
  14
  15/*
  16 * Helpers for vcpu-specific tracepoints containing the same information
  17 * as s390dbf VCPU_EVENTs.
  18 */
  19#define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu
  20#define VCPU_ARGS_COMMON vcpu
  21#define VCPU_FIELD_COMMON __field(int, id)                      \
  22        __field(unsigned long, pswmask)                         \
  23        __field(unsigned long, pswaddr)
  24#define VCPU_ASSIGN_COMMON do {                                         \
  25        __entry->id = vcpu->vcpu_id;                                    \
  26        __entry->pswmask = vcpu->arch.sie_block->gpsw.mask;             \
  27        __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr;             \
  28        } while (0);
  29#define VCPU_TP_PRINTK(p_str, p_args...)                                \
  30        TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id,           \
  31                  __entry->pswmask, __entry->pswaddr, p_args)
  32
  33/*
  34 * Tracepoints for SIE entry and exit.
  35 */
  36TRACE_EVENT(kvm_s390_sie_enter,
  37            TP_PROTO(VCPU_PROTO_COMMON, int cpuflags),
  38            TP_ARGS(VCPU_ARGS_COMMON, cpuflags),
  39
  40            TP_STRUCT__entry(
  41                    VCPU_FIELD_COMMON
  42                    __field(int, cpuflags)
  43                    ),
  44
  45            TP_fast_assign(
  46                    VCPU_ASSIGN_COMMON
  47                    __entry->cpuflags = cpuflags;
  48                    ),
  49
  50            VCPU_TP_PRINTK("entering sie flags %x", __entry->cpuflags)
  51        );
  52
  53TRACE_EVENT(kvm_s390_sie_fault,
  54            TP_PROTO(VCPU_PROTO_COMMON),
  55            TP_ARGS(VCPU_ARGS_COMMON),
  56
  57            TP_STRUCT__entry(
  58                    VCPU_FIELD_COMMON
  59                    ),
  60
  61            TP_fast_assign(
  62                    VCPU_ASSIGN_COMMON
  63                    ),
  64
  65            VCPU_TP_PRINTK("%s", "fault in sie instruction")
  66        );
  67
  68#define sie_intercept_code                              \
  69        {0x04, "Instruction"},                          \
  70        {0x08, "Program interruption"},                 \
  71        {0x0C, "Instruction and program interruption"}, \
  72        {0x10, "External request"},                     \
  73        {0x14, "External interruption"},                \
  74        {0x18, "I/O request"},                          \
  75        {0x1C, "Wait state"},                           \
  76        {0x20, "Validity"},                             \
  77        {0x28, "Stop request"}
  78
  79TRACE_EVENT(kvm_s390_sie_exit,
  80            TP_PROTO(VCPU_PROTO_COMMON, u8 icptcode),
  81            TP_ARGS(VCPU_ARGS_COMMON, icptcode),
  82
  83            TP_STRUCT__entry(
  84                    VCPU_FIELD_COMMON
  85                    __field(u8, icptcode)
  86                    ),
  87
  88            TP_fast_assign(
  89                    VCPU_ASSIGN_COMMON
  90                    __entry->icptcode = icptcode;
  91                    ),
  92
  93            VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry->icptcode,
  94                           __print_symbolic(__entry->icptcode,
  95                                            sie_intercept_code))
  96        );
  97
  98/*
  99 * Trace point for intercepted instructions.
 100 */
 101TRACE_EVENT(kvm_s390_intercept_instruction,
 102            TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb),
 103            TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb),
 104
 105            TP_STRUCT__entry(
 106                    VCPU_FIELD_COMMON
 107                    __field(__u64, instruction)
 108                    __field(char, insn[8])
 109                    ),
 110
 111            TP_fast_assign(
 112                    VCPU_ASSIGN_COMMON
 113                    __entry->instruction = ((__u64)ipa << 48) |
 114                    ((__u64)ipb << 16);
 115                    ),
 116
 117            VCPU_TP_PRINTK("intercepted instruction %016llx (%s)",
 118                           __entry->instruction,
 119                           insn_to_mnemonic((unsigned char *)
 120                                            &__entry->instruction,
 121                                         __entry->insn, sizeof(__entry->insn)) ?
 122                           "unknown" : __entry->insn)
 123        );
 124
 125/*
 126 * Trace point for intercepted program interruptions.
 127 */
 128TRACE_EVENT(kvm_s390_intercept_prog,
 129            TP_PROTO(VCPU_PROTO_COMMON, __u16 code),
 130            TP_ARGS(VCPU_ARGS_COMMON, code),
 131
 132            TP_STRUCT__entry(
 133                    VCPU_FIELD_COMMON
 134                    __field(__u16, code)
 135                    ),
 136
 137            TP_fast_assign(
 138                    VCPU_ASSIGN_COMMON
 139                    __entry->code = code;
 140                    ),
 141
 142            VCPU_TP_PRINTK("intercepted program interruption %04x",
 143                           __entry->code)
 144        );
 145
 146/*
 147 * Trace point for validity intercepts.
 148 */
 149TRACE_EVENT(kvm_s390_intercept_validity,
 150            TP_PROTO(VCPU_PROTO_COMMON, __u16 viwhy),
 151            TP_ARGS(VCPU_ARGS_COMMON, viwhy),
 152
 153            TP_STRUCT__entry(
 154                    VCPU_FIELD_COMMON
 155                    __field(__u16, viwhy)
 156                    ),
 157
 158            TP_fast_assign(
 159                    VCPU_ASSIGN_COMMON
 160                    __entry->viwhy = viwhy;
 161                    ),
 162
 163            VCPU_TP_PRINTK("got validity intercept %04x", __entry->viwhy)
 164        );
 165
 166/*
 167 * Trace points for instructions that are of special interest.
 168 */
 169
 170#define sigp_order_codes                                        \
 171        {SIGP_SENSE, "sense"},                                  \
 172        {SIGP_EXTERNAL_CALL, "external call"},                  \
 173        {SIGP_EMERGENCY_SIGNAL, "emergency signal"},            \
 174        {SIGP_STOP, "stop"},                                    \
 175        {SIGP_STOP_AND_STORE_STATUS, "stop and store status"},  \
 176        {SIGP_SET_ARCHITECTURE, "set architecture"},            \
 177        {SIGP_SET_PREFIX, "set prefix"},                        \
 178        {SIGP_SENSE_RUNNING, "sense running"},                  \
 179        {SIGP_RESTART, "restart"}
 180
 181TRACE_EVENT(kvm_s390_handle_sigp,
 182            TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr, \
 183                     __u32 parameter),
 184            TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr, parameter),
 185
 186            TP_STRUCT__entry(
 187                    VCPU_FIELD_COMMON
 188                    __field(__u8, order_code)
 189                    __field(__u16, cpu_addr)
 190                    __field(__u32, parameter)
 191                    ),
 192
 193            TP_fast_assign(
 194                    VCPU_ASSIGN_COMMON
 195                    __entry->order_code = order_code;
 196                    __entry->cpu_addr = cpu_addr;
 197                    __entry->parameter = parameter;
 198                    ),
 199
 200            VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \
 201                           "parameter %08x", __entry->order_code,
 202                           __print_symbolic(__entry->order_code,
 203                                            sigp_order_codes),
 204                           __entry->cpu_addr, __entry->parameter)
 205        );
 206
 207#define diagnose_codes                          \
 208        {0x10, "release pages"},                \
 209        {0x44, "time slice end"},               \
 210        {0x308, "ipl functions"},               \
 211        {0x500, "kvm hypercall"},               \
 212        {0x501, "kvm breakpoint"}
 213
 214TRACE_EVENT(kvm_s390_handle_diag,
 215            TP_PROTO(VCPU_PROTO_COMMON, __u16 code),
 216            TP_ARGS(VCPU_ARGS_COMMON, code),
 217
 218            TP_STRUCT__entry(
 219                    VCPU_FIELD_COMMON
 220                    __field(__u16, code)
 221                    ),
 222
 223            TP_fast_assign(
 224                    VCPU_ASSIGN_COMMON
 225                    __entry->code = code;
 226                    ),
 227
 228            VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry->code,
 229                           __print_symbolic(__entry->code, diagnose_codes))
 230        );
 231
 232TRACE_EVENT(kvm_s390_handle_lctl,
 233            TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr),
 234            TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr),
 235
 236            TP_STRUCT__entry(
 237                    VCPU_FIELD_COMMON
 238                    __field(int, g)
 239                    __field(int, reg1)
 240                    __field(int, reg3)
 241                    __field(u64, addr)
 242                    ),
 243
 244            TP_fast_assign(
 245                    VCPU_ASSIGN_COMMON
 246                    __entry->g = g;
 247                    __entry->reg1 = reg1;
 248                    __entry->reg3 = reg3;
 249                    __entry->addr = addr;
 250                    ),
 251
 252            VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx",
 253                           __entry->g ? "lctlg" : "lctl",
 254                           __entry->reg1, __entry->reg3, __entry->addr)
 255        );
 256
 257TRACE_EVENT(kvm_s390_handle_prefix,
 258            TP_PROTO(VCPU_PROTO_COMMON, int set, u32 address),
 259            TP_ARGS(VCPU_ARGS_COMMON, set, address),
 260
 261            TP_STRUCT__entry(
 262                    VCPU_FIELD_COMMON
 263                    __field(int, set)
 264                    __field(u32, address)
 265                    ),
 266
 267            TP_fast_assign(
 268                    VCPU_ASSIGN_COMMON
 269                    __entry->set = set;
 270                    __entry->address = address;
 271                    ),
 272
 273            VCPU_TP_PRINTK("%s prefix to %08x",
 274                           __entry->set ? "setting" : "storing",
 275                           __entry->address)
 276        );
 277
 278TRACE_EVENT(kvm_s390_handle_stap,
 279            TP_PROTO(VCPU_PROTO_COMMON, u64 address),
 280            TP_ARGS(VCPU_ARGS_COMMON, address),
 281
 282            TP_STRUCT__entry(
 283                    VCPU_FIELD_COMMON
 284                    __field(u64, address)
 285                    ),
 286
 287            TP_fast_assign(
 288                    VCPU_ASSIGN_COMMON
 289                    __entry->address = address;
 290                    ),
 291
 292            VCPU_TP_PRINTK("storing cpu address to %016llx",
 293                           __entry->address)
 294        );
 295
 296TRACE_EVENT(kvm_s390_handle_stfl,
 297            TP_PROTO(VCPU_PROTO_COMMON, unsigned int facility_list),
 298            TP_ARGS(VCPU_ARGS_COMMON, facility_list),
 299
 300            TP_STRUCT__entry(
 301                    VCPU_FIELD_COMMON
 302                    __field(unsigned int, facility_list)
 303                    ),
 304
 305            TP_fast_assign(
 306                    VCPU_ASSIGN_COMMON
 307                    __entry->facility_list = facility_list;
 308                    ),
 309
 310            VCPU_TP_PRINTK("store facility list value %08x",
 311                           __entry->facility_list)
 312        );
 313
 314TRACE_EVENT(kvm_s390_handle_stsi,
 315            TP_PROTO(VCPU_PROTO_COMMON, int fc, int sel1, int sel2, u64 addr),
 316            TP_ARGS(VCPU_ARGS_COMMON, fc, sel1, sel2, addr),
 317
 318            TP_STRUCT__entry(
 319                    VCPU_FIELD_COMMON
 320                    __field(int, fc)
 321                    __field(int, sel1)
 322                    __field(int, sel2)
 323                    __field(u64, addr)
 324                    ),
 325
 326            TP_fast_assign(
 327                    VCPU_ASSIGN_COMMON
 328                    __entry->fc = fc;
 329                    __entry->sel1 = sel1;
 330                    __entry->sel2 = sel2;
 331                    __entry->addr = addr;
 332                    ),
 333
 334            VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx",
 335                           __entry->fc, __entry->sel1, __entry->sel2,
 336                           __entry->addr)
 337        );
 338
 339#endif /* _TRACE_KVM_H */
 340
 341/* This part must be outside protection */
 342#include <trace/define_trace.h>
 343