Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2641537yba; Mon, 15 Apr 2019 16:35:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBv1aDr/EYHcwMZGz5lCen6OICMwmBQI60YZ5cSDGuZTamIYJHytx7B2vOZxNylLPGIhNi X-Received: by 2002:a62:1385:: with SMTP id 5mr79042222pft.221.1555371329129; Mon, 15 Apr 2019 16:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555371329; cv=none; d=google.com; s=arc-20160816; b=IUwYoNdjJ733kdRJsMoydLFIOo4LBNxKi95z5HfFJZeNsI7rEmXKjqB3EInGfi7G0c fwBfj5n+7eISQ41gZqlImvSUsXLhMQlOLRtEtOFPj6DL+zyIwNdydfq0qqLcnSs06dqe pNFHwGuQQy4cYNSQWF0CosFX1KF6LBvM7DQ9ECXek/uK7y00HzvtfSeLh8EqRIGqKDyq iTmJ6StKQOanr9jPoVgVdr5DC6N05h/NkrxumNDBs2cbfhTWD3aaCfHY3XxuiSXcamHc 8AbtKjXSKcvTDxY/aLO+eosAKICRu2CAJ5B3eC71s1cWHU/8rP2uw+7rSBcz5y2aXGUz iyfA== 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=K2SPWsVX4jKHKSnG8eo+zyha9Uu4pqvMZwA7AznH+hM=; b=PEPJd4TYSrev/UBVMOEWgYXZe75E8J/WevdS4DchuRaBVLgp5G3/sBGu7iCQkx3M2C GNhDw0PeCPzTriyPIOcZIywjwMoyU5Sk7bdrwhU5iGC3Qhqfnk9FOL1+MsSFazeqq5lS b+37irTWOHk/m+UWCjv0jKR/vbY9zwO4ziIuZ0GxEHZkywgMgJe4V07kd/h+ZOXQI30y gcXrOXAd0LERiJab5tsNtf9PEpRgrOmXDltngDut9arZTcfG6+Koyq6G62thbgm+T5QX 5SIWMlXfncQuC9mgpdLErIPtTottAPPaA+uNJuVKm0vVg4YdAyLLkyKqpA0RIt5ZRtga 6QYQ== 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.35.12; Mon, 15 Apr 2019 16:35:29 -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 S1728189AbfDOXeO (ORCPT + 99 others); Mon, 15 Apr 2019 19:34:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:46400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbfDOXeN (ORCPT ); Mon, 15 Apr 2019 19:34:13 -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 E27A02064B; Mon, 15 Apr 2019 23:34:11 +0000 (UTC) Date: Mon, 15 Apr 2019 19:34:10 -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, Kyle Roeschley , Avri Altman , Ulf Hansson Subject: Re: [PATCH v1 2/4] mmc: core: Add trace event for SD SSR response Message-ID: <20190415193410.2b33d1d6@gandalf.local.home> In-Reply-To: <20190415225241.70088-2-rrangel@chromium.org> References: <20190415225241.70088-1-rrangel@chromium.org> <20190415225241.70088-2-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:39 -0600 Raul E Rangel wrote: > Example: > sd_ssr: mmc0: au: 8192, erase time: 0, erase offset: 0x0, raw: {0x0,0x3000000,0x1019000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} > > Signed-off-by: Raul E Rangel > --- > > drivers/mmc/core/sd.c | 2 ++ > include/trace/events/mmc.h | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 33 insertions(+) > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > index 3bed7c4b6d75..cc33a4f96c6a 100644 > --- a/drivers/mmc/core/sd.c > +++ b/drivers/mmc/core/sd.c > @@ -282,6 +282,8 @@ static int mmc_read_ssr(struct mmc_card *card) > } > } > > + trace_sd_ssr(card); > + > /* > * starting SD5.1 discard is supported if DISCARD_SUPPORT (b313) is set > */ > diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h > index e45258e8a6cb..cad604ee800f 100644 > --- a/include/trace/events/mmc.h > +++ b/include/trace/events/mmc.h > @@ -52,6 +52,37 @@ TRACE_EVENT(sd_scr, > ) > ); > > +TRACE_EVENT(sd_ssr, > + > + TP_PROTO(struct mmc_card *card), > + > + TP_ARGS(card), > + > + TP_STRUCT__entry( > + __array(u32, raw, 16) > + __field(unsigned int, au) > + __field(unsigned int, erase_timeout) > + __field(unsigned int, erase_offset) > + __string(name, mmc_hostname(card->host)) > + ), > + > + TP_fast_assign( > + memcpy(__entry->raw, card->raw_ssr, sizeof(card->raw_ssr)); Again, memcpy() with the size of the source is dangerous. Hmm, I wonder if a BUILD_BUG_ON(sizeof(u32)*16 < sizeof(card->raw_ssr)) would work here too. If it does, then that would be another approach. -- Steve > + __entry->au = card->ssr.au; > + __entry->erase_timeout = card->ssr.erase_timeout; > + __entry->erase_offset = card->ssr.erase_offset; > + __assign_str(name, mmc_hostname(card->host)); > + ), > + > + TP_printk("%s: au: %d, erase time: %d, erase offset: %#x, raw: %s", > + __get_str(name), > + __entry->au, > + __entry->erase_timeout, > + __entry->erase_offset, > + __print_array(__entry->raw, 16, sizeof(u32)) > + ) > +); > + > TRACE_EVENT(mmc_request_start, > > TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),