Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3090543ybc; Mon, 25 Nov 2019 08:51:59 -0800 (PST) X-Google-Smtp-Source: APXvYqwiWm78zjhhVXZzZlqvNNjmWvbju43W2T0bJrsnNwtElQO37IANf4fGKYgwhs/EkL2rD6V6 X-Received: by 2002:aa7:d3da:: with SMTP id o26mr20226642edr.302.1574700719743; Mon, 25 Nov 2019 08:51:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574700719; cv=none; d=google.com; s=arc-20160816; b=DDx35pV12gFHyLYbwUoryRrJrd/Zh4WAJc3uxCbwSCxe3S04giY3rKvchEnVEqgyJ+ tPkJyuv9Wmh/I4P9esiUe1thuLNKeVyViu+ARb92PehZmSgIJr/0gfkuRhAA8+IgEqTd Oz0xrG+2XiRP37aAr4muYo73G7xl+v04PCKbG5oC50TWQvhBNEqXXbeZHy+qCxBkksCz /LSX1k8buI2FGkUJ1/mcbcy/A91oEwgYajlxwLloptlt+E+ai75Ep2Bh0RPUn3kUSQ4C 7kOHwz88qzx0ffmsw1fjA5862qIbW50UvZKeyQgNKDRfwNcvSn67jDLhdroU9bWIr7Hu oQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PjZmTDNX7Oh8S6LopwDwjhGUMI/D1VBD8yGIc973Eio=; b=jD0gDnH/4d5uIjHlFZ8SoT0nDdprKaC/2lAS1QKGF24q3oZEyMZN39FyuYU+HHTmpr j6YNO1d5iakjeDcpXVyeiE/BK85ZOc/ef3K6d0v97qOQHL+aobnXYl0Wx5tmBygxa6dD UJoYCdO21zVC2RgodohgUZYpgoqeGhgNyDrtazakC5CKpgoVr9cZ7xeCI78VI/BxxeNl Og/cgHmNbNDAE6a2yrPznXuEmpQpdggZ/eJdpfLb9/++64cUF7UXi04/v+gODAqKpwRJ iYbcbRkW/qFn+XryTmwWYbL2xXZeIZox3QMDIB16QAqnhXWlU/FYVj0vLQhIX3nlNZhJ 2qGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZLjr6Tbg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si4648428ejj.70.2019.11.25.08.51.35; Mon, 25 Nov 2019 08:51:59 -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; dkim=pass header.i=@chromium.org header.s=google header.b=ZLjr6Tbg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728940AbfKYQuG (ORCPT + 99 others); Mon, 25 Nov 2019 11:50:06 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:44132 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728853AbfKYQuG (ORCPT ); Mon, 25 Nov 2019 11:50:06 -0500 Received: by mail-ed1-f66.google.com with SMTP id a67so13341192edf.11 for ; Mon, 25 Nov 2019 08:50:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PjZmTDNX7Oh8S6LopwDwjhGUMI/D1VBD8yGIc973Eio=; b=ZLjr6TbgcIihUmoMNl0Ej6deyjc6vOToFsszMeHb2am5LMBG1zVLdQ0Z5zsBGzzJHL 5sfKG/G910/mXd9hnI00UbadaeLtomjktc3lFyCTvdMPO6a8JwO+yn+qSpDtbG6Bw758 3CUrBkSsnHASdv2C4q5SeVp2/QlANHUAIPpYg= 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; bh=PjZmTDNX7Oh8S6LopwDwjhGUMI/D1VBD8yGIc973Eio=; b=ubntsRj7noO+Bx5m1Bla07oHt4UGAvhcv0fhC88eNW2P9CLsePSDGJhLwmmplqiycb USWTyTiiwsS0CaU5au6WOGrqshp3pyoE9+ZyCwGqd6+klwNEtI5+uzBVDLzp/8ZkyLG1 HODacgI0oNCWUDqzQ1vIqaE5KNCk0J5QtAfmGrl2gjK0xfzYVGIY4G5TL0s7Hsbpi37n s5eK7nU92aYHeNEDmOYw+YlAgoHJAGZdYnHVe6oiqaG/SX/cTojudb6yWogT/ObOcNyo kDnB6PglzFzgPLxB8FW7lJPRNOsxZ4eZvBAhblSp3zwW5B3U0hOAn5YWT6h5br2TBWPu b11g== X-Gm-Message-State: APjAAAWcgX/UUfdXjhFOGzVruKdhv0QQBF++aDRrWLFOKGtbqEz/VNSS zktsiRW8TxlK8PJRXU/NmaVFycuQ2Zg= X-Received: by 2002:a17:906:1983:: with SMTP id g3mr37972439ejd.84.1574700603651; Mon, 25 Nov 2019 08:50:03 -0800 (PST) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com. [209.85.128.53]) by smtp.gmail.com with ESMTPSA id e13sm272410edm.29.2019.11.25.08.50.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2019 08:50:02 -0800 (PST) Received: by mail-wm1-f53.google.com with SMTP id u18so8764wmc.3 for ; Mon, 25 Nov 2019 08:50:02 -0800 (PST) X-Received: by 2002:a7b:cd17:: with SMTP id f23mr27417713wmj.86.1574700601972; Mon, 25 Nov 2019 08:50:01 -0800 (PST) MIME-Version: 1.0 References: <20191121115542.1.Iaf98f0ab455b626537e77cfa71cef6ff2ab6f37b@changeid> <4eef47ad-8d42-1ab4-0c99-028a121cc27c@collabora.com> In-Reply-To: <4eef47ad-8d42-1ab4-0c99-028a121cc27c@collabora.com> From: Raul Rangel Date: Mon, 25 Nov 2019 09:49:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] platform/chrome: cros_ec_proto: Add response tracing To: Enric Balletbo i Serra Cc: Akshu Agrawal , Guenter Roeck , linux-kernel , Benson Leung Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 25, 2019 at 8:45 AM Enric Balletbo i Serra wrote: > > Hi Raul, > > Many tanks for sending this patch upstream, some few comments below. > > On 21/11/19 19:55, Raul E Rangel wrote: > > Add the ability to view response codes as well. > > > > I renamed the trace event from cros_ec_cmd to cros_ec_request and added > > a cros_ec_response. > > > > Example: > > $ echo 1 > /sys/kernel/debug/tracing/events/cros_ec/enable > > $ cat /sys/kernel/debug/tracing/trace > > > > cros_ec_request: version: 1, command: EC_CMD_CONSOLE_READ > > cros_ec_response: version: 1, command: EC_CMD_CONSOLE_READ, result: EC_RES_SUCCESS, rc: 0 > > I don't see the advantage of have two traces, one for the request and another > one for the response. Do you expect get stuck between them? It might if there is a bug in xfer_fxn, we miss an interrupt, or some kind of communication problem on the bus (early bring up issues). It's also possible to compute the latency of a transaction by having both. The mmc subsystem has both mmc_request_start and mmc_request_done. If you feel strongly, I can record just the response. > > What about just move the trace_cros_ec_cmd after the xfer_fnx call and add the > results? > > Thanks, > Enric > > > cros_ec_request: version: 0, command: EC_CMD_USB_PD_POWER_INFO > > cros_ec_response: version: 0, command: EC_CMD_USB_PD_POWER_INFO, result: EC_RES_SUCCESS, rc: 16 > > > > Signed-off-by: Raul E Rangel > > --- > > > > drivers/platform/chrome/cros_ec_proto.c | 7 +++++- > > drivers/platform/chrome/cros_ec_trace.c | 24 +++++++++++++++++++ > > drivers/platform/chrome/cros_ec_trace.h | 32 +++++++++++++++++++++++-- > > 3 files changed, 60 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c > > index bd485ce98a42..ef2229047e0f 100644 > > --- a/drivers/platform/chrome/cros_ec_proto.c > > +++ b/drivers/platform/chrome/cros_ec_proto.c > > @@ -54,7 +54,7 @@ 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); > > + trace_cros_ec_request(msg); > > > > if (ec_dev->proto_version > 2) > > xfer_fxn = ec_dev->pkt_xfer; > > @@ -73,6 +73,8 @@ static int send_command(struct cros_ec_device *ec_dev, > > } > > > > ret = (*xfer_fxn)(ec_dev, msg); > > + > > + trace_cros_ec_response(msg, ret); > > if (msg->result == EC_RES_IN_PROGRESS) { > > int i; > > struct cros_ec_command *status_msg; > > @@ -95,7 +97,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(status_msg); > > ret = (*xfer_fxn)(ec_dev, status_msg); > > + trace_cros_ec_response(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..28eb94d99ba2 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 > > Use the C comment style, please. I used // because that was the comment format used above `#define EC_CMDS`. Do you want me to change that as well? Thanks