mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ziqian SUN (Zamir)" <zsun@redhat.com>
To: rostedt@goodmis.org, linux-kernel@vger.kernel.org
Cc: mingo@redhat.com, karolherbst@gmail.com, ppaalanen@gmail.com,
	akpm@linux-foundation.org, Ziqian Sun <zsun@redhat.com>
Subject: Re: [PATCH v3] tracing: Ignore mmiotrace from kernel commandline
Date: Mon, 11 Sep 2017 14:31:34 +0800	[thread overview]
Message-ID: <3cec495b-89a5-b8c6-e319-af9f969582e0@redhat.com> (raw)
In-Reply-To: <1505111195-31942-1-git-send-email-zsun@redhat.com>


On 09/11/2017 02:26 PM, Ziqian SUN (Zamir) wrote:
> From: "Ziqian SUN (Zamir)" <zsun@redhat.com>
> 
> The mmiotrace tracer cannot be enabled with ftrace=mmiotrace in kernel
> commandline. With this patch, noboot is added to the tracer struct,
> and when system boot with a tracer that has noboot=true, it will print
> out a warning message and continue booting.
> 
> Signed-off-by: Ziqian SUN (Zamir) <zsun@redhat.com>
> --
> v1 -> v2 : remove unessential comment
> v2 -> v3 : Use tracer struct instead of a separate list to store noboot
> ---
>   kernel/trace/trace.c           | 7 +++++++
>   kernel/trace/trace.h           | 2 ++
>   kernel/trace/trace_mmiotrace.c | 1 +
>   3 files changed, 10 insertions(+)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 5360b7a..48c474f 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -5358,6 +5358,13 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
>   	if (t == tr->current_trace)
>   		goto out;
>   
> +	/* Some tracers won't work on kernel command line */
> +	if (system_state < SYSTEM_RUNNING && t->noboot) {
> +		pr_warn("Tracer '%s' is not allowed on command line, ignored\n",
> +			t->name);
I feel the core trace printed by WARN is not so meaningful, so I use 
pr_warn instead.
> +		goto out;
> +	}
> +
>   	/* Some tracers are only allowed for the top level buffer */
>   	if (!trace_ok_for_array(t, tr)) {
>   		ret = -EINVAL;
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index fb5d54d..652c682 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -444,6 +444,8 @@ struct tracer {
>   #ifdef CONFIG_TRACER_MAX_TRACE
>   	bool			use_max_tr;
>   #endif
> +	/* True if tracer cannot be enabled in kernel param */
> +	bool			noboot;
>   };
>   
>   
> diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
> index cd7480d..dca78fc 100644
> --- a/kernel/trace/trace_mmiotrace.c
> +++ b/kernel/trace/trace_mmiotrace.c
> @@ -282,6 +282,7 @@ static enum print_line_t mmio_print_line(struct trace_iterator *iter)
>   	.close		= mmio_close,
>   	.read		= mmio_read,
>   	.print_line	= mmio_print_line,
> +	.noboot		= true,
>   };
>   
>   __init static int init_mmio_trace(void)
> 

This patch passed my own test on top of Fedora kernel 4.13.0-1.fc26.x86_64.
-- 
Ziqian SUN (Zamir)
9F Raycom office (NAY)
Red Hat Software (Beijing) Co.,Ltd
IRC: zsun (internal and freenode)
Tel: +86 10 65627458
GPG : 1D86 6D4A 49CE 4BBD 72CF FCF5 D856 6E11 F2A0 525E

  reply	other threads:[~2017-09-11  6:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11  6:26 Ziqian SUN (Zamir)
2017-09-11  6:31 ` Ziqian SUN (Zamir) [this message]
2017-09-11 11:23   ` Steven Rostedt
2017-09-12 12:18     ` Ziqian SUN (Zamir)
2017-09-18 10:34       ` Ziqian SUN (Zamir)
2017-09-19 16:25       ` Steven Rostedt

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=3cec495b-89a5-b8c6-e319-af9f969582e0@redhat.com \
    --to=zsun@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=karolherbst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=ppaalanen@gmail.com \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®