From patchwork Fri Sep 5 14:55:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 36849 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9351202A1 for ; Fri, 5 Sep 2014 14:56:39 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id a141sf16469083oig.8 for ; Fri, 05 Sep 2014 07:56:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=zgzqkhkaqEcWMvoVDqqBv5pSHhWPuRkGAgqFAOn8lTs=; b=SkWgEsvqI/5U/D3xhMJqfFF4Njfj1F4ttISPbo1NANSTLacooCg0ZSiL8WN3ijxqsG m3XHi17kkFacK51IhsfRqxdOPAbWnJOmpJh1clYxweBRwGG16YoKkMSs1nTTTYrfCuik /RgaW9LCaSLhzwm+2QjRC6mlYFIS4AebrBEa279PVaUBU9NnT78o7aW7Euj9PODnI4Ze 7KHx09rd0uu+9zb1dgMcklxefPHHEhqOa1K6lnBFWg407uhdLLDgfjK9W1HFq6YYoqcB 8nyto/RYfuSNrLNBmiWbkWtdxoi5GhHz589+bFk6ZKWTdivOpw2SOI0eHkceznNe2+F2 hxyA== X-Gm-Message-State: ALoCoQlDZV4onJ0OQyzTy9wDjopl/RhlcU7kTp4NZju+GerBFKcV39klhGvlxV1aISF+VFKxTBgs X-Received: by 10.50.73.162 with SMTP id m2mr2253389igv.1.1409928999454; Fri, 05 Sep 2014 07:56:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.231 with SMTP id v94ls801347qgv.16.gmail; Fri, 05 Sep 2014 07:56:39 -0700 (PDT) X-Received: by 10.220.166.207 with SMTP id n15mr1285645vcy.75.1409928999289; Fri, 05 Sep 2014 07:56:39 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id ip5si815184vcb.52.2014.09.05.07.56.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 07:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id le20so1112073vcb.3 for ; Fri, 05 Sep 2014 07:56:39 -0700 (PDT) X-Received: by 10.220.77.65 with SMTP id f1mr1524540vck.48.1409928999160; Fri, 05 Sep 2014 07:56:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp94545vcb; Fri, 5 Sep 2014 07:56:38 -0700 (PDT) X-Received: by 10.42.172.195 with SMTP id o3mr4335167icz.76.1409928997907; Fri, 05 Sep 2014 07:56:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iw1si4602827pbc.127.2014.09.05.07.56.36 for ; Fri, 05 Sep 2014 07:56:36 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757037AbaIEO4Q (ORCPT + 2 others); Fri, 5 Sep 2014 10:56:16 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:39089 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbaIEO4P (ORCPT ); Fri, 5 Sep 2014 10:56:15 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s85EttqB020647; Fri, 5 Sep 2014 09:55:55 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s85Etsfo014672; Fri, 5 Sep 2014 09:55:54 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 5 Sep 2014 09:55:54 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s85Etrnf005406; Fri, 5 Sep 2014 09:55:54 -0500 Date: Fri, 5 Sep 2014 09:55:46 -0500 From: Felipe Balbi To: Pratyush Anand CC: Felipe Balbi , Paul Zimmerman , Linux USB Mailing List , Greg KH , David Cohen , Heikki Krogerus , Sebastian Andrzej Siewior , George Cherian , Kishon Vijay Abraham I Subject: Re: [PATCH v2] usb: dwc3: add tracepoints to aid debugging Message-ID: <20140905145546.GD24449@saruman.home> Reply-To: References: <20140819220201.GI22003@saruman.home> <20140822204655.GJ27616@saruman.home> <20140822215646.GA19838@saruman.home> <20140826204137.GD4584@saruman.home> <20140826212637.GA11070@saruman.home> <20140903062825.GB2693@pratyush-vbox> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140903062825.GB2693@pratyush-vbox> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Wed, Sep 03, 2014 at 11:58:26AM +0530, Pratyush Anand wrote: > On Wed, Aug 27, 2014 at 05:26:37AM +0800, Felipe Balbi wrote: > > Hi Felipe, > > > Hi, > > > > On Tue, Aug 26, 2014 at 09:21:55PM +0000, Paul Zimmerman wrote: > > > > From: Felipe Balbi [mailto:balbi@ti.com] > > > > Sent: Tuesday, August 26, 2014 1:42 PM > > > > > > > > On Fri, Aug 22, 2014 at 04:56:46PM -0500, Felipe Balbi wrote: > > > > > > ... > > > > > > > yeah, it took longer than expected (been busy lately), but here's an > > > > example trace with all trace points enabled: > > > > > > > > # tracer: nop > > > > # > > > > # entries-in-buffer/entries-written: 1038/1038 #P:1 > > > > # > > > > # _-----=> irqs-off > > > > # / _----=> need-resched > > > > # | / _---=> hardirq/softirq > > > > # || / _--=> preempt-depth > > > > # ||| / delay > > > > # TASK-PID CPU# |||| TIMESTAMP FUNCTION > > > > # | | | |||| | | > > > > -0 [000] d.h. 155.653881: dwc3_readl: add fa39c40c value 00000004 > > > > -0 [000] d.h. 155.653903: dwc3_readl: add fa39c408 value 00000100 > > > > -0 [000] d.h. 155.653908: dwc3_writel: addr fa39c408 value 80000100 > > > > > > Looks like there is an inconsistency between readl/writel (add vs. > > > addr). > > > > eagle eyes :-) > > > > > Other than that, I really like this. > > > > > > Reviewed-by: Paul Zimmerman > > > > thanks, pushed to my dwc3-tracepoints branch with your Reviewed-by, if > > nobody makes any other comments until Friday, I'll promote it to > > testing/next and later to next. > > If we can also add following two items: > -- depcmd: trace depcmd params and cmd in dwc3_send_gadget_ep_cmd > -- TRB: trace trb fields, trb address and ep number for which trb has > been prepared in dwc3_prepare_one_trb > > These items were pretty helpful in debugging isoc issues. here's a diff adding those, I'll combine into original patch and resend full series here: diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 0642ff9..f2dbaca 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -279,8 +279,7 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param) u32 timeout = 500; u32 reg; - dev_vdbg(dwc->dev, "generic cmd '%s' [%d] param %08x\n", - dwc3_gadget_generic_cmd_string(cmd), cmd, param); + trace_dwc3_gadget_generic_cmd(cmd, param); dwc3_writel(dwc->regs, DWC3_DGCMDPAR, param); dwc3_writel(dwc->regs, DWC3_DGCMD, cmd | DWC3_DGCMD_CMDACT); @@ -311,10 +310,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, u32 timeout = 500; u32 reg; - dev_vdbg(dwc->dev, "%s: cmd '%s' [%d] params %08x %08x %08x\n", - dep->name, - dwc3_gadget_ep_cmd_string(cmd), cmd, params->param0, - params->param1, params->param2); + trace_dwc3_gadget_ep_cmd(dep, cmd, params); dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(ep), params->param0); dwc3_writel(dwc->regs, DWC3_DEPCMDPAR1(ep), params->param1); @@ -803,6 +799,8 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id); trb->ctrl |= DWC3_TRB_CTRL_HWO; + + trace_dwc3_prepare_trb(dep, trb); } /* @@ -1760,6 +1758,8 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, unsigned int s_pkt = 0; unsigned int trb_status; + trace_dwc3_complete_trb(dep, trb); + if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) /* * We continue despite the error. There is not much we diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h index 992cc38..78aff1d 100644 --- a/drivers/usb/dwc3/trace.h +++ b/drivers/usb/dwc3/trace.h @@ -25,6 +25,7 @@ #include #include #include "core.h" +#include "debug.h" DECLARE_EVENT_CLASS(dwc3_log_msg, TP_PROTO(struct va_format *vaf), @@ -130,6 +131,82 @@ DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback, TP_ARGS(req) ); +DECLARE_EVENT_CLASS(dwc3_log_generic_cmd, + TP_PROTO(unsigned int cmd, u32 param), + TP_ARGS(cmd, param), + TP_STRUCT__entry( + __field(unsigned int, cmd) + __field(u32, param) + ), + TP_fast_assign( + __entry->cmd = cmd; + __entry->param = param; + ), + TP_printk("cmd '%s' [%d] param %08x\n", + dwc3_gadget_generic_cmd_string(__entry->cmd), + __entry->cmd, __entry->param + ) +); + +DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd, + TP_PROTO(unsigned int cmd, u32 param), + TP_ARGS(cmd, param) +); + +DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, + TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, + struct dwc3_gadget_ep_cmd_params *params), + TP_ARGS(dep, cmd, params), + TP_STRUCT__entry( + __field(struct dwc3_ep *, dep) + __field(unsigned int, cmd) + __field(struct dwc3_gadget_ep_cmd_params *, params) + ), + TP_fast_assign( + __entry->dep = dep; + __entry->cmd = cmd; + __entry->params = params; + ), + TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", + __entry->dep->name, dwc3_gadget_ep_cmd_string(__entry->cmd), + __entry->cmd, __entry->params->param0, + __entry->params->param1, __entry->params->param2 + ) +); + +DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd, + TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, + struct dwc3_gadget_ep_cmd_params *params), + TP_ARGS(dep, cmd, params) +); + +DECLARE_EVENT_CLASS(dwc3_log_trb, + TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), + TP_ARGS(dep, trb), + TP_STRUCT__entry( + __field(struct dwc3_ep *, dep) + __field(struct dwc3_trb *, trb) + ), + TP_fast_assign( + __entry->dep = dep; + __entry->trb = trb; + ), + TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", + __entry->dep->name, __entry->trb, __entry->trb->bph, + __entry->trb->bpl, __entry->trb->size, __entry->trb->ctrl + ) +); + +DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb, + TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), + TP_ARGS(dep, trb) +); + +DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb, + TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), + TP_ARGS(dep, trb) +); + #endif /* __DWC3_TRACE_H */ /* this part has to be here */