trace-s390.h 8.2 KB

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