mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
2c92ca849f
With the rework of how the __string() handles dynamic strings where it saves off the source string in field in the helper structure[1], the assignment of that value to the trace event field is stored in the helper value and does not need to be passed in again. This means that with: __string(field, mystring) Which use to be assigned with __assign_str(field, mystring), no longer needs the second parameter and it is unused. With this, __assign_str() will now only get a single parameter. There's over 700 users of __assign_str() and because coccinelle does not handle the TRACE_EVENT() macro I ended up using the following sed script: git grep -l __assign_str | while read a ; do sed -e 's/\(__assign_str([^,]*[^ ,]\) *,[^;]*/\1)/' $a > /tmp/test-file; mv /tmp/test-file $a; done I then searched for __assign_str() that did not end with ';' as those were multi line assignments that the sed script above would fail to catch. Note, the same updates will need to be done for: __assign_str_len() __assign_rel_str() __assign_rel_str_len() I tested this with both an allmodconfig and an allyesconfig (build only for both). [1] https://lore.kernel.org/linux-trace-kernel/20240222211442.634192653@goodmis.org/ Link: https://lore.kernel.org/linux-trace-kernel/20240516133454.681ba6a0@rorschach.local.home Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Christian König <christian.koenig@amd.com> for the amdgpu parts. Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #for Acked-by: Rafael J. Wysocki <rafael@kernel.org> # for thermal Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Darrick J. Wong <djwong@kernel.org> # xfs Tested-by: Guenter Roeck <linux@roeck-us.net>
362 lines
8.9 KiB
C
362 lines
8.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Trace point definitions for the RDMA Connect Manager.
|
|
*
|
|
* Author: Chuck Lever <chuck.lever@oracle.com>
|
|
*
|
|
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
|
*/
|
|
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM rdma_cma
|
|
|
|
#if !defined(_TRACE_RDMA_CMA_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
|
|
#define _TRACE_RDMA_CMA_H
|
|
|
|
#include <linux/tracepoint.h>
|
|
#include <trace/misc/rdma.h>
|
|
|
|
|
|
DECLARE_EVENT_CLASS(cma_fsm_class,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv
|
|
),
|
|
|
|
TP_ARGS(id_priv),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__field(u32, tos)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
__entry->tos = id_priv->tos;
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos
|
|
)
|
|
);
|
|
|
|
#define DEFINE_CMA_FSM_EVENT(name) \
|
|
DEFINE_EVENT(cma_fsm_class, cm_##name, \
|
|
TP_PROTO( \
|
|
const struct rdma_id_private *id_priv \
|
|
), \
|
|
TP_ARGS(id_priv))
|
|
|
|
DEFINE_CMA_FSM_EVENT(send_rtu);
|
|
DEFINE_CMA_FSM_EVENT(send_rej);
|
|
DEFINE_CMA_FSM_EVENT(send_mra);
|
|
DEFINE_CMA_FSM_EVENT(send_sidr_req);
|
|
DEFINE_CMA_FSM_EVENT(send_sidr_rep);
|
|
DEFINE_CMA_FSM_EVENT(disconnect);
|
|
DEFINE_CMA_FSM_EVENT(sent_drep);
|
|
DEFINE_CMA_FSM_EVENT(sent_dreq);
|
|
DEFINE_CMA_FSM_EVENT(id_destroy);
|
|
|
|
TRACE_EVENT(cm_id_attach,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv,
|
|
const struct ib_device *device
|
|
),
|
|
|
|
TP_ARGS(id_priv, device),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
__string(devname, device->name)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
__assign_str(devname);
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc device=%s",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr,
|
|
__get_str(devname)
|
|
)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(cma_qp_class,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv
|
|
),
|
|
|
|
TP_ARGS(id_priv),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__field(u32, tos)
|
|
__field(u32, qp_num)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
__entry->tos = id_priv->tos;
|
|
__entry->qp_num = id_priv->qp_num;
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u qp_num=%u",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos,
|
|
__entry->qp_num
|
|
)
|
|
);
|
|
|
|
#define DEFINE_CMA_QP_EVENT(name) \
|
|
DEFINE_EVENT(cma_qp_class, cm_##name, \
|
|
TP_PROTO( \
|
|
const struct rdma_id_private *id_priv \
|
|
), \
|
|
TP_ARGS(id_priv))
|
|
|
|
DEFINE_CMA_QP_EVENT(send_req);
|
|
DEFINE_CMA_QP_EVENT(send_rep);
|
|
DEFINE_CMA_QP_EVENT(qp_destroy);
|
|
|
|
/*
|
|
* enum ib_wp_type, from include/rdma/ib_verbs.h
|
|
*/
|
|
#define IB_QP_TYPE_LIST \
|
|
ib_qp_type(SMI) \
|
|
ib_qp_type(GSI) \
|
|
ib_qp_type(RC) \
|
|
ib_qp_type(UC) \
|
|
ib_qp_type(UD) \
|
|
ib_qp_type(RAW_IPV6) \
|
|
ib_qp_type(RAW_ETHERTYPE) \
|
|
ib_qp_type(RAW_PACKET) \
|
|
ib_qp_type(XRC_INI) \
|
|
ib_qp_type_end(XRC_TGT)
|
|
|
|
#undef ib_qp_type
|
|
#undef ib_qp_type_end
|
|
|
|
#define ib_qp_type(x) TRACE_DEFINE_ENUM(IB_QPT_##x);
|
|
#define ib_qp_type_end(x) TRACE_DEFINE_ENUM(IB_QPT_##x);
|
|
|
|
IB_QP_TYPE_LIST
|
|
|
|
#undef ib_qp_type
|
|
#undef ib_qp_type_end
|
|
|
|
#define ib_qp_type(x) { IB_QPT_##x, #x },
|
|
#define ib_qp_type_end(x) { IB_QPT_##x, #x }
|
|
|
|
#define rdma_show_qp_type(x) \
|
|
__print_symbolic(x, IB_QP_TYPE_LIST)
|
|
|
|
|
|
TRACE_EVENT(cm_qp_create,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv,
|
|
const struct ib_pd *pd,
|
|
const struct ib_qp_init_attr *qp_init_attr,
|
|
int rc
|
|
),
|
|
|
|
TP_ARGS(id_priv, pd, qp_init_attr, rc),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__field(u32, pd_id)
|
|
__field(u32, tos)
|
|
__field(u32, qp_num)
|
|
__field(u32, send_wr)
|
|
__field(u32, recv_wr)
|
|
__field(int, rc)
|
|
__field(unsigned long, qp_type)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
__entry->pd_id = pd->res.id;
|
|
__entry->tos = id_priv->tos;
|
|
__entry->send_wr = qp_init_attr->cap.max_send_wr;
|
|
__entry->recv_wr = qp_init_attr->cap.max_recv_wr;
|
|
__entry->rc = rc;
|
|
if (!rc) {
|
|
__entry->qp_num = id_priv->qp_num;
|
|
__entry->qp_type = id_priv->id.qp_type;
|
|
} else {
|
|
__entry->qp_num = 0;
|
|
__entry->qp_type = 0;
|
|
}
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u pd.id=%u qp_type=%s"
|
|
" send_wr=%u recv_wr=%u qp_num=%u rc=%d",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr,
|
|
__entry->tos, __entry->pd_id,
|
|
rdma_show_qp_type(__entry->qp_type), __entry->send_wr,
|
|
__entry->recv_wr, __entry->qp_num, __entry->rc
|
|
)
|
|
);
|
|
|
|
TRACE_EVENT(cm_req_handler,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv,
|
|
int event
|
|
),
|
|
|
|
TP_ARGS(id_priv, event),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__field(u32, tos)
|
|
__field(unsigned long, event)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
__entry->tos = id_priv->tos;
|
|
__entry->event = event;
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu)",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos,
|
|
rdma_show_ib_cm_event(__entry->event), __entry->event
|
|
)
|
|
);
|
|
|
|
TRACE_EVENT(cm_event_handler,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv,
|
|
const struct rdma_cm_event *event
|
|
),
|
|
|
|
TP_ARGS(id_priv, event),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__field(u32, tos)
|
|
__field(unsigned long, event)
|
|
__field(int, status)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
__entry->tos = id_priv->tos;
|
|
__entry->event = event->event;
|
|
__entry->status = event->status;
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu/%d)",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos,
|
|
rdma_show_cm_event(__entry->event), __entry->event,
|
|
__entry->status
|
|
)
|
|
);
|
|
|
|
TRACE_EVENT(cm_event_done,
|
|
TP_PROTO(
|
|
const struct rdma_id_private *id_priv,
|
|
const struct rdma_cm_event *event,
|
|
int result
|
|
),
|
|
|
|
TP_ARGS(id_priv, event, result),
|
|
|
|
TP_STRUCT__entry(
|
|
__field(u32, cm_id)
|
|
__field(u32, tos)
|
|
__field(unsigned long, event)
|
|
__field(int, result)
|
|
__array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
|
|
__array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->cm_id = id_priv->res.id;
|
|
__entry->tos = id_priv->tos;
|
|
__entry->event = event->event;
|
|
__entry->result = result;
|
|
memcpy(__entry->srcaddr, &id_priv->id.route.addr.src_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
memcpy(__entry->dstaddr, &id_priv->id.route.addr.dst_addr,
|
|
sizeof(struct sockaddr_in6));
|
|
),
|
|
|
|
TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s consumer returns %d",
|
|
__entry->cm_id, __entry->srcaddr, __entry->dstaddr, __entry->tos,
|
|
rdma_show_cm_event(__entry->event), __entry->result
|
|
)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(cma_client_class,
|
|
TP_PROTO(
|
|
const struct ib_device *device
|
|
),
|
|
|
|
TP_ARGS(device),
|
|
|
|
TP_STRUCT__entry(
|
|
__string(name, device->name)
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__assign_str(name);
|
|
),
|
|
|
|
TP_printk("device name=%s",
|
|
__get_str(name)
|
|
)
|
|
);
|
|
|
|
#define DEFINE_CMA_CLIENT_EVENT(name) \
|
|
DEFINE_EVENT(cma_client_class, cm_##name, \
|
|
TP_PROTO( \
|
|
const struct ib_device *device \
|
|
), \
|
|
TP_ARGS(device))
|
|
|
|
DEFINE_CMA_CLIENT_EVENT(add_one);
|
|
DEFINE_CMA_CLIENT_EVENT(remove_one);
|
|
|
|
#endif /* _TRACE_RDMA_CMA_H */
|
|
|
|
#undef TRACE_INCLUDE_PATH
|
|
#define TRACE_INCLUDE_PATH .
|
|
#define TRACE_INCLUDE_FILE cma_trace
|
|
|
|
#include <trace/define_trace.h>
|