linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Duplicate fields in event format of `regcache_sync `
@ 2020-11-20 17:50 Philippe Duplessis-Guindon
  2020-11-20 18:47 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Duplessis-Guindon @ 2020-11-20 17:50 UTC (permalink / raw)
  To: linux-trace-devel

Hi,

I am doing an ftrace plugin for Babeltrace 2 [1], and while I was 
parsing the event fields I had an error saying that `regcache_sync` has 
2 fields named `type`. The problem seems to come from the 
drivers/base/regmap/trace.h file [2]. This is the patch where this was 
added: [3]. The `int field` type is not assigned, so I was wondering if 
it is normal that the field is there.

This is the format of this event:

$ sudo cat /sys/kernel/debug/tracing/events/regmap/regcache_sync/format
name: regcache_sync
ID: 1216
format:
   field:unsigned short common_type;    offset:0;    size:2;    signed:0;
   field:unsigned char common_flags;    offset:2;    size:1;    signed:0;
   field:unsigned char common_preempt_count; offset:3; size:1;signed:0;
   field:int common_pid;    offset:4;    size:4;    signed:1;

   field:__data_loc char[] name;    offset:8;    size:4;    signed:1;
   field:__data_loc char[] status;    offset:12;    size:4;    signed:1;
   field:__data_loc char[] type;    offset:16;    size:4;    signed:1;
   field:int type;    offset:20;    size:4;    signed:1;

   print fmt: "%s type=%s status=%s", __get_str(name), __get_str(type), 
__get_str(status)

Thank you,

Philippe


[1] https://babeltrace.org/

[2] 
https://github.com/torvalds/linux/blob/master/drivers/base/regmap/trace.h#L129

[3] 
https://github.com/torvalds/linux/commit/593600890110c02eb471cf844649dee213870416

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Duplicate fields in event format of `regcache_sync `
  2020-11-20 17:50 Duplicate fields in event format of `regcache_sync ` Philippe Duplessis-Guindon
@ 2020-11-20 18:47 ` Steven Rostedt
  2020-11-20 19:03   ` Philippe Duplessis-Guindon
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2020-11-20 18:47 UTC (permalink / raw)
  To: Philippe Duplessis-Guindon
  Cc: linux-trace-devel, LKML, Dimitris Papastamos, Mark Brown

On Fri, 20 Nov 2020 12:50:33 -0500
Philippe Duplessis-Guindon <pduplessis@efficios.com> wrote:

> Hi,
> 
> I am doing an ftrace plugin for Babeltrace 2 [1], and while I was 
> parsing the event fields I had an error saying that `regcache_sync` has 
> 2 fields named `type`. The problem seems to come from the 
> drivers/base/regmap/trace.h file [2]. This is the patch where this was 
> added: [3]. The `int field` type is not assigned, so I was wondering if 
> it is normal that the field is there.
> 
> This is the format of this event:
> 
> $ sudo cat /sys/kernel/debug/tracing/events/regmap/regcache_sync/format
> name: regcache_sync
> ID: 1216
> format:
>    field:unsigned short common_type;    offset:0;    size:2;    signed:0;
>    field:unsigned char common_flags;    offset:2;    size:1;    signed:0;
>    field:unsigned char common_preempt_count; offset:3; size:1;signed:0;
>    field:int common_pid;    offset:4;    size:4;    signed:1;
> 
>    field:__data_loc char[] name;    offset:8;    size:4;    signed:1;
>    field:__data_loc char[] status;    offset:12;    size:4;    signed:1;
>    field:__data_loc char[] type;    offset:16;    size:4;    signed:1;
>    field:int type;    offset:20;    size:4;    signed:1;
> 
>    print fmt: "%s type=%s status=%s", __get_str(name), __get_str(type), 
> __get_str(status)
> 

It looks like dumb luck that this ever worked. :-/

The correct fix is to nuke that "int type" field. It's not even assigned.

Thanks for pointing this out.

-- Steve


> Thank you,
> 
> Philippe
> 
> 
> [1] https://babeltrace.org/
> 
> [2] 
> https://github.com/torvalds/linux/blob/master/drivers/base/regmap/trace.h#L129
> 
> [3] 
> https://github.com/torvalds/linux/commit/593600890110c02eb471cf844649dee213870416


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Duplicate fields in event format of `regcache_sync `
  2020-11-20 18:47 ` Steven Rostedt
@ 2020-11-20 19:03   ` Philippe Duplessis-Guindon
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Duplessis-Guindon @ 2020-11-20 19:03 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel, LKML, Dimitris Papastamos, Mark Brown

Sorry Steven I forgot to reply all.
This is the original message:
Perfect,

I can prepare a patch, I think this would be a good learning opportunity 
for me.


Thank you,

Philippe

On 2020-11-20 1:47 p.m., Steven Rostedt wrote:
> On Fri, 20 Nov 2020 12:50:33 -0500
> Philippe Duplessis-Guindon <pduplessis@efficios.com> wrote:
> 
>> Hi,
>>
>> I am doing an ftrace plugin for Babeltrace 2 [1], and while I was
>> parsing the event fields I had an error saying that `regcache_sync` has
>> 2 fields named `type`. The problem seems to come from the
>> drivers/base/regmap/trace.h file [2]. This is the patch where this was
>> added: [3]. The `int field` type is not assigned, so I was wondering if
>> it is normal that the field is there.
>>
>> This is the format of this event:
>>
>> $ sudo cat /sys/kernel/debug/tracing/events/regmap/regcache_sync/format
>> name: regcache_sync
>> ID: 1216
>> format:
>>     field:unsigned short common_type;    offset:0;    size:2;    signed:0;
>>     field:unsigned char common_flags;    offset:2;    size:1;    signed:0;
>>     field:unsigned char common_preempt_count; offset:3; size:1;signed:0;
>>     field:int common_pid;    offset:4;    size:4;    signed:1;
>>
>>     field:__data_loc char[] name;    offset:8;    size:4;    signed:1;
>>     field:__data_loc char[] status;    offset:12;    size:4;    signed:1;
>>     field:__data_loc char[] type;    offset:16;    size:4;    signed:1;
>>     field:int type;    offset:20;    size:4;    signed:1;
>>
>>     print fmt: "%s type=%s status=%s", __get_str(name), __get_str(type),
>> __get_str(status)
>>
> 
> It looks like dumb luck that this ever worked. :-/
> 
> The correct fix is to nuke that "int type" field. It's not even assigned.
> 
> Thanks for pointing this out.
> 
> -- Steve
> 
> 
>> Thank you,
>>
>> Philippe
>>
>>
>> [1] https://babeltrace.org/
>>
>> [2]
>> https://github.com/torvalds/linux/blob/master/drivers/base/regmap/trace.h#L129
>>
>> [3]
>> https://github.com/torvalds/linux/commit/593600890110c02eb471cf844649dee213870416
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-20 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 17:50 Duplicate fields in event format of `regcache_sync ` Philippe Duplessis-Guindon
2020-11-20 18:47 ` Steven Rostedt
2020-11-20 19:03   ` Philippe Duplessis-Guindon

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).