linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Raul E Rangel <rrangel@chromium.org>
Cc: linux-mmc@vger.kernel.org, linux-trace-devel@vger.kernel.org,
	djkurtz@chromium.org, zwisler@chromium.org,
	hongjiefang <hongjiefang@asrmicro.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Kyle Roeschley <kyle.roeschley@ni.com>,
	Avri Altman <avri.altman@wdc.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH v1 2/4] mmc: core: Add trace event for SD SSR response
Date: Mon, 15 Apr 2019 19:34:10 -0400	[thread overview]
Message-ID: <20190415193410.2b33d1d6@gandalf.local.home> (raw)
In-Reply-To: <20190415225241.70088-2-rrangel@chromium.org>

On Mon, 15 Apr 2019 16:52:39 -0600
Raul E Rangel <rrangel@chromium.org> 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 <rrangel@chromium.org>
> ---
> 
>  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),


  reply	other threads:[~2019-04-15 23:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 22:52 [PATCH v1 1/4] mmc: core: Add trace event for SD SCR response Raul E Rangel
2019-04-15 22:52 ` [PATCH v1 2/4] mmc: core: Add trace event for SD SSR response Raul E Rangel
2019-04-15 23:34   ` Steven Rostedt [this message]
2019-04-15 22:52 ` [PATCH v1 3/4] mmc: core: Add trace event for SD OCR response Raul E Rangel
2019-04-15 22:52 ` [PATCH v1 4/4] mmc: core: Add trace event for CSD response Raul E Rangel
2019-04-15 23:31 ` [PATCH v1 1/4] mmc: core: Add trace event for SD SCR response Steven Rostedt
2019-04-16 12:36   ` Avri Altman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190415193410.2b33d1d6@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=avri.altman@wdc.com \
    --cc=djkurtz@chromium.org \
    --cc=hongjiefang@asrmicro.com \
    --cc=kyle.roeschley@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rrangel@chromium.org \
    --cc=ulf.hansson@linaro.org \
    --cc=zwisler@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).