xref: /linux/arch/s390/kvm/trace-s390.h (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1 #if !defined(_TRACE_KVMS390_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVMS390_H
3 
4 #include <linux/tracepoint.h>
5 
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM kvm-s390
8 #define TRACE_INCLUDE_PATH .
9 #undef TRACE_INCLUDE_FILE
10 #define TRACE_INCLUDE_FILE trace-s390
11 
12 /*
13  * Trace point for the creation of the kvm instance.
14  */
15 TRACE_EVENT(kvm_s390_create_vm,
16 	    TP_PROTO(unsigned long type),
17 	    TP_ARGS(type),
18 
19 	    TP_STRUCT__entry(
20 		    __field(unsigned long, type)
21 		    ),
22 
23 	    TP_fast_assign(
24 		    __entry->type = type;
25 		    ),
26 
27 	    TP_printk("create vm%s",
28 		      __entry->type & KVM_VM_S390_UCONTROL ? " (UCONTROL)" : "")
29 	);
30 
31 /*
32  * Trace points for creation and destruction of vpcus.
33  */
34 TRACE_EVENT(kvm_s390_create_vcpu,
35 	    TP_PROTO(unsigned int id, struct kvm_vcpu *vcpu,
36 		     struct kvm_s390_sie_block *sie_block),
37 	    TP_ARGS(id, vcpu, sie_block),
38 
39 	    TP_STRUCT__entry(
40 		    __field(unsigned int, id)
41 		    __field(struct kvm_vcpu *, vcpu)
42 		    __field(struct kvm_s390_sie_block *, sie_block)
43 		    ),
44 
45 	    TP_fast_assign(
46 		    __entry->id = id;
47 		    __entry->vcpu = vcpu;
48 		    __entry->sie_block = sie_block;
49 		    ),
50 
51 	    TP_printk("create cpu %d at %p, sie block at %p", __entry->id,
52 		      __entry->vcpu, __entry->sie_block)
53 	);
54 
55 TRACE_EVENT(kvm_s390_destroy_vcpu,
56 	    TP_PROTO(unsigned int id),
57 	    TP_ARGS(id),
58 
59 	    TP_STRUCT__entry(
60 		    __field(unsigned int, id)
61 		    ),
62 
63 	    TP_fast_assign(
64 		    __entry->id = id;
65 		    ),
66 
67 	    TP_printk("destroy cpu %d", __entry->id)
68 	);
69 
70 /*
71  * Trace point for start and stop of vpcus.
72  */
73 TRACE_EVENT(kvm_s390_vcpu_start_stop,
74 	    TP_PROTO(unsigned int id, int state),
75 	    TP_ARGS(id, state),
76 
77 	    TP_STRUCT__entry(
78 		    __field(unsigned int, id)
79 		    __field(int, state)
80 		    ),
81 
82 	    TP_fast_assign(
83 		    __entry->id = id;
84 		    __entry->state = state;
85 		    ),
86 
87 	    TP_printk("%s cpu %d", __entry->state ? "starting" : "stopping",
88 		      __entry->id)
89 	);
90 
91 /*
92  * Trace points for injection of interrupts, either per machine or
93  * per vcpu.
94  */
95 
96 #define kvm_s390_int_type						\
97 	{KVM_S390_SIGP_STOP, "sigp stop"},				\
98 	{KVM_S390_PROGRAM_INT, "program interrupt"},			\
99 	{KVM_S390_SIGP_SET_PREFIX, "sigp set prefix"},			\
100 	{KVM_S390_RESTART, "sigp restart"},				\
101 	{KVM_S390_INT_VIRTIO, "virtio interrupt"},			\
102 	{KVM_S390_INT_SERVICE, "sclp interrupt"},			\
103 	{KVM_S390_INT_EMERGENCY, "sigp emergency"},			\
104 	{KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"}
105 
106 TRACE_EVENT(kvm_s390_inject_vm,
107 	    TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who),
108 	    TP_ARGS(type, parm, parm64, who),
109 
110 	    TP_STRUCT__entry(
111 		    __field(__u32, inttype)
112 		    __field(__u32, parm)
113 		    __field(__u64, parm64)
114 		    __field(int, who)
115 		    ),
116 
117 	    TP_fast_assign(
118 		    __entry->inttype = type & 0x00000000ffffffff;
119 		    __entry->parm = parm;
120 		    __entry->parm64 = parm64;
121 		    __entry->who = who;
122 		    ),
123 
124 	    TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx",
125 		      (__entry->who == 1) ? " (from kernel)" :
126 		      (__entry->who == 2) ? " (from user)" : "",
127 		      __entry->inttype,
128 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
129 		      __entry->parm, __entry->parm64)
130 	);
131 
132 TRACE_EVENT(kvm_s390_inject_vcpu,
133 	    TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64, \
134 		     int who),
135 	    TP_ARGS(id, type, parm, parm64, who),
136 
137 	    TP_STRUCT__entry(
138 		    __field(int, id)
139 		    __field(__u32, inttype)
140 		    __field(__u32, parm)
141 		    __field(__u64, parm64)
142 		    __field(int, who)
143 		    ),
144 
145 	    TP_fast_assign(
146 		    __entry->id = id;
147 		    __entry->inttype = type & 0x00000000ffffffff;
148 		    __entry->parm = parm;
149 		    __entry->parm64 = parm64;
150 		    __entry->who = who;
151 		    ),
152 
153 	    TP_printk("inject%s (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
154 		      (__entry->who == 1) ? " (from kernel)" :
155 		      (__entry->who == 2) ? " (from user)" : "",
156 		      __entry->id, __entry->inttype,
157 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
158 		      __entry->parm, __entry->parm64)
159 	);
160 
161 /*
162  * Trace point for the actual delivery of interrupts.
163  */
164 TRACE_EVENT(kvm_s390_deliver_interrupt,
165 	    TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
166 	    TP_ARGS(id, type, data0, data1),
167 
168 	    TP_STRUCT__entry(
169 		    __field(int, id)
170 		    __field(__u32, inttype)
171 		    __field(__u64, data0)
172 		    __field(__u64, data1)
173 		    ),
174 
175 	    TP_fast_assign(
176 		    __entry->id = id;
177 		    __entry->inttype = type & 0x00000000ffffffff;
178 		    __entry->data0 = data0;
179 		    __entry->data1 = data1;
180 		    ),
181 
182 	    TP_printk("deliver interrupt (vcpu %d): type:%x (%s) "	\
183 		      "data:%08llx %016llx",
184 		      __entry->id, __entry->inttype,
185 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
186 		      __entry->data0, __entry->data1)
187 	);
188 
189 /*
190  * Trace point for resets that may be requested from userspace.
191  */
192 TRACE_EVENT(kvm_s390_request_resets,
193 	    TP_PROTO(__u64 resets),
194 	    TP_ARGS(resets),
195 
196 	    TP_STRUCT__entry(
197 		    __field(__u64, resets)
198 		    ),
199 
200 	    TP_fast_assign(
201 		    __entry->resets = resets;
202 		    ),
203 
204 	    TP_printk("requesting userspace resets %llx",
205 		      __entry->resets)
206 	);
207 
208 /*
209  * Trace point for a vcpu's stop requests.
210  */
211 TRACE_EVENT(kvm_s390_stop_request,
212 	    TP_PROTO(unsigned char stop_irq, unsigned char flags),
213 	    TP_ARGS(stop_irq, flags),
214 
215 	    TP_STRUCT__entry(
216 		    __field(unsigned char, stop_irq)
217 		    __field(unsigned char, flags)
218 		    ),
219 
220 	    TP_fast_assign(
221 		    __entry->stop_irq = stop_irq;
222 		    __entry->flags = flags;
223 		    ),
224 
225 	    TP_printk("stop request, stop irq = %u, flags = %08x",
226 		      __entry->stop_irq, __entry->flags)
227 	);
228 
229 
230 /*
231  * Trace point for enabling channel I/O instruction support.
232  */
233 TRACE_EVENT(kvm_s390_enable_css,
234 	    TP_PROTO(void *kvm),
235 	    TP_ARGS(kvm),
236 
237 	    TP_STRUCT__entry(
238 		    __field(void *, kvm)
239 		    ),
240 
241 	    TP_fast_assign(
242 		    __entry->kvm = kvm;
243 		    ),
244 
245 	    TP_printk("enabling channel I/O support (kvm @ %p)\n",
246 		      __entry->kvm)
247 	);
248 
249 /*
250  * Trace point for enabling and disabling interlocking-and-broadcasting
251  * suppression.
252  */
253 TRACE_EVENT(kvm_s390_enable_disable_ibs,
254 	    TP_PROTO(unsigned int id, int state),
255 	    TP_ARGS(id, state),
256 
257 	    TP_STRUCT__entry(
258 		    __field(unsigned int, id)
259 		    __field(int, state)
260 		    ),
261 
262 	    TP_fast_assign(
263 		    __entry->id = id;
264 		    __entry->state = state;
265 		    ),
266 
267 	    TP_printk("%s ibs on cpu %d",
268 		      __entry->state ? "enabling" : "disabling", __entry->id)
269 	);
270 
271 
272 #endif /* _TRACE_KVMS390_H */
273 
274 /* This part must be outside protection */
275 #include <trace/define_trace.h>
276