All of lore.kernel.org
 help / color / mirror / Atom feed
* event filtering with trace-cmd
@ 2013-06-12 10:13 Arend van Spriel
  2013-06-12 16:22 ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Arend van Spriel @ 2013-06-12 10:13 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel

Hi Steven

I wanted to filter my debug events getting only one specific level. So I 
followed the instruction found online, but I get a parse error.

Running on 3.10-rc1 using trace-cmd 1.0.3. Should I upgrade?

Regards,
Arend
----8<-----------------------------------------------------------------
events/brcmfmac/brcmf_dbg# cat format
name: brcmf_dbg
ID: 1133
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:u32 level;        offset:8;       size:4; signed:0;
         field:__data_loc char[] func;   offset:12;      size:4; signed:1;
         field:__data_loc char[] msg;    offset:16;      size:4; signed:1;
 

print fmt: "%s: %s", __get_str(func), __get_str(msg)

# sudo trace-cmd record -e brcmfmac:brcmf_dbg -f 'level & 0x40000'
disable all
enable brcmfmac:brcmf_dbg
path = /sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/enable
(level & 0x40000)
^
parse_error: Invalid operator

trace-cmd: Invalid argument
   Failed filter of 
/sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/filter


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

* Re: event filtering with trace-cmd
  2013-06-12 10:13 event filtering with trace-cmd Arend van Spriel
@ 2013-06-12 16:22 ` Steven Rostedt
  2013-06-12 17:16   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2013-06-12 16:22 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linux-kernel

On Wed, 2013-06-12 at 12:13 +0200, Arend van Spriel wrote:
> Hi Steven
> 
> I wanted to filter my debug events getting only one specific level. So I 
> followed the instruction found online, but I get a parse error.
> 
> Running on 3.10-rc1 using trace-cmd 1.0.3. Should I upgrade?

I would recommend upgrading regardless, but that's not an issue here.

> 
> Regards,
> Arend
> ----8<-----------------------------------------------------------------
> events/brcmfmac/brcmf_dbg# cat format
> name: brcmf_dbg
> ID: 1133
> 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:u32 level;        offset:8;       size:4; signed:0;
>          field:__data_loc char[] func;   offset:12;      size:4; signed:1;
>          field:__data_loc char[] msg;    offset:16;      size:4; signed:1;
>  
> 
> print fmt: "%s: %s", __get_str(func), __get_str(msg)
> 
> # sudo trace-cmd record -e brcmfmac:brcmf_dbg -f 'level & 0x40000'
> disable all
> enable brcmfmac:brcmf_dbg
> path = /sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/enable
> (level & 0x40000)
> ^
> parse_error: Invalid operator
> 

The record -f command passes the filter into the kernel
file /sys/kerne/debug/tracing/events/brcmfmac/brcmf_dbg/filter, and the
error is actually coming from the kernel itself. Looking at the code, we
do not currently accept binary operations. Although, it shouldn't be too
hard to add. I may go and implement it for 3.11.


Thanks!

-- Steve

> trace-cmd: Invalid argument
>    Failed filter of 
> /sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/filter



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

* Re: event filtering with trace-cmd
  2013-06-12 16:22 ` Steven Rostedt
@ 2013-06-12 17:16   ` Steven Rostedt
  2013-06-12 19:46     ` Arend van Spriel
  2013-06-14  8:22     ` Arend van Spriel
  0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2013-06-12 17:16 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linux-kernel, Tom Zanussi, Masami Hiramatsu

On Wed, 2013-06-12 at 12:22 -0400, Steven Rostedt wrote:

> > # sudo trace-cmd record -e brcmfmac:brcmf_dbg -f 'level & 0x40000'
> > disable all
> > enable brcmfmac:brcmf_dbg
> > path = /sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/enable
> > (level & 0x40000)
> > ^
> > parse_error: Invalid operator
> > 
> 
> The record -f command passes the filter into the kernel
> file /sys/kerne/debug/tracing/events/brcmfmac/brcmf_dbg/filter, and the
> error is actually coming from the kernel itself. Looking at the code, we
> do not currently accept binary operations. Although, it shouldn't be too
> hard to add. I may go and implement it for 3.11.
> 

Here, can you apply this patch and see if it does what you expect?

Thanks,

-- Steve

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index e1b653f..111eddf 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -35,6 +35,7 @@
 
 enum filter_op_ids
 {
+	OP_BAND,
 	OP_OR,
 	OP_AND,
 	OP_GLOB,
@@ -64,6 +65,7 @@ static struct filter_op filter_ops[] = {
 	{ OP_LE,	"<=",		5 },
 	{ OP_GT,	">",		5 },
 	{ OP_GE,	">=",		5 },
+	{ OP_BAND,	"&",		6 },
 	{ OP_NONE,	"OP_NONE",	0 },
 	{ OP_OPEN_PAREN, "(",		0 },
 };
@@ -156,6 +158,9 @@ static int filter_pred_##type(struct filter_pred *pred, void *event)	\
 	case OP_GE:							\
 		match = (*addr >= val);					\
 		break;							\
+	case OP_BAND:							\
+		match = (*addr & val);					\
+		break;							\
 	default:							\
 		break;							\
 	}								\



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

* Re: event filtering with trace-cmd
  2013-06-12 17:16   ` Steven Rostedt
@ 2013-06-12 19:46     ` Arend van Spriel
  2013-06-14  8:22     ` Arend van Spriel
  1 sibling, 0 replies; 5+ messages in thread
From: Arend van Spriel @ 2013-06-12 19:46 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Tom Zanussi, Masami Hiramatsu

On 06/12/2013 07:16 PM, Steven Rostedt wrote:
> On Wed, 2013-06-12 at 12:22 -0400, Steven Rostedt wrote:
>
>>> # sudo trace-cmd record -e brcmfmac:brcmf_dbg -f 'level & 0x40000'
>>> disable all
>>> enable brcmfmac:brcmf_dbg
>>> path = /sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/enable
>>> (level & 0x40000)
>>> ^
>>> parse_error: Invalid operator
>>>
>>
>> The record -f command passes the filter into the kernel
>> file /sys/kerne/debug/tracing/events/brcmfmac/brcmf_dbg/filter, and the
>> error is actually coming from the kernel itself. Looking at the code, we
>> do not currently accept binary operations. Although, it shouldn't be too
>> hard to add. I may go and implement it for 3.11.
>>
>
> Here, can you apply this patch and see if it does what you expect?

Not right now, but you can bet I will first thing tomorrow :-)

Thanks,
Arend

> Thanks,
>
> -- Steve
>
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index e1b653f..111eddf 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c



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

* Re: event filtering with trace-cmd
  2013-06-12 17:16   ` Steven Rostedt
  2013-06-12 19:46     ` Arend van Spriel
@ 2013-06-14  8:22     ` Arend van Spriel
  1 sibling, 0 replies; 5+ messages in thread
From: Arend van Spriel @ 2013-06-14  8:22 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Tom Zanussi, Masami Hiramatsu

On 06/12/2013 07:16 PM, Steven Rostedt wrote:
> On Wed, 2013-06-12 at 12:22 -0400, Steven Rostedt wrote:
>
>>> # sudo trace-cmd record -e brcmfmac:brcmf_dbg -f 'level & 0x40000'
>>> disable all
>>> enable brcmfmac:brcmf_dbg
>>> path = /sys/kernel/debug/tracing/events/brcmfmac/brcmf_dbg/enable
>>> (level & 0x40000)
>>> ^
>>> parse_error: Invalid operator
>>>
>>
>> The record -f command passes the filter into the kernel
>> file /sys/kerne/debug/tracing/events/brcmfmac/brcmf_dbg/filter, and the
>> error is actually coming from the kernel itself. Looking at the code, we
>> do not currently accept binary operations. Although, it shouldn't be too
>> hard to add. I may go and implement it for 3.11.
>>
>
> Here, can you apply this patch and see if it does what you expect?

Hi Steven,

That patch does exactly what I expect. Thanks.

Regards,
Arend


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

end of thread, other threads:[~2013-06-14  8:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12 10:13 event filtering with trace-cmd Arend van Spriel
2013-06-12 16:22 ` Steven Rostedt
2013-06-12 17:16   ` Steven Rostedt
2013-06-12 19:46     ` Arend van Spriel
2013-06-14  8:22     ` Arend van Spriel

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.