Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2454306imm; Thu, 9 Aug 2018 13:14:52 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwO+sag8DqRuOb7rkB+f/xJK+ca2IwPuMgOA1Wa6uFi7uSgY410n8zXPWgPXXd0ZiaEzv4k X-Received: by 2002:a62:6f87:: with SMTP id k129-v6mr3870923pfc.26.1533845692765; Thu, 09 Aug 2018 13:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533845692; cv=none; d=google.com; s=arc-20160816; b=0RQOHJ08QCRmprP8E3AVIA9r9x2ETk/941rafqOJAVE4Zibkvf1ZsZUNRfLcKZkjfG rtDMrdDX2Nzi2LzpB569J7iR5pprCxBxNfAmJaLs9TWDEZO/nXecwh+8dtnR1RmO8O1Z JPP09va8AHP2WfkzCYlVRxPZ+jnSOVdFlwtPMaNSLcGAygGJkOBdzUu1VOpjX/XjuVJA xpBPbxmCO67Q3tGkr6X/K4JAccSx2CqCAU+vRGTaxkpDyP54VGOi3pwBusi19MmUIeeV 1l74I8zMvRnv1UJPh8sEsIH5H36DBVBAs4WCNHau3N0sH3Nr4U1HVDds4yTi4VA+jJZK bB3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=L5H/UYZ5P59hCTwCDJAfmnKMChFJdMqAWNPRQDX6KkY=; b=a5R4b7n/e7YzZGpknYg3pkQxy9fV0Uyr/sxOjdElm/0DHrwl4MUDVJS1e3uIsev6I5 tgrSCut+n9LBv9U8CiQo8+NwjG4Pq7IKN71qwn8iLfVDsAghvwKUGqGSEZmP/QATMf+f 3FNrDYDUfDBf4iuC/d3oXuwc+FCOFxDssSopfgEIYci8gCleW7O84HAR0f4C015OCe4v Ju0lIdoGpi2PK1iBztMjLNAiP8nKW5bUbHk8BWnkAcQAg8WXpZSaJl6XkEssMi0+jL2N YiWgyiGbIS+sI3qNkGGu4B7JfymT0xBFZ+86P7BJssLlG40kMGbv2IKAE6jipMUHUlSf C6Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=XpRorVYu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si7247300pfo.54.2018.08.09.13.14.37; Thu, 09 Aug 2018 13:14:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=XpRorVYu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727571AbeHIUhm (ORCPT + 99 others); Thu, 9 Aug 2018 16:37:42 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45952 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727475AbeHIUhl (ORCPT ); Thu, 9 Aug 2018 16:37:41 -0400 Received: by mail-lf1-f66.google.com with SMTP id j143-v6so4738671lfj.12; Thu, 09 Aug 2018 11:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=L5H/UYZ5P59hCTwCDJAfmnKMChFJdMqAWNPRQDX6KkY=; b=XpRorVYuBy9IKLg9E2HVcbmrpa5dEkU3YhtYcZ7xytYeLjrEXbslMQS1T7yMmIF/ih 5dUZ+40g1MAUGflLKe+Vbdu2MrkfnEwq8sUGytmCd9mGXnve0+Nx/xAfcJdDKoTa6nMC cyZ387pLmrjs2cQOTfhW3AMbqVTl2lC9SAFB3SeJhQUf3YvltgXW85FMFs9/lSuh8OW3 1Q6elZltBTLCaec7KbdWt2uMceBqzTSltuESgGAdnV9lP5eywVRPNMXjB6ccApUVVQLU a2gUqJcTW5OSJXfNpmNLuWWKTn6VMITm0OwSg/W5U8yDMmZ1SuYcnCKd//02rc+lHTbE jSGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=L5H/UYZ5P59hCTwCDJAfmnKMChFJdMqAWNPRQDX6KkY=; b=dtEY5aEY6LcxtV+PTkqp9zPRHDDNDBNWNC32ZcWjXjyuE25sIXX+Ohp6boKNmE1m9m jNglz5zHdGYvy+c1reGYAWoYltw+C2RqFB/WleVQ08o11mBB4QdxMvIihDZhAxcZtTVg n7KsR+8a78P6v1X8cZKtVo0XNFwQiuQNeDDwWfGvPOkWfxIcMKxud/mGFo1Otn1TjH5g aNVF9LtsuTh+VMmxmjkYbV+/0M8vtA0sfKqsXF5LyrRKkEXAeH4Ohmdy636eJLpv39X5 QYGs6dHis4fIIZZGiykhf8BB7/cPGAqYwOn/bMirqxcGgWuM5YZNLNsjjr5deVQaKfPT G2aw== X-Gm-Message-State: AOUpUlFPmAzP2YQD3zg7qhUxwM5dvaHDPF9h0DAFPww+0Wx91xxfet2f FUVFothiordqTbDfXlrPeR+4IIWQweo= X-Received: by 2002:a19:10c4:: with SMTP id 65-v6mr2387433lfq.113.1533838297362; Thu, 09 Aug 2018 11:11:37 -0700 (PDT) Received: from localhost.localdomain ([213.87.133.10]) by smtp.gmail.com with ESMTPSA id n7-v6sm1432211lfe.87.2018.08.09.11.11.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 11:11:36 -0700 (PDT) From: "Matwey V. Kornilov" To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Matwey V. Kornilov" , tfiga@chromium.org, laurent.pinchart@ideasonboard.com, stern@rowland.harvard.edu, ezequiel@collabora.com, hdegoede@redhat.com, hverkuil@xs4all.nl, mchehab@kernel.org, rostedt@goodmis.org, mingo@redhat.com, isely@pobox.com, bhumirks@gmail.com, colin.king@canonical.com, kieran.bingham@ideasonboard.com, keiichiw@chromium.org Subject: [PATCH v4 1/2] media: usb: pwc: Introduce TRACE_EVENTs for pwc_isoc_handler() Date: Thu, 9 Aug 2018 21:11:02 +0300 Message-Id: <20180809181103.15437-2-matwey@sai.msu.ru> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180809181103.15437-1-matwey@sai.msu.ru> References: <20180809181103.15437-1-matwey@sai.msu.ru> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.html Signed-off-by: Matwey V. Kornilov --- drivers/media/usb/pwc/pwc-if.c | 7 +++++ include/trace/events/pwc.h | 65 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 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..72d2897a4b9f 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -76,6 +76,9 @@ #include "pwc-dec23.h" #include "pwc-dec1.h" +#define CREATE_TRACE_POINTS +#include + /* Function prototypes and driver templates */ /* hotplug device table support */ @@ -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, pdev); + if (urb->status == -ENOENT || urb->status == -ECONNRESET || urb->status == -ESHUTDOWN) { PWC_DEBUG_OPEN("URB (%p) unlinked %ssynchronously.\n", @@ -348,6 +353,8 @@ static void pwc_isoc_handler(struct urb *urb) } handler_end: + trace_pwc_handler_exit(urb, pdev); + i = usb_submit_urb(urb, GFP_ATOMIC); if (i != 0) PWC_ERROR("Error (%d) re-submitting urb in pwc_isoc_handler.\n", i); diff --git a/include/trace/events/pwc.h b/include/trace/events/pwc.h new file mode 100644 index 000000000000..84807fea2217 --- /dev/null +++ b/include/trace/events/pwc.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#if !defined(_TRACE_PWC_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_PWC_H + +#include +#include + +#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(int, urb__status) + __field(u32, urb__actual_length) + __string(name, pdev->v4l2_dev.name) + __field(struct pwc_frame_buf*, fbuf) + __field(int, fbuf__filled) + ), + TP_fast_assign( + __entry->urb = urb; + __entry->urb__status = urb->status; + __entry->urb__actual_length = urb->actual_length; + __assign_str(name, pdev->v4l2_dev.name); + __entry->fbuf = pdev->fill_buf; + __entry->fbuf__filled = (pdev->fill_buf + ? pdev->fill_buf->filled : 0); + ), + 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) + __string(name, pdev->v4l2_dev.name) + __field(struct pwc_frame_buf*, fbuf) + __field(int, fbuf__filled) + ), + TP_fast_assign( + __entry->urb = urb; + __assign_str(name, pdev->v4l2_dev.name); + __entry->fbuf = pdev->fill_buf; + __entry->fbuf__filled = pdev->fill_buf->filled; + ), + 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 -- 2.16.4