Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2376055imm; Thu, 9 Aug 2018 11:48:24 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwXd3jF1rvMd42PYSFn3jvxyqXd4bVNiA05dRXBO9trc4i8Ih57WcljiPDhsl7liBsCEdeL X-Received: by 2002:a62:5f82:: with SMTP id t124-v6mr3557803pfb.223.1533840504162; Thu, 09 Aug 2018 11:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533840504; cv=none; d=google.com; s=arc-20160816; b=M2WIVOB3nN0zS0N2S+lF8J4SyHC8Oj2BA8NjBIGYrxsBuZ07KKybuh52bWtTjr5tCW 3PTE819Q/L5dszqasRXQEbub13BwT/gF89RQ+uT3atlCspVvHma757/ygk+4s6b547FU FRNpDLvpqt15kgMGXzS0FXWkmanNa23vylFwOLd8itZKpfxseH3maso/OzSP/tpL1kNI nQEI3jXqEbVyvDBRGRfoFzwFrRCKTrhFItkTcQmza/aZCgQHSrbVAkKGJfCu7IIGfNz0 kNWQEhkX6Behwm7smz69VDXrXV7MyrA41Z3sq9mSXA1YeK/3EMGkHX84V/zZcDie4No9 YMqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :arc-authentication-results; bh=BOROfFhQwEJzIdQx/Gmf4M5njt9eX/Dq3OkMkjtj2oI=; b=umNPHK0F2xRaG5e5mc9ePCJ0W/eoIROWsf8bh5yG3qp+v2bI3Lgism9BMbb04R5uvT Pad7DzajkG1SFGD0VzSSYi5G+FPACNzZC0bjUYtld/cwyXvn8Nf314hebSUfgdo54pOw Ds7yYuYUEmLZ/Vtq8o5iOyls6z1FV50VxQq1wcPuwciPh+CddjACefwJAU1AX05rMfJv rcXo4SjfW40e105FPKQmGkr+RhynZzm+iQ7/DqVaqJFxvU4620lH2Z2chpQzKo3oZ3Hb VZ3BkdLyRjs3cMOOdvElGNrACqbkPqlsUFbAK7ayuxNTBiOX6Hn5VHeIBfTqYT3zvuAm 3BAQ== ARC-Authentication-Results: i=1; mx.google.com; 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 c5-v6si6139013pll.275.2018.08.09.11.48.02; Thu, 09 Aug 2018 11:48:24 -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; 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 S1727032AbeHIVFg convert rfc822-to-8bit (ORCPT + 99 others); Thu, 9 Aug 2018 17:05:36 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:44520 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726764AbeHIVFg (ORCPT ); Thu, 9 Aug 2018 17:05:36 -0400 Received: by mail-oi0-f67.google.com with SMTP id s198-v6so11515387oih.11; Thu, 09 Aug 2018 11:39:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=W+1y2GxiH4DN3kXD8ovtIQjeupOlKaeYHU48lcHxP5M=; b=CyC0HVyJbY8OSedb6l6N5VLGHzpZtuWRM4uUpI7A/Qee/YnXBVertSoTI2jnQTVfNe 23l/9D3ski+5XIj9T0zS6HY91T310g0XYf13Myf1vRENB0eQQ6eGlcRO4AkmYRvmJcDK dYwSBjCVLFT4pe7EpjYFG4zYUmgInUvg9EwDuXFB3bim48QUabUjnG+04rYiZXTdMuMT 9Q4P/mSO/SCi8lsp1ftoyJbimMcJQtAPpuVWA7SuNLVoxynmotcPTwPbX3gyGV50Gmgx zTaG5ZXmrhI+iuvqjGRGcL82HNTVxneL6cLrp0lGjMXsqhKkef/TVMbXWNmsgfDkDf1B tYfQ== X-Gm-Message-State: AOUpUlHjSMVHfBjoXc9Fo9DW99P5iHKAkXbyLQZNHNjxi7Ilo16MuOBZ +JQE8AhaBJOMnjzIR4ZiQ0ZDQ/8IGARlLSrWP3c= X-Received: by 2002:aca:c514:: with SMTP id v20-v6mr3454440oif.153.1533839968968; Thu, 09 Aug 2018 11:39:28 -0700 (PDT) MIME-Version: 1.0 References: <20180809181103.15437-1-matwey@sai.msu.ru> <20180809181103.15437-2-matwey@sai.msu.ru> <20180809142618.34e58d5d@gandalf.local.home> In-Reply-To: <20180809142618.34e58d5d@gandalf.local.home> From: "Matwey V. Kornilov" Date: Thu, 9 Aug 2018 21:39:17 +0300 Message-ID: Subject: Re: [PATCH v4 1/2] media: usb: pwc: Introduce TRACE_EVENTs for pwc_isoc_handler() To: Steven Rostedt Cc: Linux Media Mailing List , open list , Tomasz Figa , Laurent Pinchart , Alan Stern , Ezequiel Garcia , Hans de Goede , Hans Verkuil , Mauro Carvalho Chehab , mingo@redhat.com, Mike Isely , Bhumika Goyal , Colin King , Kieran Bingham , keiichiw@chromium.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org чт, 9 авг. 2018 г. в 21:26, Steven Rostedt : > > On Thu, 9 Aug 2018 21:11:02 +0300 > "Matwey V. Kornilov" wrote: > > > 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) > > I should have mentioned this before. The above is a structure, and the > fields of that structure are created in the same order as this list. > It's best to try to make sure there's no "holes". I would recommend: > > __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) > > Best to have names at the end, as in the future I may be able to > optimize dynamic arrays (like strings) better, if there's only one and > its at the end of the structure. I see, thank you! > > > + ), > > + 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) > > This I would just move name to the end. > > Thanks! > > -- Steve > > > + ), > > + 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 > -- With best regards, Matwey V. Kornilov. Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia 119234, Moscow, Universitetsky pr-k 13, +7 (495) 9392382