trace-s390.h 6.82 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#if !defined(_TRACE_KVMS390_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_KVMS390_H

#include <linux/tracepoint.h>

#undef TRACE_SYSTEM
#define TRACE_SYSTEM kvm-s390
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace-s390

12 13 14 15 16 17 18
/*
 * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
 * legitimate C variable. It is not exported to user space.
 */
#undef TRACE_SYSTEM_VAR
#define TRACE_SYSTEM_VAR kvm_s390

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
/*
 * Trace point for the creation of the kvm instance.
 */
TRACE_EVENT(kvm_s390_create_vm,
	    TP_PROTO(unsigned long type),
	    TP_ARGS(type),

	    TP_STRUCT__entry(
		    __field(unsigned long, type)
		    ),

	    TP_fast_assign(
		    __entry->type = type;
		    ),

	    TP_printk("create vm%s",
		      __entry->type & KVM_VM_S390_UCONTROL ? " (UCONTROL)" : "")
	);

/*
 * Trace points for creation and destruction of vpcus.
 */
TRACE_EVENT(kvm_s390_create_vcpu,
	    TP_PROTO(unsigned int id, struct kvm_vcpu *vcpu,
		     struct kvm_s390_sie_block *sie_block),
	    TP_ARGS(id, vcpu, sie_block),

	    TP_STRUCT__entry(
		    __field(unsigned int, id)
		    __field(struct kvm_vcpu *, vcpu)
		    __field(struct kvm_s390_sie_block *, sie_block)
		    ),

	    TP_fast_assign(
		    __entry->id = id;
		    __entry->vcpu = vcpu;
		    __entry->sie_block = sie_block;
		    ),

	    TP_printk("create cpu %d at %p, sie block at %p", __entry->id,
		      __entry->vcpu, __entry->sie_block)
	);

TRACE_EVENT(kvm_s390_destroy_vcpu,
	    TP_PROTO(unsigned int id),
	    TP_ARGS(id),

	    TP_STRUCT__entry(
		    __field(unsigned int, id)
		    ),

	    TP_fast_assign(
		    __entry->id = id;
		    ),

	    TP_printk("destroy cpu %d", __entry->id)
	);

77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
/*
 * Trace point for start and stop of vpcus.
 */
TRACE_EVENT(kvm_s390_vcpu_start_stop,
	    TP_PROTO(unsigned int id, int state),
	    TP_ARGS(id, state),

	    TP_STRUCT__entry(
		    __field(unsigned int, id)
		    __field(int, state)
		    ),

	    TP_fast_assign(
		    __entry->id = id;
		    __entry->state = state;
		    ),

	    TP_printk("%s cpu %d", __entry->state ? "starting" : "stopping",
		      __entry->id)
	);

98 99 100 101 102 103 104 105 106 107
/*
 * Trace points for injection of interrupts, either per machine or
 * per vcpu.
 */

#define kvm_s390_int_type						\
	{KVM_S390_SIGP_STOP, "sigp stop"},				\
	{KVM_S390_PROGRAM_INT, "program interrupt"},			\
	{KVM_S390_SIGP_SET_PREFIX, "sigp set prefix"},			\
	{KVM_S390_RESTART, "sigp restart"},				\
108 109 110 111 112
	{KVM_S390_INT_PFAULT_INIT, "pfault init"},			\
	{KVM_S390_INT_PFAULT_DONE, "pfault done"},			\
	{KVM_S390_MCHK, "machine check"},				\
	{KVM_S390_INT_CLOCK_COMP, "clock comparator"},			\
	{KVM_S390_INT_CPU_TIMER, "cpu timer"},				\
113 114 115 116 117
	{KVM_S390_INT_VIRTIO, "virtio interrupt"},			\
	{KVM_S390_INT_SERVICE, "sclp interrupt"},			\
	{KVM_S390_INT_EMERGENCY, "sigp emergency"},			\
	{KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"}

118 119 120 121 122 123
#define get_irq_name(__type) \
	(__type > KVM_S390_INT_IO_MAX ? \
	__print_symbolic(__type, kvm_s390_int_type) : \
		(__type & KVM_S390_INT_IO_AI_MASK ? \
		 "adapter I/O interrupt" : "subchannel I/O interrupt"))

124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
TRACE_EVENT(kvm_s390_inject_vm,
	    TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who),
	    TP_ARGS(type, parm, parm64, who),

	    TP_STRUCT__entry(
		    __field(__u32, inttype)
		    __field(__u32, parm)
		    __field(__u64, parm64)
		    __field(int, who)
		    ),

	    TP_fast_assign(
		    __entry->inttype = type & 0x00000000ffffffff;
		    __entry->parm = parm;
		    __entry->parm64 = parm64;
		    __entry->who = who;
		    ),

	    TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx",
		      (__entry->who == 1) ? " (from kernel)" :
		      (__entry->who == 2) ? " (from user)" : "",
145
		      __entry->inttype, get_irq_name(__entry->inttype),
146 147 148 149
		      __entry->parm, __entry->parm64)
	);

TRACE_EVENT(kvm_s390_inject_vcpu,
150 151
	    TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64),
	    TP_ARGS(id, type, parm, parm64),
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166

	    TP_STRUCT__entry(
		    __field(int, id)
		    __field(__u32, inttype)
		    __field(__u32, parm)
		    __field(__u64, parm64)
		    ),

	    TP_fast_assign(
		    __entry->id = id;
		    __entry->inttype = type & 0x00000000ffffffff;
		    __entry->parm = parm;
		    __entry->parm64 = parm64;
		    ),

167
	    TP_printk("inject (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
168
		      __entry->id, __entry->inttype,
169 170
		      get_irq_name(__entry->inttype), __entry->parm,
		      __entry->parm64)
171 172 173 174 175 176
	);

/*
 * Trace point for the actual delivery of interrupts.
 */
TRACE_EVENT(kvm_s390_deliver_interrupt,
177
	    TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
178 179 180 181 182
	    TP_ARGS(id, type, data0, data1),

	    TP_STRUCT__entry(
		    __field(int, id)
		    __field(__u32, inttype)
183
		    __field(__u64, data0)
184 185 186 187 188 189 190 191 192 193 194
		    __field(__u64, data1)
		    ),

	    TP_fast_assign(
		    __entry->id = id;
		    __entry->inttype = type & 0x00000000ffffffff;
		    __entry->data0 = data0;
		    __entry->data1 = data1;
		    ),

	    TP_printk("deliver interrupt (vcpu %d): type:%x (%s) "	\
195
		      "data:%08llx %016llx",
196
		      __entry->id, __entry->inttype,
197 198
		      get_irq_name(__entry->inttype), __entry->data0,
		      __entry->data1)
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
	);

/*
 * Trace point for resets that may be requested from userspace.
 */
TRACE_EVENT(kvm_s390_request_resets,
	    TP_PROTO(__u64 resets),
	    TP_ARGS(resets),

	    TP_STRUCT__entry(
		    __field(__u64, resets)
		    ),

	    TP_fast_assign(
		    __entry->resets = resets;
		    ),

	    TP_printk("requesting userspace resets %llx",
		      __entry->resets)
	);

/*
 * Trace point for a vcpu's stop requests.
 */
TRACE_EVENT(kvm_s390_stop_request,
224 225
	    TP_PROTO(unsigned char stop_irq, unsigned char flags),
	    TP_ARGS(stop_irq, flags),
226 227

	    TP_STRUCT__entry(
228 229
		    __field(unsigned char, stop_irq)
		    __field(unsigned char, flags)
230 231 232
		    ),

	    TP_fast_assign(
233 234
		    __entry->stop_irq = stop_irq;
		    __entry->flags = flags;
235 236
		    ),

237 238
	    TP_printk("stop request, stop irq = %u, flags = %08x",
		      __entry->stop_irq, __entry->flags)
239 240 241
	);


242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
/*
 * Trace point for enabling channel I/O instruction support.
 */
TRACE_EVENT(kvm_s390_enable_css,
	    TP_PROTO(void *kvm),
	    TP_ARGS(kvm),

	    TP_STRUCT__entry(
		    __field(void *, kvm)
		    ),

	    TP_fast_assign(
		    __entry->kvm = kvm;
		    ),

	    TP_printk("enabling channel I/O support (kvm @ %p)\n",
		      __entry->kvm)
	);

261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
/*
 * Trace point for enabling and disabling interlocking-and-broadcasting
 * suppression.
 */
TRACE_EVENT(kvm_s390_enable_disable_ibs,
	    TP_PROTO(unsigned int id, int state),
	    TP_ARGS(id, state),

	    TP_STRUCT__entry(
		    __field(unsigned int, id)
		    __field(int, state)
		    ),

	    TP_fast_assign(
		    __entry->id = id;
		    __entry->state = state;
		    ),

	    TP_printk("%s ibs on cpu %d",
		      __entry->state ? "enabling" : "disabling", __entry->id)
	);

283

284 285 286 287
#endif /* _TRACE_KVMS390_H */

/* This part must be outside protection */
#include <trace/define_trace.h>