All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Beau Belgrave <beaub@linux.microsoft.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-trace-devel@vger.kernel.org,
	Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Subject: Re: [PATCH v2] libtraceevent: Add __rel_loc relative location attribute support
Date: Tue, 30 Nov 2021 09:16:25 +0900	[thread overview]
Message-ID: <20211130091625.ff9f101d87b603b251793f6c@kernel.org> (raw)
In-Reply-To: <20211129212635.GA7735@kbox>

On Mon, 29 Nov 2021 13:26:35 -0800
Beau Belgrave <beaub@linux.microsoft.com> wrote:

> On Mon, Nov 29, 2021 at 03:27:04PM -0500, Steven Rostedt wrote:
> > On Mon, 29 Nov 2021 12:15:07 -0800
> > Beau Belgrave <beaub@linux.microsoft.com> wrote:
> > 
> > > > @@ -3308,19 +3318,23 @@ process_function(struct tep_event *event, struct tep_print_arg *arg,
> > > >  		free_token(token);
> > > >  		return process_int_array(event, arg, tok);
> > > >  	}
> > > > -	if (strcmp(token, "__get_str") == 0) {
> > > > +	if (strcmp(token, "__get_str") == 0 ||
> > > > +	    strcmp(token, "__get_rel_str") == 0) {  
> > > 
> > > Should user_events use __get_rel_str vs __get_str for the print_fmt?
> > > Both __dyn_loc and __rel_loc use __get_str currently.
> > 
> > I'm guessing that it should use the get_rel_str(), as get_str() will use
> > the absolute offset and not the relative one.

Yes, you can see an example in this patch;

https://lore.kernel.org/all/163757343050.510314.2876529802471645178.stgit@devnote2/T/#u

Thus, the user-event must tell the kernel which is used
correctly.

> > 
> > -- Steve
> 
> It appears both cases call into process_str() and set the
> TEP_PRINT_STRING field type.
> 
> The TEP_FIELD_IS_RELATIVE bit to advance the offset to a relative position
> is within dynamic_offset which is used for TEP_PRINT_STRING field types.

Correct. The field type attribute is set in event_read_fields() before
this process.

> 
> I'm not sure if this was intentional or if __get_rel_str is an artifact
> left behind considering __get_str appears to be doing the same thing?

Note that this patch is for libtraceevent, not in-kernel code.

In the kernel, for example, your user-event, you must make a flag for
each field to identify that is __rel_loc, __data_loc, or just a value.
The event filter (and histogram) will parse the "events/*/*/format"
file and identify the field is __rel_loc or __data_loc.

https://lore.kernel.org/all/163757343050.510314.2876529802471645178.stgit@devnote2/T/#m98591a73fb48e4ac79ed6d2e8eb14a13c69703c8

And __get_str()/__get_rel_str() are used in the event which statically
defined (Note that trace_event field itself has no information about
the __rel_loc/__data_loc, so print_fmt function for each field must
handle that correctly.)

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

      reply	other threads:[~2021-11-30  0:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  9:36 [PATCH] libtraceevent: Add __rel_loc support Masami Hiramatsu
2021-11-22  9:36 ` [PATCH] libtraceevent: Add __rel_loc relative location attribute support Masami Hiramatsu
2021-11-23  3:39   ` Steven Rostedt
2021-11-23 12:05     ` Masami Hiramatsu
2021-11-23 14:49       ` Steven Rostedt
2021-11-23 13:36     ` [PATCH v2] " Masami Hiramatsu
2021-11-24 23:07       ` Steven Rostedt
2021-11-26 12:20         ` Masami Hiramatsu
2021-11-26 18:23           ` Steven Rostedt
2021-11-29 20:15       ` Beau Belgrave
2021-11-29 20:27         ` Steven Rostedt
2021-11-29 21:26           ` Beau Belgrave
2021-11-30  0:16             ` Masami Hiramatsu [this message]

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=20211130091625.ff9f101d87b603b251793f6c@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=beaub@linux.microsoft.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tz.stoyanov@gmail.com \
    /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.