All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Tom Zanussi <zanussi@kernel.org>
Cc: rostedt@goodmis.org, tglx@linutronix.de, mhiramat@kernel.org,
	namhyung@kernel.org, bigeasy@linutronix.de,
	joel@joelfernandes.org, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v4 01/11] tracing: Add tracing error log
Date: Tue, 26 Mar 2019 17:22:39 +0900	[thread overview]
Message-ID: <20190326172239.563f933cceb1f71c45f7e474@kernel.org> (raw)
In-Reply-To: <5038ab97eaa3cf23c16264299221c5f1c5cf8147.1553268040.git.tom.zanussi@linux.intel.com>

Hi Tom,

On Fri, 22 Mar 2019 10:34:27 -0500
Tom Zanussi <zanussi@kernel.org> wrote:

> +static int tracing_err_log_open(struct inode *inode, struct file *file)
> +{
> +	if (file->f_mode & FMODE_WRITE) {
> +		if (file->f_flags & O_TRUNC)
> +			return 0;
> +		else
> +			return -EINVAL;
> +	}
> +
> +	return seq_open(file, &tracing_err_log_seq_ops);
> +}
> +
> +static ssize_t tracing_err_log_write(struct file *file,
> +				     const char __user *buffer,
> +				     size_t count, loff_t *ppos)
> +{
> +	if (count == 1)
> +		clear_tracing_err_log();
> +	else
> +		return -EINVAL;
> +
> +	*ppos += count;
> +
> +	return count;
> +}

Hmm, could you make this as same as "tracing/trace"?
- It clears buffer at open with WRITE & TRUNC flag
- It just ignore how much user wrote (works as /dev/null)

See tracing_open() and tracing_write_stub() in
kernel/trace/trace.c.

Thank you,


> +
> +static const struct file_operations tracing_err_log_fops = {
> +	.open           = tracing_err_log_open,
> +	.write		= tracing_err_log_write,
> +	.read           = seq_read,
> +	.llseek         = seq_lseek,
> +};
> +
>  static int tracing_buffers_open(struct inode *inode, struct file *filp)
>  {
>  	struct trace_array *tr = inode->i_private;
> @@ -8258,6 +8478,9 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
>  			  tr, &snapshot_fops);
>  #endif
>  
> +	trace_create_file("error_log", 0644, d_tracer,
> +			  tr, &tracing_err_log_fops);
> +
>  	for_each_tracing_cpu(cpu)
>  		tracing_init_tracefs_percpu(tr, cpu);
>  
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index d80cee49e0eb..b711edbef7e7 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -1884,6 +1884,10 @@ extern ssize_t trace_parse_run_command(struct file *file,
>  		const char __user *buffer, size_t count, loff_t *ppos,
>  		int (*createfn)(int, char**));
>  
> +extern unsigned int err_pos(char *cmd, const char *str);
> +extern void tracing_log_err(const char *loc, const char *cmd,
> +			    const char **errs, u8 type, u8 pos);
> +
>  /*
>   * Normal trace_printk() and friends allocates special buffers
>   * to do the manipulation, as well as saves the print formats
> -- 
> 2.14.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2019-03-26  8:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 15:34 [PATCH v4 00/11] tracing: common error_log for ftrace Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 01/11] tracing: Add tracing error log Tom Zanussi
2019-03-26  8:22   ` Masami Hiramatsu [this message]
2019-03-22 15:34 ` [PATCH v4 02/11] tracing: Save the last hist command's associated event name Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 03/11] tracing: Use tracing error_log with hist triggers Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 04/11] tracing: Use tracing error_log with trace event filters Tom Zanussi
2019-03-25 11:37   ` Namhyung Kim
2019-03-25 14:28     ` Steven Rostedt
2019-03-22 15:34 ` [PATCH v4 05/11] tracing: Use tracing error_log with probe events Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 06/11] selftests/ftrace: Add error_log testcase for probe errors Tom Zanussi
2019-03-23 10:22   ` Masami Hiramatsu
2019-03-23 13:11     ` Tom Zanussi
2019-03-24 10:11       ` Masami Hiramatsu
2019-03-22 15:34 ` [PATCH v4 07/11] tracing: Remove trigger-extended-error-support testcase Tom Zanussi
2019-03-23 10:13   ` Masami Hiramatsu
2019-03-23 13:08     ` Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 08/11] selftests/ftrace: Add tracing/error_log testcase Tom Zanussi
2019-03-23 12:08   ` Masami Hiramatsu
2019-03-23 13:17     ` Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 09/11] tracing: Add tracing/error_log Documentation Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 10/11] tracing: Add error_log to README Tom Zanussi
2019-03-22 15:34 ` [PATCH v4 11/11] selftests/ftrace: Change stderr redirection for probe error_log testcase Tom Zanussi
2019-03-23 10:28   ` Masami Hiramatsu
2019-03-23 13:14     ` Tom Zanussi
2019-03-23 10:14 ` [PATCH v4 00/11] tracing: common error_log for ftrace Masami Hiramatsu

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=20190326172239.563f933cceb1f71c45f7e474@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=zanussi@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.