Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2640506yba; Mon, 15 Apr 2019 16:33:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXt8eQY5zbH57XZiEBlT3bD1jqZXKQ2HvfJ8fng2Z9B1GVE6xFO/GEIa8sXEsQEHMom8j1 X-Received: by 2002:a63:5a1d:: with SMTP id o29mr72539584pgb.320.1555371226532; Mon, 15 Apr 2019 16:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555371226; cv=none; d=google.com; s=arc-20160816; b=McKgub48QU+xnj7PgekySEvD2BsM8KxHEznlx08aVH6ECxTjkjB/JRpbpfI219JSyu zcoGLgroEQh32QhJQCu0fvfGyydQmn0xGnuJaHR/p4+C9MDFar2QIQQDxI3ZmbfhC6be a9JA4RoU4jCAWjjKBRI+5v7xpZLTHVGBK/ZxTdhzjlQMeMtvj0QS1+l/xC8WjV1WW6tk WsdG3cUFAWjQAMsxZwQ37qpNvwRo2gDjjJZ39dk+AJQW7Rei5TbaC7tmNhvXhFruAJxR g6o1TzVCU+D/DcSYuvpwbZwbxtq4cbQykZqsFy4gxAtFIQtpcIG/3+EMJ3fzO+2Nubg/ iovA== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=jJHRqNNt3aBrEdYIlUF44pvkKSHs8GuF9S9EfrQ5GIs=; b=UCiK1xH/itNz5WH3UqA3I2NlOsG55QS77GnQrnkN1wCpM/v1XbVlSiqeF/ZnFtAwkX TCZ4jwwpPjRbcT2rCa8ZwvgDdq8OX7MmZJMYh6xXMH8kyrO93rtkrsKdW6WSUouKo5vG oN2IJR9C3RlxS51TVMIok3SjOxF1C0YaQ2UVRHiIX4yqCdslmWiE53PwHr0RCb/+0Iqj BZQoKoHc97r+ZGrPGoiPi9M44HPmSdHPIwIEe2fwwclb12bGDyFEuigkOzRFGVXvu3aY pxNeMVsAUQrbP3esGQiV3ZV1kB134F79DudrZiy8adyXtBdsUBThieTOhwhnKB7rV13Z tGwQ== 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 a8si45473243pgj.502.2019.04.15.16.33.30; Mon, 15 Apr 2019 16:33:46 -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 S1728045AbfDOXbi (ORCPT + 99 others); Mon, 15 Apr 2019 19:31:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:45374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbfDOXbh (ORCPT ); Mon, 15 Apr 2019 19:31:37 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5868020830; Mon, 15 Apr 2019 23:31:35 +0000 (UTC) Date: Mon, 15 Apr 2019 19:31:33 -0400 From: Steven Rostedt To: Raul E Rangel Cc: linux-mmc@vger.kernel.org, linux-trace-devel@vger.kernel.org, djkurtz@chromium.org, zwisler@chromium.org, hongjiefang , Ingo Molnar , linux-kernel@vger.kernel.org, Shawn Lin , Kyle Roeschley , Avri Altman , Ulf Hansson Subject: Re: [PATCH v1 1/4] mmc: core: Add trace event for SD SCR response Message-ID: <20190415193133.2cdbc6d0@gandalf.local.home> In-Reply-To: <20190415225241.70088-1-rrangel@chromium.org> References: <20190415225241.70088-1-rrangel@chromium.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Apr 2019 16:52:38 -0600 Raul E Rangel wrote: > Example: > sd_scr: mmc0: version: 2, spec3: 1, width: 5, cmds: 0, raw: {0x2b58000,0x0} > > Signed-off-by: Raul E Rangel > --- > > drivers/mmc/core/sd.c | 4 ++++ > include/trace/events/mmc.h | 42 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > index 265e1aeeb9d8..3bed7c4b6d75 100644 > --- a/drivers/mmc/core/sd.c > +++ b/drivers/mmc/core/sd.c > @@ -21,6 +21,8 @@ > #include > #include > > +#include > + > #include "core.h" > #include "card.h" > #include "host.h" > @@ -200,6 +202,7 @@ static int mmc_decode_scr(struct mmc_card *card) > if (scr_struct != 0) { > pr_err("%s: unrecognised SCR structure version %d\n", > mmc_hostname(card->host), scr_struct); > + trace_sd_scr(card, NULL); > return -EINVAL; > } > > @@ -221,6 +224,7 @@ static int mmc_decode_scr(struct mmc_card *card) > > if (scr->sda_spec3) > scr->cmds = UNSTUFF_BITS(resp, 32, 2); > + trace_sd_scr(card, scr); > return 0; > } > > diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h > index 7b706ff21335..e45258e8a6cb 100644 > --- a/include/trace/events/mmc.h > +++ b/include/trace/events/mmc.h > @@ -10,6 +10,48 @@ > #include > #include > > +TRACE_EVENT(sd_scr, > + > + TP_PROTO(struct mmc_card *card, struct sd_scr *scr), > + > + TP_ARGS(card, scr), > + > + TP_STRUCT__entry( > + __array(u32, raw, 2) > + __field(unsigned char, sda_vsn) > + __field(unsigned char, sda_spec3) > + __field(unsigned char, bus_widths) > + __field(unsigned char, cmds) > + __string(name, mmc_hostname(card->host)) > + ), > + > + TP_fast_assign( > + memcpy(__entry->raw, card->raw_scr, sizeof(card->raw_scr)); Having the memcpy() size be that of the source is dangerous. Not that the destination will every be smaller, but I would highly suggest either trying to see if "sizeof(__entry->raw)" works or at worse, sizeof(u32)*2. -- Steve > + if (scr) { > + __entry->sda_vsn = scr->sda_vsn; > + __entry->sda_spec3 = scr->sda_spec3; > + __entry->bus_widths = scr->bus_widths; > + __entry->cmds = scr->cmds; > + } else { > + __entry->sda_vsn = 0; > + __entry->sda_spec3 = 0; > + __entry->bus_widths = 0; > + __entry->cmds = 0; > + } > + __assign_str(name, mmc_hostname(card->host)); > + ), > + > + TP_printk("%s: version: %d, spec3: %d, width: %d, cmds: %d, " > + "raw: %s", > + __get_str(name), > + __entry->sda_vsn, > + __entry->sda_spec3, > + __entry->bus_widths, > + __entry->cmds, > + __print_array(__entry->raw, 2, sizeof(u32)) > + ) > +); > + > TRACE_EVENT(mmc_request_start, > > TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),