hv_trace.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. // SPDX-License-Identifier: GPL-2.0
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM hyperv
  4. #if !defined(_HV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _HV_TRACE_H
  6. #include <linux/tracepoint.h>
  7. DECLARE_EVENT_CLASS(vmbus_hdr_msg,
  8. TP_PROTO(const struct vmbus_channel_message_header *hdr),
  9. TP_ARGS(hdr),
  10. TP_STRUCT__entry(__field(unsigned int, msgtype)),
  11. TP_fast_assign(__entry->msgtype = hdr->msgtype;),
  12. TP_printk("msgtype=%u", __entry->msgtype)
  13. );
  14. DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_msg_dpc,
  15. TP_PROTO(const struct vmbus_channel_message_header *hdr),
  16. TP_ARGS(hdr)
  17. );
  18. DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_message,
  19. TP_PROTO(const struct vmbus_channel_message_header *hdr),
  20. TP_ARGS(hdr)
  21. );
  22. TRACE_EVENT(vmbus_onoffer,
  23. TP_PROTO(const struct vmbus_channel_offer_channel *offer),
  24. TP_ARGS(offer),
  25. TP_STRUCT__entry(
  26. __field(u32, child_relid)
  27. __field(u8, monitorid)
  28. __field(u16, is_ddc_int)
  29. __field(u32, connection_id)
  30. __array(char, if_type, 16)
  31. __array(char, if_instance, 16)
  32. __field(u16, chn_flags)
  33. __field(u16, mmio_mb)
  34. __field(u16, sub_idx)
  35. ),
  36. TP_fast_assign(__entry->child_relid = offer->child_relid;
  37. __entry->monitorid = offer->monitorid;
  38. __entry->is_ddc_int = offer->is_dedicated_interrupt;
  39. __entry->connection_id = offer->connection_id;
  40. memcpy(__entry->if_type,
  41. &offer->offer.if_type.b, 16);
  42. memcpy(__entry->if_instance,
  43. &offer->offer.if_instance.b, 16);
  44. __entry->chn_flags = offer->offer.chn_flags;
  45. __entry->mmio_mb = offer->offer.mmio_megabytes;
  46. __entry->sub_idx = offer->offer.sub_channel_index;
  47. ),
  48. TP_printk("child_relid 0x%x, monitorid 0x%x, is_dedicated %d, "
  49. "connection_id 0x%x, if_type %pUl, if_instance %pUl, "
  50. "chn_flags 0x%x, mmio_megabytes %d, sub_channel_index %d",
  51. __entry->child_relid, __entry->monitorid,
  52. __entry->is_ddc_int, __entry->connection_id,
  53. __entry->if_type, __entry->if_instance,
  54. __entry->chn_flags, __entry->mmio_mb,
  55. __entry->sub_idx
  56. )
  57. );
  58. TRACE_EVENT(vmbus_onoffer_rescind,
  59. TP_PROTO(const struct vmbus_channel_rescind_offer *offer),
  60. TP_ARGS(offer),
  61. TP_STRUCT__entry(__field(u32, child_relid)),
  62. TP_fast_assign(__entry->child_relid = offer->child_relid),
  63. TP_printk("child_relid 0x%x", __entry->child_relid)
  64. );
  65. TRACE_EVENT(vmbus_onopen_result,
  66. TP_PROTO(const struct vmbus_channel_open_result *result),
  67. TP_ARGS(result),
  68. TP_STRUCT__entry(
  69. __field(u32, child_relid)
  70. __field(u32, openid)
  71. __field(u32, status)
  72. ),
  73. TP_fast_assign(__entry->child_relid = result->child_relid;
  74. __entry->openid = result->openid;
  75. __entry->status = result->status;
  76. ),
  77. TP_printk("child_relid 0x%x, openid %d, status %d",
  78. __entry->child_relid, __entry->openid, __entry->status
  79. )
  80. );
  81. TRACE_EVENT(vmbus_ongpadl_created,
  82. TP_PROTO(const struct vmbus_channel_gpadl_created *gpadlcreated),
  83. TP_ARGS(gpadlcreated),
  84. TP_STRUCT__entry(
  85. __field(u32, child_relid)
  86. __field(u32, gpadl)
  87. __field(u32, status)
  88. ),
  89. TP_fast_assign(__entry->child_relid = gpadlcreated->child_relid;
  90. __entry->gpadl = gpadlcreated->gpadl;
  91. __entry->status = gpadlcreated->creation_status;
  92. ),
  93. TP_printk("child_relid 0x%x, gpadl 0x%x, creation_status %d",
  94. __entry->child_relid, __entry->gpadl, __entry->status
  95. )
  96. );
  97. TRACE_EVENT(vmbus_ongpadl_torndown,
  98. TP_PROTO(const struct vmbus_channel_gpadl_torndown *gpadltorndown),
  99. TP_ARGS(gpadltorndown),
  100. TP_STRUCT__entry(__field(u32, gpadl)),
  101. TP_fast_assign(__entry->gpadl = gpadltorndown->gpadl),
  102. TP_printk("gpadl 0x%x", __entry->gpadl)
  103. );
  104. TRACE_EVENT(vmbus_onversion_response,
  105. TP_PROTO(const struct vmbus_channel_version_response *response),
  106. TP_ARGS(response),
  107. TP_STRUCT__entry(
  108. __field(u8, ver)
  109. ),
  110. TP_fast_assign(__entry->ver = response->version_supported;
  111. ),
  112. TP_printk("version_supported %d", __entry->ver)
  113. );
  114. TRACE_EVENT(vmbus_request_offers,
  115. TP_PROTO(int ret),
  116. TP_ARGS(ret),
  117. TP_STRUCT__entry(__field(int, ret)),
  118. TP_fast_assign(__entry->ret = ret),
  119. TP_printk("sending ret %d", __entry->ret)
  120. );
  121. TRACE_EVENT(vmbus_open,
  122. TP_PROTO(const struct vmbus_channel_open_channel *msg, int ret),
  123. TP_ARGS(msg, ret),
  124. TP_STRUCT__entry(
  125. __field(u32, child_relid)
  126. __field(u32, openid)
  127. __field(u32, gpadlhandle)
  128. __field(u32, target_vp)
  129. __field(u32, offset)
  130. __field(int, ret)
  131. ),
  132. TP_fast_assign(
  133. __entry->child_relid = msg->child_relid;
  134. __entry->openid = msg->openid;
  135. __entry->gpadlhandle = msg->ringbuffer_gpadlhandle;
  136. __entry->target_vp = msg->target_vp;
  137. __entry->offset = msg->downstream_ringbuffer_pageoffset;
  138. __entry->ret = ret;
  139. ),
  140. TP_printk("sending child_relid 0x%x, openid %d, "
  141. "gpadlhandle 0x%x, target_vp 0x%x, offset 0x%x, ret %d",
  142. __entry->child_relid, __entry->openid,
  143. __entry->gpadlhandle, __entry->target_vp,
  144. __entry->offset, __entry->ret
  145. )
  146. );
  147. TRACE_EVENT(vmbus_close_internal,
  148. TP_PROTO(const struct vmbus_channel_close_channel *msg, int ret),
  149. TP_ARGS(msg, ret),
  150. TP_STRUCT__entry(
  151. __field(u32, child_relid)
  152. __field(int, ret)
  153. ),
  154. TP_fast_assign(
  155. __entry->child_relid = msg->child_relid;
  156. __entry->ret = ret;
  157. ),
  158. TP_printk("sending child_relid 0x%x, ret %d", __entry->child_relid,
  159. __entry->ret)
  160. );
  161. TRACE_EVENT(vmbus_establish_gpadl_header,
  162. TP_PROTO(const struct vmbus_channel_gpadl_header *msg, int ret),
  163. TP_ARGS(msg, ret),
  164. TP_STRUCT__entry(
  165. __field(u32, child_relid)
  166. __field(u32, gpadl)
  167. __field(u16, range_buflen)
  168. __field(u16, rangecount)
  169. __field(int, ret)
  170. ),
  171. TP_fast_assign(
  172. __entry->child_relid = msg->child_relid;
  173. __entry->gpadl = msg->gpadl;
  174. __entry->range_buflen = msg->range_buflen;
  175. __entry->rangecount = msg->rangecount;
  176. __entry->ret = ret;
  177. ),
  178. TP_printk("sending child_relid 0x%x, gpadl 0x%x, range_buflen %d "
  179. "rangecount %d, ret %d",
  180. __entry->child_relid, __entry->gpadl,
  181. __entry->range_buflen, __entry->rangecount, __entry->ret
  182. )
  183. );
  184. TRACE_EVENT(vmbus_establish_gpadl_body,
  185. TP_PROTO(const struct vmbus_channel_gpadl_body *msg, int ret),
  186. TP_ARGS(msg, ret),
  187. TP_STRUCT__entry(
  188. __field(u32, msgnumber)
  189. __field(u32, gpadl)
  190. __field(int, ret)
  191. ),
  192. TP_fast_assign(
  193. __entry->msgnumber = msg->msgnumber;
  194. __entry->gpadl = msg->gpadl;
  195. __entry->ret = ret;
  196. ),
  197. TP_printk("sending msgnumber %d, gpadl 0x%x, ret %d",
  198. __entry->msgnumber, __entry->gpadl, __entry->ret
  199. )
  200. );
  201. TRACE_EVENT(vmbus_teardown_gpadl,
  202. TP_PROTO(const struct vmbus_channel_gpadl_teardown *msg, int ret),
  203. TP_ARGS(msg, ret),
  204. TP_STRUCT__entry(
  205. __field(u32, child_relid)
  206. __field(u32, gpadl)
  207. __field(int, ret)
  208. ),
  209. TP_fast_assign(
  210. __entry->child_relid = msg->child_relid;
  211. __entry->gpadl = msg->gpadl;
  212. __entry->ret = ret;
  213. ),
  214. TP_printk("sending child_relid 0x%x, gpadl 0x%x, ret %d",
  215. __entry->child_relid, __entry->gpadl, __entry->ret
  216. )
  217. );
  218. TRACE_EVENT(vmbus_negotiate_version,
  219. TP_PROTO(const struct vmbus_channel_initiate_contact *msg, int ret),
  220. TP_ARGS(msg, ret),
  221. TP_STRUCT__entry(
  222. __field(u32, ver)
  223. __field(u32, target_vcpu)
  224. __field(int, ret)
  225. __field(u64, int_page)
  226. __field(u64, mon_page1)
  227. __field(u64, mon_page2)
  228. ),
  229. TP_fast_assign(
  230. __entry->ver = msg->vmbus_version_requested;
  231. __entry->target_vcpu = msg->target_vcpu;
  232. __entry->int_page = msg->interrupt_page;
  233. __entry->mon_page1 = msg->monitor_page1;
  234. __entry->mon_page2 = msg->monitor_page2;
  235. __entry->ret = ret;
  236. ),
  237. TP_printk("sending vmbus_version_requested %d, target_vcpu 0x%x, "
  238. "pages %llx:%llx:%llx, ret %d",
  239. __entry->ver, __entry->target_vcpu, __entry->int_page,
  240. __entry->mon_page1, __entry->mon_page2, __entry->ret
  241. )
  242. );
  243. TRACE_EVENT(vmbus_release_relid,
  244. TP_PROTO(const struct vmbus_channel_relid_released *msg, int ret),
  245. TP_ARGS(msg, ret),
  246. TP_STRUCT__entry(
  247. __field(u32, child_relid)
  248. __field(int, ret)
  249. ),
  250. TP_fast_assign(
  251. __entry->child_relid = msg->child_relid;
  252. __entry->ret = ret;
  253. ),
  254. TP_printk("sending child_relid 0x%x, ret %d",
  255. __entry->child_relid, __entry->ret
  256. )
  257. );
  258. TRACE_EVENT(vmbus_send_tl_connect_request,
  259. TP_PROTO(const struct vmbus_channel_tl_connect_request *msg,
  260. int ret),
  261. TP_ARGS(msg, ret),
  262. TP_STRUCT__entry(
  263. __array(char, guest_id, 16)
  264. __array(char, host_id, 16)
  265. __field(int, ret)
  266. ),
  267. TP_fast_assign(
  268. memcpy(__entry->guest_id, &msg->guest_endpoint_id.b, 16);
  269. memcpy(__entry->host_id, &msg->host_service_id.b, 16);
  270. __entry->ret = ret;
  271. ),
  272. TP_printk("sending guest_endpoint_id %pUl, host_service_id %pUl, "
  273. "ret %d",
  274. __entry->guest_id, __entry->host_id, __entry->ret
  275. )
  276. );
  277. DECLARE_EVENT_CLASS(vmbus_channel,
  278. TP_PROTO(const struct vmbus_channel *channel),
  279. TP_ARGS(channel),
  280. TP_STRUCT__entry(__field(u32, relid)),
  281. TP_fast_assign(__entry->relid = channel->offermsg.child_relid),
  282. TP_printk("relid 0x%x", __entry->relid)
  283. );
  284. DEFINE_EVENT(vmbus_channel, vmbus_chan_sched,
  285. TP_PROTO(const struct vmbus_channel *channel),
  286. TP_ARGS(channel)
  287. );
  288. DEFINE_EVENT(vmbus_channel, vmbus_setevent,
  289. TP_PROTO(const struct vmbus_channel *channel),
  290. TP_ARGS(channel)
  291. );
  292. DEFINE_EVENT(vmbus_channel, vmbus_on_event,
  293. TP_PROTO(const struct vmbus_channel *channel),
  294. TP_ARGS(channel)
  295. );
  296. #undef TRACE_INCLUDE_PATH
  297. #define TRACE_INCLUDE_PATH .
  298. #undef TRACE_INCLUDE_FILE
  299. #define TRACE_INCLUDE_FILE hv_trace
  300. #endif /* _HV_TRACE_H */
  301. /* This part must be outside protection */
  302. #include <trace/define_trace.h>