linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: artem.bityutskiy@linux.intel.com, mhiramat@kernel.org,
	linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org,
	ndesaulniers@google.com
Subject: Re: [PATCH v3 04/12] tracing: Add dynamic event command creation interface
Date: Wed, 29 Jan 2020 13:02:52 -0600	[thread overview]
Message-ID: <1580324572.2757.2.camel@kernel.org> (raw)
In-Reply-To: <20200129130018.230cef12@gandalf.local.home>

Hi Steve,

On Wed, 2020-01-29 at 13:00 -0500, Steven Rostedt wrote:
> On Fri, 24 Jan 2020 16:56:15 -0600
> Tom Zanussi <zanussi@kernel.org> wrote:
> 
> > +/**
> > + * dynevent_arg_add - Add an arg to a dynevent_cmd
> > + * @cmd: A pointer to the dynevent_cmd struct representing the new
> > event cmd
> > + * @arg: The argument to append to the current cmd
> > + *
> > + * Append an argument to a dynevent_cmd.  The argument string will
> > be
> > + * appended to the current cmd string, followed by a separator, if
> > + * applicable.  Before the argument is added, the check_arg()
> > + * function, if defined, is called.
> > + *
> > + * The cmd string, separator, and check_arg() function should be
> > set
> > + * using the dynevent_arg_init() before any arguments are added
> > using
> > + * this function.
> > + *
> > + * Return: 0 if successful, error otherwise.
> > + */
> > +int dynevent_arg_add(struct dynevent_cmd *cmd,
> > +		     struct dynevent_arg *arg)
> > +{
> > +	int ret = 0;
> > +	int delta;
> > +	char *q;
> > +
> > +	if (arg->check_arg) {
> > +		ret = arg->check_arg(arg);
> > +		if (ret)
> > +			return ret;
> > +	}
> > +
> > +	q = cmd->buf + (cmd->maxlen - cmd->remaining);
> > +
> > +	delta = snprintf(q, cmd->remaining, " %s%c", arg->str,
> > arg->separator);
> > +	if (delta >= cmd->remaining) {
> > +		pr_err("String is too long: %s\n", arg->str);
> > +		return -E2BIG;
> > +	}
> > +	cmd->remaining -= delta;
> 
> This looks like you can take advantage of the seq_buf code
> (see /lib/seq_buf.c), as that handles a lot of this for you.
> 
> As I'm trying to get this into the merge window, I won't delay this
> for
> that (unless I find something else to delay this for), but this
> should
> definitely incorporate seq_buf and not handle its own buffering.
> 

OK, I can send a follow-on patch that does this.

Note that I just sent a v4 series which moves most of the code in this
patch to trace_dynevent.{c,h} as requested by Masami.  No other changes
from v3 were made other than adding acks.

Thanks,

Tom  


> -- Steve
> 
> 
> 
> > +
> > +	return ret;
> > +}

  reply	other threads:[~2020-01-29 19:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 22:56 [PATCH v3 00/12] tracing: Add support for in-kernel dynamic event API Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 01/12] tracing: Add trace_array_find/_get() to find instance trace arrays Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 02/12] tracing: Add trace_get/put_event_file() Tom Zanussi
2020-01-29 17:52   ` Steven Rostedt
2020-01-29 19:05     ` Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 03/12] tracing: Add synth_event_delete() Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 04/12] tracing: Add dynamic event command creation interface Tom Zanussi
2020-01-27 13:44   ` Masami Hiramatsu
2020-01-27 15:24     ` Tom Zanussi
2020-01-29 18:00   ` Steven Rostedt
2020-01-29 19:02     ` Tom Zanussi [this message]
2020-01-29 19:55       ` Steven Rostedt
2020-01-24 22:56 ` [PATCH v3 05/12] tracing: Add synthetic event command generation functions Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 06/12] tracing: Change trace_boot to use synth_event interface Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 07/12] tracing: Add synth_event_trace() and related functions Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 08/12] tracing: Add synth event generation test module Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 09/12] tracing: Add kprobe event command generation functions Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 10/12] tracing: Change trace_boot to use kprobe_event interface Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 11/12] tracing: Add kprobe event command generation test module Tom Zanussi
2020-01-24 22:56 ` [PATCH v3 12/12] tracing: Documentation for in-kernel synthetic event API Tom Zanussi
2020-01-27 13:48 ` [PATCH v3 00/12] tracing: Add support for in-kernel dynamic " Masami Hiramatsu
2020-01-27 15:28   ` Tom Zanussi

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=1580324572.2757.2.camel@kernel.org \
    --to=zanussi@kernel.org \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=ndesaulniers@google.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;
as well as URLs for NNTP newsgroup(s).