Commit c1d5fb01 authored by Matwey V. Kornilov's avatar Matwey V. Kornilov Committed by Mauro Carvalho Chehab

media: usb: pwc: Introduce TRACE_EVENTs for pwc_isoc_handler()

There were reports that PWC-based webcams don't work at some
embedded ARM platforms. [1] Isochronous transfer handler seems to
work too long leading to the issues in MUSB USB host subsystem.
Also note, that urb->giveback() handlers are still called with
disabled interrupts. In order to be able to measure performance of
PWC driver, traces are introduced in URB handler section.

[1] https://www.spinics.net/lists/linux-usb/msg165735.htmlSigned-off-by: default avatarMatwey V. Kornilov <matwey@sai.msu.ru>
Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 1e0d0a5f
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
#include "pwc-dec23.h" #include "pwc-dec23.h"
#include "pwc-dec1.h" #include "pwc-dec1.h"
#define CREATE_TRACE_POINTS
#include <trace/events/pwc.h>
/* Function prototypes and driver templates */ /* Function prototypes and driver templates */
/* hotplug device table support */ /* hotplug device table support */
...@@ -260,6 +263,8 @@ static void pwc_isoc_handler(struct urb *urb) ...@@ -260,6 +263,8 @@ static void pwc_isoc_handler(struct urb *urb)
int i, fst, flen; int i, fst, flen;
unsigned char *iso_buf = NULL; unsigned char *iso_buf = NULL;
trace_pwc_handler_enter(urb, pdev);
if (urb->status == -ENOENT || urb->status == -ECONNRESET || if (urb->status == -ENOENT || urb->status == -ECONNRESET ||
urb->status == -ESHUTDOWN) { urb->status == -ESHUTDOWN) {
PWC_DEBUG_OPEN("URB (%p) unlinked %ssynchronously.\n", PWC_DEBUG_OPEN("URB (%p) unlinked %ssynchronously.\n",
...@@ -348,6 +353,8 @@ static void pwc_isoc_handler(struct urb *urb) ...@@ -348,6 +353,8 @@ static void pwc_isoc_handler(struct urb *urb)
} }
handler_end: handler_end:
trace_pwc_handler_exit(urb, pdev);
i = usb_submit_urb(urb, GFP_ATOMIC); i = usb_submit_urb(urb, GFP_ATOMIC);
if (i != 0) if (i != 0)
PWC_ERROR("Error (%d) re-submitting urb in pwc_isoc_handler.\n", i); PWC_ERROR("Error (%d) re-submitting urb in pwc_isoc_handler.\n", i);
......
/* 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, struct pwc_device *pdev),
TP_ARGS(urb, pdev),
TP_STRUCT__entry(
__field(struct urb*, urb)
__field(struct pwc_frame_buf*, fbuf)
__field(int, urb__status)
__field(u32, urb__actual_length)
__field(int, fbuf__filled)
__string(name, pdev->v4l2_dev.name)
),
TP_fast_assign(
__entry->urb = urb;
__entry->fbuf = pdev->fill_buf;
__entry->urb__status = urb->status;
__entry->urb__actual_length = urb->actual_length;
__entry->fbuf__filled = (pdev->fill_buf
? pdev->fill_buf->filled : 0);
__assign_str(name, pdev->v4l2_dev.name);
),
TP_printk("dev=%s (fbuf=%p filled=%d) urb=%p (status=%d actual_length=%u)",
__get_str(name),
__entry->fbuf,
__entry->fbuf__filled,
__entry->urb,
__entry->urb__status,
__entry->urb__actual_length)
);
TRACE_EVENT(pwc_handler_exit,
TP_PROTO(struct urb *urb, struct pwc_device *pdev),
TP_ARGS(urb, pdev),
TP_STRUCT__entry(
__field(struct urb*, urb)
__field(struct pwc_frame_buf*, fbuf)
__field(int, fbuf__filled)
__string(name, pdev->v4l2_dev.name)
),
TP_fast_assign(
__entry->urb = urb;
__entry->fbuf = pdev->fill_buf;
__entry->fbuf__filled = pdev->fill_buf->filled;
__assign_str(name, pdev->v4l2_dev.name);
),
TP_printk(" dev=%s (fbuf=%p filled=%d) urb=%p",
__get_str(name),
__entry->fbuf,
__entry->fbuf__filled,
__entry->urb)
);
#endif /* _TRACE_PWC_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment