From: "Matwey V. Kornilov" <matwey@sai.msu.ru>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: hverkuil@xs4all.nl, mchehab@kernel.org, mingo@redhat.com,
Mike Isely <isely@pobox.com>, Bhumika Goyal <bhumirks@gmail.com>,
Colin King <colin.king@canonical.com>,
linux-media@vger.kernel.org,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] Add TRACE_EVENTs in pwc_isoc_handler()
Date: Tue, 19 Jun 2018 19:23:04 +0300 [thread overview]
Message-ID: <CAJs94EZAAuUS4rznPDmD=1aD8B72P0mLft+YDoNs+74pRXr+KA@mail.gmail.com> (raw)
In-Reply-To: <20180618145854.2092c6e0@gandalf.local.home>
Hi Steven,
Thank you for valuable comments.
This is for measuring performance of URB completion callback inside PWC driver.
What do you think about moving events to __usb_hcd_giveback_urb() in
order to make this more generic? Like the following:
local_irq_save(flags);
// trace urb complete enter
urb->complete(urb);
// trace urb complete exit
local_irq_restore(flags);
2018-06-18 21:58 GMT+03:00 Steven Rostedt <rostedt@goodmis.org>:
> On Sun, 17 Jun 2018 17:36:24 +0300
> "Matwey V. Kornilov" <matwey@sai.msu.ru> wrote:
>
> I would prefer a change log here that would explain why these
> tracepoints are being added.
>
>
>> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
>> ---
>> drivers/media/usb/pwc/pwc-if.c | 7 +++++++
>> include/trace/events/pwc.h | 45 ++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 52 insertions(+)
>> create mode 100644 include/trace/events/pwc.h
>>
>> diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
>> index 54b036d39c5b..5775d1f60668 100644
>> --- a/drivers/media/usb/pwc/pwc-if.c
>> +++ b/drivers/media/usb/pwc/pwc-if.c
>> @@ -57,6 +57,9 @@
>> - Pham Thanh Nam: webcam snapshot button as an event input device
>> */
>>
>> +#define CREATE_TRACE_POINTS
>> +#include <trace/events/pwc.h>
>> +
>> #include <linux/errno.h>
>> #include <linux/init.h>
>> #include <linux/mm.h>
>> @@ -260,6 +263,8 @@ static void pwc_isoc_handler(struct urb *urb)
>> int i, fst, flen;
>> unsigned char *iso_buf = NULL;
>>
>> + trace_pwc_handler_enter(urb);
>> +
>> if (urb->status == -ENOENT || urb->status == -ECONNRESET ||
>> urb->status == -ESHUTDOWN) {
>> PWC_DEBUG_OPEN("URB (%p) unlinked %ssynchronously.\n",
>
> Looks like if this is hit, we will return from the function without
> calling trace_pwc_handler_exit().
>
>> @@ -347,6 +352,8 @@ static void pwc_isoc_handler(struct urb *urb)
>> pdev->vlast_packet_size = flen;
>> }
>>
>> + trace_pwc_handler_exit(urb);
>> +
>> handler_end:
>
> Why not add the tracepoint after handler_end. In fact, why not add some
> exit status to the trace event? I would think that would be useful as
> well.
>
>
>> i = usb_submit_urb(urb, GFP_ATOMIC);
>> if (i != 0)
>> diff --git a/include/trace/events/pwc.h b/include/trace/events/pwc.h
>> new file mode 100644
>> index 000000000000..b13d2118bb7a
>> --- /dev/null
>> +++ b/include/trace/events/pwc.h
>> @@ -0,0 +1,45 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#if !defined(_TRACE_PWC_H) || defined(TRACE_HEADER_MULTI_READ)
>> +#define _TRACE_PWC_H
>> +
>> +#include <linux/usb.h>
>> +#include <linux/tracepoint.h>
>> +
>> +#undef TRACE_SYSTEM
>> +#define TRACE_SYSTEM pwc
>> +
>> +TRACE_EVENT(pwc_handler_enter,
>> + TP_PROTO(struct urb *urb),
>> + TP_ARGS(urb),
>> + TP_STRUCT__entry(
>> + __field(struct urb*, urb)
>> + __field(int, urb__status)
>> + __field(u32, urb__actual_length)
>> + ),
>> + TP_fast_assign(
>> + __entry->urb = urb;
>> + __entry->urb__status = urb->status;
>> + __entry->urb__actual_length = urb->actual_length;
>
> Is there any other data that may be interesting to record here?
>
> -- Steve
>
>> + ),
>> + TP_printk("urb=%p (status=%d actual_length=%u)",
>> + __entry->urb,
>> + __entry->urb__status,
>> + __entry->urb__actual_length)
>> +);
>> +
>> +TRACE_EVENT(pwc_handler_exit,
>> + TP_PROTO(struct urb *urb),
>> + TP_ARGS(urb),
>> + TP_STRUCT__entry(
>> + __field(struct urb*, urb)
>> + ),
>> + TP_fast_assign(
>> + __entry->urb = urb;
>> + ),
>> + TP_printk("urb=%p", __entry->urb)
>> +);
>> +
>> +#endif /* _TRACE_PWC_H */
>> +
>> +/* This part must be outside protection */
>> +#include <trace/define_trace.h>
>
--
With best regards,
Matwey V. Kornilov.
Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia
119234, Moscow, Universitetsky pr-k 13, +7 (495) 9392382
next prev parent reply other threads:[~2018-06-19 16:23 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-17 14:36 [PATCH 1/2] Add TRACE_EVENTs in pwc_isoc_handler() Matwey V. Kornilov
2018-06-17 14:36 ` [PATCH 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer Matwey V. Kornilov
2018-06-18 5:11 ` Ezequiel Garcia
2018-06-18 7:10 ` Matwey V. Kornilov
2018-07-17 20:10 ` Ezequiel Garcia
2018-07-17 20:51 ` Alan Stern
2018-07-20 10:55 ` Tomasz Figa
2018-07-20 11:22 ` Matwey V. Kornilov
2018-07-20 11:33 ` Tomasz Figa
2018-07-20 11:57 ` Matwey V. Kornilov
2018-07-23 17:04 ` Matwey V. Kornilov
2018-07-23 18:57 ` Alan Stern
2018-07-24 18:56 ` Matwey V. Kornilov
2018-07-24 20:55 ` Alan Stern
2018-07-25 13:46 ` Matwey V. Kornilov
2018-07-30 4:14 ` Tomasz Figa
2018-08-04 8:05 ` Matwey V. Kornilov
2018-07-30 15:35 ` Laurent Pinchart
2018-08-04 8:00 ` Matwey V. Kornilov
2018-08-04 14:46 ` Alan Stern
2018-08-05 7:49 ` Christoph Hellwig
2018-08-05 8:33 ` Matwey V. Kornilov
2018-08-05 8:41 ` Christoph Hellwig
2018-08-08 22:32 ` Laurent Pinchart
2018-08-09 2:36 ` Tomasz Figa
2018-08-09 10:28 ` Laurent Pinchart
2018-07-30 15:13 ` Laurent Pinchart
2018-07-18 12:10 ` Matwey V. Kornilov
2018-07-19 23:36 ` Ezequiel Garcia
2018-07-20 9:35 ` Matwey V. Kornilov
2018-07-30 15:42 ` Laurent Pinchart
2018-07-30 16:07 ` Mauro Carvalho Chehab
2018-07-31 6:06 ` Tomasz Figa
2018-06-18 18:58 ` [PATCH 1/2] Add TRACE_EVENTs in pwc_isoc_handler() Steven Rostedt
2018-06-19 16:23 ` Matwey V. Kornilov [this message]
2018-06-19 16:33 ` Steven Rostedt
2018-06-20 8:05 ` Matwey V. Kornilov
2018-06-20 13:09 ` 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='CAJs94EZAAuUS4rznPDmD=1aD8B72P0mLft+YDoNs+74pRXr+KA@mail.gmail.com' \
--to=matwey@sai.msu.ru \
--cc=bhumirks@gmail.com \
--cc=colin.king@canonical.com \
--cc=hverkuil@xs4all.nl \
--cc=isely@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/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;
as well as URLs for NNTP newsgroup(s).