Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1982391ybl; Sat, 14 Dec 2019 03:56:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyR+cba9DgbNyjDrxQbjjLcYJSI9E4w2jMfQzAqny5WxkEjdS4m7mZXJ9Xm4Sd4bZ+WJl3x X-Received: by 2002:a9d:f61:: with SMTP id 88mr19449238ott.234.1576324587940; Sat, 14 Dec 2019 03:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576324587; cv=none; d=google.com; s=arc-20160816; b=Y2fC0h/oau8sm8NDrqkFHKaWc4+wUus7nuVekwa9JnKfwpgYPWHu+l3APoD7UH7mLf T7mGxQ2W4Mb8pcd96vdL4v47TAAPdEpnxO70REeAzEWlUrhe49deMjtYSSFM8faQDyf+ s29fE36SnIWJ3nT1YCUu2c+MuxOKYRPmheHJJK6RnwyjI/p9acHJ/teKmvf1om6oUC0+ zgvkRFTIQ8NZxz7nLhX6XylSvwsPK9QxjBiCC9clOch7AO/IvWcLeW5W0aIpLx4U0qQL /fdZ+S2UHzdni7Z/U5fkMBwoy762jM7dsPf82iMEgvLbEEQDH/fpq+pAQrBZpoYLH6s1 qaqQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=CTjFr3lBualX7VtPvP2w+/MB0RFVCjRYHjMVJcHa6tA=; b=eFzgvAoHkZ9rCwLI7GIi7bgx2u+25tqGVrbgaro7nVo1V7f+ZUSm+vXuYs/fYn8o5X rYVg4T14uj8Bn3DkT/4ZnvnsPUF81fGmP+aApKMTMvtNj4kmdXoOIF2xjyIHDc2ntWGO QlaidQsZeE2QEMekNTN2iCAvaMSElMmu6dzQYdGCFD9ix1+azLgdVPxxHWqzn009S63N iyoqS8mb2YEsnJPALjNxZEtxTTpf4oGQyaEt4TqFI5ylMmlrAJgd3Y7gFd9gqKpnc9vh Xmkfqj9VYCdsrg3WHyRhhTxYuJ2TUa7juObYKMw27NqAjWTIpSMop2J+ktS0CQSl4b+7 F0ZQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si1968792oic.55.2019.12.14.03.56.16; Sat, 14 Dec 2019 03:56:27 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725975AbfLNLzf (ORCPT + 99 others); Sat, 14 Dec 2019 06:55:35 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40796 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbfLNLzf (ORCPT ); Sat, 14 Dec 2019 06:55:35 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 8BB3C289F5A Subject: Re: [PATCH v2] platform/chrome: cros_ec_proto: Add response tracing To: Raul E Rangel Cc: akshu.agrawal@amd.com, Guenter Roeck , linux-kernel@vger.kernel.org, Benson Leung References: <20191125104537.v2.1.Iaf98f0ab455b626537e77cfa71cef6ff2ab6f37b@changeid> From: Enric Balletbo i Serra Message-ID: Date: Sat, 14 Dec 2019 12:55:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191125104537.v2.1.Iaf98f0ab455b626537e77cfa71cef6ff2ab6f37b@changeid> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 25/11/19 18:45, Raul E Rangel wrote: > Add the ability to view response codes as well. > > I dropped the EVENT_CLASS since there is only one event per class. > > cros_ec_cmd has now been renamed to cros_ec_request_start. > > Example: > $ echo 1 > /sys/kernel/debug/tracing/events/cros_ec/enable > $ cat /sys/kernel/debug/tracing/trace > > 369.416372: cros_ec_request_start: version: 0, command: EC_CMD_USB_PD_POWER_INFO > 369.420528: cros_ec_request_done: version: 0, command: EC_CMD_USB_PD_POWER_INFO, ec result: EC_RES_SUCCESS, retval: 16 > 369.420529: cros_ec_request_start: version: 0, command: EC_CMD_USB_PD_DISCOVERY > 369.421383: cros_ec_request_done: version: 0, command: EC_CMD_USB_PD_DISCOVERY, ec result: EC_RES_SUCCESS, retval: 5 > > Signed-off-by: Raul E Rangel Merge window is open now! Queued for 5.6. Thanks, Enric > --- > > Changes in v2: > * Renamed events to cros_ec_request_start and cros_ec_request_done. > * Minor printf changes. > * Moved trace_cros_ec_request_start right above xfer_fxn. > * Fixed comment style. > END > > drivers/platform/chrome/cros_ec_proto.c | 8 ++++++-- > drivers/platform/chrome/cros_ec_trace.c | 24 ++++++++++++++++++++++ > drivers/platform/chrome/cros_ec_trace.h | 27 +++++++++++++++++++------ > 3 files changed, 51 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c > index bd485ce98a42..1b98193a9fc1 100644 > --- a/drivers/platform/chrome/cros_ec_proto.c > +++ b/drivers/platform/chrome/cros_ec_proto.c > @@ -54,8 +54,6 @@ static int send_command(struct cros_ec_device *ec_dev, > int ret; > int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); > > - trace_cros_ec_cmd(msg); > - > if (ec_dev->proto_version > 2) > xfer_fxn = ec_dev->pkt_xfer; > else > @@ -72,7 +70,10 @@ static int send_command(struct cros_ec_device *ec_dev, > return -EIO; > } > > + trace_cros_ec_request_start(msg); > ret = (*xfer_fxn)(ec_dev, msg); > + trace_cros_ec_request_done(msg, ret); > + > if (msg->result == EC_RES_IN_PROGRESS) { > int i; > struct cros_ec_command *status_msg; > @@ -95,7 +96,10 @@ static int send_command(struct cros_ec_device *ec_dev, > for (i = 0; i < EC_COMMAND_RETRIES; i++) { > usleep_range(10000, 11000); > > + trace_cros_ec_request_start(status_msg); > ret = (*xfer_fxn)(ec_dev, status_msg); > + trace_cros_ec_request_done(status_msg, ret); > + > if (ret == -EAGAIN) > continue; > if (ret < 0) > diff --git a/drivers/platform/chrome/cros_ec_trace.c b/drivers/platform/chrome/cros_ec_trace.c > index 6f80ff4532ae..ef423522bedc 100644 > --- a/drivers/platform/chrome/cros_ec_trace.c > +++ b/drivers/platform/chrome/cros_ec_trace.c > @@ -120,5 +120,29 @@ > TRACE_SYMBOL(EC_CMD_PD_GET_LOG_ENTRY), \ > TRACE_SYMBOL(EC_CMD_USB_PD_MUX_INFO) > > +/* See enum ec_status */ > +#define EC_RESULT \ > + TRACE_SYMBOL(EC_RES_SUCCESS), \ > + TRACE_SYMBOL(EC_RES_INVALID_COMMAND), \ > + TRACE_SYMBOL(EC_RES_ERROR), \ > + TRACE_SYMBOL(EC_RES_INVALID_PARAM), \ > + TRACE_SYMBOL(EC_RES_ACCESS_DENIED), \ > + TRACE_SYMBOL(EC_RES_INVALID_RESPONSE), \ > + TRACE_SYMBOL(EC_RES_INVALID_VERSION), \ > + TRACE_SYMBOL(EC_RES_INVALID_CHECKSUM), \ > + TRACE_SYMBOL(EC_RES_IN_PROGRESS), \ > + TRACE_SYMBOL(EC_RES_UNAVAILABLE), \ > + TRACE_SYMBOL(EC_RES_TIMEOUT), \ > + TRACE_SYMBOL(EC_RES_OVERFLOW), \ > + TRACE_SYMBOL(EC_RES_INVALID_HEADER), \ > + TRACE_SYMBOL(EC_RES_REQUEST_TRUNCATED), \ > + TRACE_SYMBOL(EC_RES_RESPONSE_TOO_BIG), \ > + TRACE_SYMBOL(EC_RES_BUS_ERROR), \ > + TRACE_SYMBOL(EC_RES_BUSY), \ > + TRACE_SYMBOL(EC_RES_INVALID_HEADER_VERSION), \ > + TRACE_SYMBOL(EC_RES_INVALID_HEADER_CRC), \ > + TRACE_SYMBOL(EC_RES_INVALID_DATA_CRC), \ > + TRACE_SYMBOL(EC_RES_DUP_UNAVAILABLE) > + > #define CREATE_TRACE_POINTS > #include "cros_ec_trace.h" > diff --git a/drivers/platform/chrome/cros_ec_trace.h b/drivers/platform/chrome/cros_ec_trace.h > index 0dd4df30fa89..ee20d8571796 100644 > --- a/drivers/platform/chrome/cros_ec_trace.h > +++ b/drivers/platform/chrome/cros_ec_trace.h > @@ -18,7 +18,7 @@ > > #include > > -DECLARE_EVENT_CLASS(cros_ec_cmd_class, > +TRACE_EVENT(cros_ec_request_start, > TP_PROTO(struct cros_ec_command *cmd), > TP_ARGS(cmd), > TP_STRUCT__entry( > @@ -33,13 +33,28 @@ DECLARE_EVENT_CLASS(cros_ec_cmd_class, > __print_symbolic(__entry->command, EC_CMDS)) > ); > > - > -DEFINE_EVENT(cros_ec_cmd_class, cros_ec_cmd, > - TP_PROTO(struct cros_ec_command *cmd), > - TP_ARGS(cmd) > +TRACE_EVENT(cros_ec_request_done, > + TP_PROTO(struct cros_ec_command *cmd, int retval), > + TP_ARGS(cmd, retval), > + TP_STRUCT__entry( > + __field(uint32_t, version) > + __field(uint32_t, command) > + __field(uint32_t, result) > + __field(int, retval) > + ), > + TP_fast_assign( > + __entry->version = cmd->version; > + __entry->command = cmd->command; > + __entry->result = cmd->result; > + __entry->retval = retval; > + ), > + TP_printk("version: %u, command: %s, ec result: %s, retval: %d", > + __entry->version, > + __print_symbolic(__entry->command, EC_CMDS), > + __print_symbolic(__entry->result, EC_RESULT), > + __entry->retval) > ); > > - > #endif /* _CROS_EC_TRACE_H_ */ > > /* this part must be outside header guard */ >