From: Steven Rostedt <rostedt@goodmis.org>
To: Linyu Yuan <quic_linyyuan@quicinc.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
<linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] trace: allocate space from temparary trace sequence buffer
Date: Thu, 15 Dec 2022 07:09:19 -0500 [thread overview]
Message-ID: <20221215070919.52c899c3@gandalf.local.home> (raw)
In-Reply-To: <fea0e9c9-18b6-0b6f-9e5e-5632d7ab6eea@quicinc.com>
On Thu, 15 Dec 2022 13:08:21 +0800
Linyu Yuan <quic_linyyuan@quicinc.com> wrote:
> On 12/15/2022 12:54 PM, Steven Rostedt wrote:
> > On Thu, 15 Dec 2022 12:33:27 +0800
> > Linyu Yuan <quic_linyyuan@quicinc.com> wrote:
> >
> >> there is one dwc3 trace event declare as below,
> >> DECLARE_EVENT_CLASS(dwc3_log_event,
> >> TP_PROTO(u32 event, struct dwc3 *dwc),
> >> TP_ARGS(event, dwc),
> >> TP_STRUCT__entry(
> >> __field(u32, event)
> >> __field(u32, ep0state)
> >> __dynamic_array(char, str, DWC3_MSG_MAX)
> >> ),
> >> TP_fast_assign(
> >> __entry->event = event;
> >> __entry->ep0state = dwc->ep0state;
> >> ),
> >> TP_printk("event (%08x): %s", __entry->event,
> >> dwc3_decode_event(__get_str(str), DWC3_MSG_MAX,
> >> __entry->event, __entry->ep0state))
> >> );
> >> the problem is when trace function called, it will allocate up to
> >> DWC3_MSG_MAX bytes from trace event buffer, but never fill the buffer
> >> during fast assignment, it only fill the buffer when output function are
> >> called, so this means if output function are not called, the buffer will
> >> never used.
> >>
> >> add __get_buf(len) which allocate space from iter->tmp_seq when trace
> >> output function called, it allow user write any data to allocatd space.
> >>
> >> the mentioned dwc3 trace event will changed as below,
> >> DECLARE_EVENT_CLASS(dwc3_log_event,
> >> TP_PROTO(u32 event, struct dwc3 *dwc),
> >> TP_ARGS(event, dwc),
> >> TP_STRUCT__entry(
> >> __field(u32, event)
> >> __field(u32, ep0state)
> >> ),
> >> TP_fast_assign(
> >> __entry->event = event;
> >> __entry->ep0state = dwc->ep0state;
> >> ),
> >> TP_printk("event (%08x): %s", __entry->event,
> >> dwc3_decode_event(__get_buf(DWC3_MSG_MAX), DWC3_MSG_MAX,
> >> __entry->event, __entry->ep0state))
> >> );.
> >>
> >> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
> >
> > No!
> ok, so you don't like a common function in trace_seq.c ?
Ah sorry, I got confused by the name "alloc" thinking you allocated a new
trace_seq. I misread your patch (it was late and I was about to go to bed
when I replied).
Let me look at it again when I'm more awake ;-)
-- Steve
next prev parent reply other threads:[~2022-12-15 12:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 4:33 [PATCH v1 1/2] trace: add new file under include/trace/stages/ for perf/bpf Linyu Yuan
2022-12-15 4:33 ` [PATCH v2 2/2] trace: allocate space from temparary trace sequence buffer Linyu Yuan
2022-12-15 4:54 ` Steven Rostedt
2022-12-15 5:08 ` Linyu Yuan
2022-12-15 12:09 ` Steven Rostedt [this message]
2022-12-15 13:23 ` Steven Rostedt
2022-12-16 2:05 ` Linyu Yuan
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=20221215070919.52c899c3@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bpf@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=quic_linyyuan@quicinc.com \
/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
all inboxes | Powered by JetHome®