[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221215070919.52c899c3@gandalf.local.home>
Date: Thu, 15 Dec 2022 07:09:19 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Linyu Yuan <quic_linyyuan@...cinc.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
<linux-kernel@...r.kernel.org>, <bpf@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] trace: allocate space from temparary trace
sequence buffer
On Thu, 15 Dec 2022 13:08:21 +0800
Linyu Yuan <quic_linyyuan@...cinc.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@...cinc.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@...cinc.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
Powered by blists - more mailing lists