From: Linyu Yuan <quic_linyyuan@quicinc.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>, Bin Liu <b-liu@ti.com>,
Peter Chen <peter.chen@kernel.org>,
Pawel Laszczak <pawell@cadence.com>,
Roger Quadros <rogerq@kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, <linux-trace-kernel@vger.kernel.org>,
"Linyu Yuan" <quic_linyyuan@quicinc.com>
Subject: [PATCH 5/8] usb: dwc3: trace: reduce buffer usage of trace event
Date: Thu, 14 Sep 2023 18:02:59 +0800 [thread overview]
Message-ID: <20230914100302.30274-6-quic_linyyuan@quicinc.com> (raw)
In-Reply-To: <20230914100302.30274-1-quic_linyyuan@quicinc.com>
Save u32 members into trace event ring buffer and parse it for possible
bit information.
Use DECLARE_EVENT_CLASS_PRINT_INIT() related macro for output stage.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
drivers/usb/dwc3/trace.h | 99 +++++++++++++++++++++++++---------------
1 file changed, 63 insertions(+), 36 deletions(-)
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index d2997d17cfbe..3caac180b225 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -98,35 +98,41 @@ DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
TP_ARGS(ctrl)
);
-DECLARE_EVENT_CLASS(dwc3_log_request,
+DECLARE_EVENT_CLASS_PRINT_INIT(dwc3_log_request,
TP_PROTO(struct dwc3_request *req),
TP_ARGS(req),
TP_STRUCT__entry(
- __string(name, req->dep->name)
+ __field(u32, edw3)
__field(struct dwc3_request *, req)
__field(unsigned int, actual)
__field(unsigned int, length)
__field(int, status)
- __field(int, zero)
- __field(int, short_not_ok)
- __field(int, no_interrupt)
+ __field(u32, rdw1)
),
TP_fast_assign(
- __assign_str(name, req->dep->name);
+ __entry->edw3 = req->dep->endpoint.dw3;
__entry->req = req;
__entry->actual = req->request.actual;
__entry->length = req->request.length;
__entry->status = req->request.status;
- __entry->zero = req->request.zero;
- __entry->short_not_ok = req->request.short_not_ok;
- __entry->no_interrupt = req->request.no_interrupt;
+ __entry->rdw1 = req->request.dw1;
),
TP_printk("%s: req %p length %u/%u %s%s%s ==> %d",
- __get_str(name), __entry->req, __entry->actual, __entry->length,
- __entry->zero ? "Z" : "z",
- __entry->short_not_ok ? "S" : "s",
- __entry->no_interrupt ? "i" : "I",
+ __s, __entry->req, __entry->actual, __entry->length,
+ tr.zero ? "Z" : "z",
+ tr.short_not_ok ? "S" : "s",
+ tr.no_interrupt ? "i" : "I",
__entry->status
+ ),
+ TP_printk_init(
+ struct usb_ep te;
+ struct usb_request tr;
+ char __s[9];
+ te.dw3 = __entry->edw3;
+ tr.dw1 = __entry->rdw1;
+ snprintf(__s, 9, "ep%d%s", te.address, \
+ (te.caps.dir_in && te.caps.dir_out) ? "" : \
+ te.caps.dir_in ? "in" : "out");
)
);
@@ -180,12 +186,12 @@ DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
TP_ARGS(cmd, param, status)
);
-DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
+DECLARE_EVENT_CLASS_PRINT_INIT(dwc3_log_gadget_ep_cmd,
TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
struct dwc3_gadget_ep_cmd_params *params, int cmd_status),
TP_ARGS(dep, cmd, params, cmd_status),
TP_STRUCT__entry(
- __string(name, dep->name)
+ __field(u32, edw3)
__field(unsigned int, cmd)
__field(u32, param0)
__field(u32, param1)
@@ -193,7 +199,7 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
__field(int, cmd_status)
),
TP_fast_assign(
- __assign_str(name, dep->name);
+ __entry->edw3 = dep->endpoint.dw3;
__entry->cmd = cmd;
__entry->param0 = params->param0;
__entry->param1 = params->param1;
@@ -201,10 +207,18 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
__entry->cmd_status = cmd_status;
),
TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
- __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
+ __s, dwc3_gadget_ep_cmd_string(__entry->cmd),
__entry->cmd, __entry->param0,
__entry->param1, __entry->param2,
dwc3_ep_cmd_status_string(__entry->cmd_status)
+ ),
+ TP_printk_init(
+ struct usb_ep te;
+ char __s[9];
+ te.dw3 = __entry->edw3;
+ snprintf(__s, 9, "ep%d%s", te.address, \
+ (te.caps.dir_in && te.caps.dir_out) ? "" : \
+ te.caps.dir_in ? "in" : "out");
)
);
@@ -214,11 +228,11 @@ DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
TP_ARGS(dep, cmd, params, cmd_status)
);
-DECLARE_EVENT_CLASS(dwc3_log_trb,
+DECLARE_EVENT_CLASS_PRINT_INIT(dwc3_log_trb,
TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
TP_ARGS(dep, trb),
TP_STRUCT__entry(
- __string(name, dep->name)
+ __field(u32, edw3)
__field(struct dwc3_trb *, trb)
__field(u32, bpl)
__field(u32, bph)
@@ -229,7 +243,7 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
__field(u32, dequeue)
),
TP_fast_assign(
- __assign_str(name, dep->name);
+ __entry->edw3 = dep->endpoint.dw3;
__entry->trb = trb;
__entry->bpl = trb->bpl;
__entry->bph = trb->bph;
@@ -240,7 +254,7 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
__entry->dequeue = dep->trb_dequeue;
),
TP_printk("%s: trb %p (E%d:D%d) buf %08x%08x size %s%d ctrl %08x sofn %08x (%c%c%c%c:%c%c:%s)",
- __get_str(name), __entry->trb, __entry->enqueue,
+ __s, __entry->trb, __entry->enqueue,
__entry->dequeue, __entry->bph, __entry->bpl,
({char *s;
int pcm = ((__entry->size >> 24) & 3) + 1;
@@ -272,7 +286,14 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
__entry->ctrl & DWC3_TRB_CTRL_CSP ? 'S' : 's',
__entry->ctrl & DWC3_TRB_CTRL_ISP_IMI ? 'S' : 's',
__entry->ctrl & DWC3_TRB_CTRL_IOC ? 'C' : 'c',
- dwc3_trb_type_string(DWC3_TRBCTL_TYPE(__entry->ctrl))
+ dwc3_trb_type_string(DWC3_TRBCTL_TYPE(__entry->ctrl))),
+ TP_printk_init(
+ struct usb_ep te;
+ char __s[9];
+ te.dw3 = __entry->edw3;
+ snprintf(__s, 9, "ep%d%s", te.address, \
+ (te.caps.dir_in && te.caps.dir_out) ? "" : \
+ te.caps.dir_in ? "in" : "out");
)
);
@@ -286,35 +307,31 @@ DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
TP_ARGS(dep, trb)
);
-DECLARE_EVENT_CLASS(dwc3_log_ep,
+DECLARE_EVENT_CLASS_PRINT_INIT(dwc3_log_ep,
TP_PROTO(struct dwc3_ep *dep),
TP_ARGS(dep),
TP_STRUCT__entry(
- __string(name, dep->name)
- __field(unsigned int, maxpacket)
- __field(unsigned int, maxpacket_limit)
- __field(unsigned int, max_streams)
- __field(unsigned int, maxburst)
+ __field(u32, edw3)
+ __field(u32, edw1)
+ __field(u32, edw2)
__field(unsigned int, flags)
__field(unsigned int, direction)
__field(u8, trb_enqueue)
__field(u8, trb_dequeue)
),
TP_fast_assign(
- __assign_str(name, dep->name);
- __entry->maxpacket = dep->endpoint.maxpacket;
- __entry->maxpacket_limit = dep->endpoint.maxpacket_limit;
- __entry->max_streams = dep->endpoint.max_streams;
- __entry->maxburst = dep->endpoint.maxburst;
+ __entry->edw3 = dep->endpoint.dw3;
+ __entry->edw1 = dep->endpoint.dw1;
+ __entry->edw2 = dep->endpoint.dw2;
__entry->flags = dep->flags;
__entry->direction = dep->direction;
__entry->trb_enqueue = dep->trb_enqueue;
__entry->trb_dequeue = dep->trb_dequeue;
),
TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c",
- __get_str(name), __entry->maxpacket,
- __entry->maxpacket_limit, __entry->max_streams,
- __entry->maxburst, __entry->trb_enqueue,
+ __s, te.maxpacket,
+ te.maxpacket_limit, te.max_streams,
+ te.maxburst, __entry->trb_enqueue,
__entry->trb_dequeue,
__entry->flags & DWC3_EP_ENABLED ? 'E' : 'e',
__entry->flags & DWC3_EP_STALL ? 'S' : 's',
@@ -322,6 +339,16 @@ DECLARE_EVENT_CLASS(dwc3_log_ep,
__entry->flags & DWC3_EP_TRANSFER_STARTED ? 'B' : 'b',
__entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p',
__entry->direction ? '<' : '>'
+ ),
+ TP_printk_init(
+ struct usb_ep te;
+ char __s[9];
+ te.dw1 = __entry->edw1;
+ te.dw2 = __entry->edw2;
+ te.dw3 = __entry->edw3;
+ snprintf(__s, 9, "ep%d%s", te.address, \
+ (te.caps.dir_in && te.caps.dir_out) ? "" : \
+ te.caps.dir_in ? "in" : "out");
)
);
--
2.17.1
next prev parent reply other threads:[~2023-09-14 10:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 10:02 [PATCH 0/8] usb: gadget: reduce usb gadget trace event buffer usage Linyu Yuan
2023-09-14 10:02 ` [PATCH 1/8] trace: add new DECLARE_EVENT_CLASS_PRINT_INIT class type Linyu Yuan
2023-09-14 14:29 ` kernel test robot
2023-09-14 10:02 ` [PATCH 2/8] usb: gadget: add anonymous definition in some struct for trace purpose Linyu Yuan
2023-09-14 14:54 ` Alan Stern
2023-09-15 1:02 ` Linyu Yuan
2023-09-15 1:51 ` Alan Stern
2023-09-15 1:56 ` Linyu Yuan
2023-09-14 10:02 ` [PATCH 3/8] usb: udc: trace: reduce buffer usage of trace event Linyu Yuan
2023-09-14 16:54 ` Steven Rostedt
2023-09-15 1:11 ` Linyu Yuan
2023-09-15 2:16 ` Steven Rostedt
2023-09-15 2:25 ` Linyu Yuan
2023-09-14 10:02 ` [PATCH 4/8] usb: cdns3: " Linyu Yuan
2023-09-14 10:02 ` Linyu Yuan [this message]
2023-09-14 10:03 ` [PATCH 6/8] usb: cdns2: " Linyu Yuan
2023-09-14 10:03 ` [PATCH 7/8] usb: mtu3: " Linyu Yuan
2023-09-14 10:03 ` [PATCH 8/8] usb: musb: " Linyu Yuan
2023-09-14 16:42 ` [PATCH 0/8] usb: gadget: reduce usb gadget trace event buffer usage Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230914100302.30274-6-quic_linyyuan@quicinc.com \
--to=quic_linyyuan@quicinc.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=b-liu@ti.com \
--cc=chunfeng.yun@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=pawell@cadence.com \
--cc=peter.chen@kernel.org \
--cc=rogerq@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox