linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] tracing/filters: don't remove old filters when failed to write subsys->filter
@ 2009-04-21  9:11 Li Zefan
  2009-04-21  9:12 ` [PATCH 2/3] tracing/filters: allow user-input to be integer-like string Li Zefan
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Li Zefan @ 2009-04-21  9:11 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML

If writing subsys->filter returns EINVAL or ENOSPC, the original
filters in subsys/ and subsys/events/ will be removed. This is
definitely wrong.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/trace/trace_events.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index aabf6ea..38cb568 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -600,7 +600,6 @@ subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
 
 	err = filter_add_subsystem_pred(system, pred);
 	if (err < 0) {
-		filter_free_subsystem_preds(system);
 		filter_free_pred(pred);
 		return err;
 	}
-- 
1.5.4.rc3

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

* [PATCH 2/3] tracing/filters: allow user-input to be integer-like string
  2009-04-21  9:11 [PATCH 1/3] tracing/filters: don't remove old filters when failed to write subsys->filter Li Zefan
@ 2009-04-21  9:12 ` Li Zefan
  2009-04-21 10:08   ` [tip:tracing/core] " tip-bot for Li Zefan
  2009-04-21  9:12 ` [PATCH 3/3] tracing/filters: disallow newline as delimeter Li Zefan
  2009-04-21 10:08 ` [tip:tracing/core] tracing/filters: don't remove old filters when failed to write subsys->filter tip-bot for Li Zefan
  2 siblings, 1 reply; 13+ messages in thread
From: Li Zefan @ 2009-04-21  9:12 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML

Suppose we would like to trace all tasks named '123', but this
will fail:
 # echo 'parent_comm == 123' > events/sched/sched_process_fork/filter
 bash: echo: write error: Invalid argument

Don't guess the type of the filter pred in filter_parse(), but instead
we check it in __filter_add_pred().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/trace/trace_events_filter.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index e0fcfd2..6541828 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -313,6 +313,7 @@ static int __filter_add_pred(struct ftrace_event_call *call,
 {
 	struct ftrace_event_field *field;
 	filter_pred_fn_t fn;
+	unsigned long long val;
 
 	field = find_event_field(call, pred->field_name);
 	if (!field)
@@ -322,14 +323,13 @@ static int __filter_add_pred(struct ftrace_event_call *call,
 	pred->offset = field->offset;
 
 	if (is_string_field(field->type)) {
-		if (!pred->str_len)
-			return -EINVAL;
 		fn = filter_pred_string;
 		pred->str_len = field->size;
 		return filter_add_pred_fn(call, pred, fn);
 	} else {
-		if (pred->str_len)
+		if (strict_strtoull(pred->str_val, 0, &val))
 			return -EINVAL;
+		pred->val = val;
 	}
 
 	switch (field->size) {
@@ -413,12 +413,16 @@ int filter_add_subsystem_pred(struct event_subsystem *system,
 	return 0;
 }
 
+/*
+ * The filter format can be
+ *   - 0, which means remove all filter preds
+ *   - [||/&&] <field> ==/!= <val>
+ */
 int filter_parse(char **pbuf, struct filter_pred *pred)
 {
-	char *tmp, *tok, *val_str = NULL;
+	char *tok, *val_str = NULL;
 	int tok_n = 0;
 
-	/* field ==/!= number, or/and field ==/!= number, number */
 	while ((tok = strsep(pbuf, " \n"))) {
 		if (tok_n == 0) {
 			if (!strcmp(tok, "0")) {
@@ -478,19 +482,13 @@ int filter_parse(char **pbuf, struct filter_pred *pred)
 		return -EINVAL;
 	}
 
+	strcpy(pred->str_val, val_str);
+	pred->str_len = strlen(val_str);
+
 	pred->field_name = kstrdup(pred->field_name, GFP_KERNEL);
 	if (!pred->field_name)
 		return -ENOMEM;
 
-	pred->str_len = 0;
-	pred->val = simple_strtoull(val_str, &tmp, 0);
-	if (tmp == val_str) {
-		strncpy(pred->str_val, val_str, MAX_FILTER_STR_VAL);
-		pred->str_len = strlen(val_str);
-		pred->str_val[pred->str_len] = '\0';
-	} else if (*tmp != '\0')
-		return -EINVAL;
-
 	return 0;
 }
 
-- 
1.5.4.rc3


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

* [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21  9:11 [PATCH 1/3] tracing/filters: don't remove old filters when failed to write subsys->filter Li Zefan
  2009-04-21  9:12 ` [PATCH 2/3] tracing/filters: allow user-input to be integer-like string Li Zefan
@ 2009-04-21  9:12 ` Li Zefan
  2009-04-21  9:57   ` Ingo Molnar
  2009-04-21 10:08 ` [tip:tracing/core] tracing/filters: don't remove old filters when failed to write subsys->filter tip-bot for Li Zefan
  2 siblings, 1 reply; 13+ messages in thread
From: Li Zefan @ 2009-04-21  9:12 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML

I guess because user input is often ended with '\n' (like "echo xxx"),
thus '\n' is used as a delimeter besides ' ', but we can just strip
tailing spaces.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/trace/trace_events_filter.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 6541828..0cc6229 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -423,7 +423,9 @@ int filter_parse(char **pbuf, struct filter_pred *pred)
 	char *tok, *val_str = NULL;
 	int tok_n = 0;
 
-	while ((tok = strsep(pbuf, " \n"))) {
+	strstrip(*pbuf);
+
+	while ((tok = strsep(pbuf, " "))) {
 		if (tok_n == 0) {
 			if (!strcmp(tok, "0")) {
 				pred->clear = 1;
-- 
1.5.4.rc3


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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21  9:12 ` [PATCH 3/3] tracing/filters: disallow newline as delimeter Li Zefan
@ 2009-04-21  9:57   ` Ingo Molnar
  2009-04-21 10:06     ` Li Zefan
  0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2009-04-21  9:57 UTC (permalink / raw)
  To: Li Zefan; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML


* Li Zefan <lizf@cn.fujitsu.com> wrote:

> I guess because user input is often ended with '\n' (like "echo 
> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
> just strip tailing spaces.

Hm, how about:

( echo 'x'
  echo '|| y' ) > filter

type of scripts? Shouldnt the parser be permissive in general?

	Ingo

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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21  9:57   ` Ingo Molnar
@ 2009-04-21 10:06     ` Li Zefan
  2009-04-21 10:07       ` Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Li Zefan @ 2009-04-21 10:06 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML

Ingo Molnar wrote:
> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> 
>> I guess because user input is often ended with '\n' (like "echo 
>> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
>> just strip tailing spaces.
> 
> Hm, how about:
> 
> ( echo 'x'
>   echo '|| y' ) > filter
> 
> type of scripts? Shouldnt the parser be permissive in general?
> 

This patch doesn't forbid this usage: ;)

( echo 'parent_comm == a'
  echo '|| parent_comm == b' ) > filter

This patch does forbid this usage:

( echo 'parent_comm'
  echo '=='
  echo 'a' ) > filter


--
Zefan


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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21 10:06     ` Li Zefan
@ 2009-04-21 10:07       ` Ingo Molnar
  2009-04-21 10:14         ` Li Zefan
  0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2009-04-21 10:07 UTC (permalink / raw)
  To: Li Zefan; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML


* Li Zefan <lizf@cn.fujitsu.com> wrote:

> Ingo Molnar wrote:
> > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > 
> >> I guess because user input is often ended with '\n' (like "echo 
> >> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
> >> just strip tailing spaces.
> > 
> > Hm, how about:
> > 
> > ( echo 'x'
> >   echo '|| y' ) > filter
> > 
> > type of scripts? Shouldnt the parser be permissive in general?
> > 
> 
> This patch doesn't forbid this usage: ;)
> 
> ( echo 'parent_comm == a'
>   echo '|| parent_comm == b' ) > filter
> 
> This patch does forbid this usage:
> 
> ( echo 'parent_comm'
>   echo '=='
>   echo 'a' ) > filter

Same argument though, no?

	Ingo

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

* [tip:tracing/core] tracing/filters: don't remove old filters when failed to write subsys->filter
  2009-04-21  9:11 [PATCH 1/3] tracing/filters: don't remove old filters when failed to write subsys->filter Li Zefan
  2009-04-21  9:12 ` [PATCH 2/3] tracing/filters: allow user-input to be integer-like string Li Zefan
  2009-04-21  9:12 ` [PATCH 3/3] tracing/filters: disallow newline as delimeter Li Zefan
@ 2009-04-21 10:08 ` tip-bot for Li Zefan
  2 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Li Zefan @ 2009-04-21 10:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tzanussi, lizf, fweisbec, rostedt, tglx,
	mingo

Commit-ID:  e8082f3f5a17d7a7bfc7dd1050a3f958dc034e9a
Gitweb:     http://git.kernel.org/tip/e8082f3f5a17d7a7bfc7dd1050a3f958dc034e9a
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Tue, 21 Apr 2009 17:11:46 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 21 Apr 2009 11:58:27 +0200

tracing/filters: don't remove old filters when failed to write subsys->filter

If writing subsys->filter returns EINVAL or ENOSPC, the original
filters in subsys/ and subsys/events/ will be removed. This is
definitely wrong.

[ Impact: fix filter setting semantics on error condition ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <49ED8DD2.2070700@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace_events.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 672b195..9ea55a7 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -600,7 +600,6 @@ subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
 
 	err = filter_add_subsystem_pred(system, pred);
 	if (err < 0) {
-		filter_free_subsystem_preds(system);
 		filter_free_pred(pred);
 		return err;
 	}

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

* [tip:tracing/core] tracing/filters: allow user-input to be integer-like string
  2009-04-21  9:12 ` [PATCH 2/3] tracing/filters: allow user-input to be integer-like string Li Zefan
@ 2009-04-21 10:08   ` tip-bot for Li Zefan
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Li Zefan @ 2009-04-21 10:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tzanussi, lizf, fweisbec, rostedt, tglx,
	mingo

Commit-ID:  f66578a7637b87810cbb9041c4e3a77fd2fa4706
Gitweb:     http://git.kernel.org/tip/f66578a7637b87810cbb9041c4e3a77fd2fa4706
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Tue, 21 Apr 2009 17:12:11 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 21 Apr 2009 11:58:28 +0200

tracing/filters: allow user-input to be integer-like string

Suppose we would like to trace all tasks named '123', but this
will fail:

 # echo 'parent_comm == 123' > events/sched/sched_process_fork/filter
 bash: echo: write error: Invalid argument

Don't guess the type of the filter pred in filter_parse(), but instead
we check it in __filter_add_pred().

[ Impact: extend allowed filter field string values ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <49ED8DEB.6000700@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace_events_filter.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index e0fcfd2..6541828 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -313,6 +313,7 @@ static int __filter_add_pred(struct ftrace_event_call *call,
 {
 	struct ftrace_event_field *field;
 	filter_pred_fn_t fn;
+	unsigned long long val;
 
 	field = find_event_field(call, pred->field_name);
 	if (!field)
@@ -322,14 +323,13 @@ static int __filter_add_pred(struct ftrace_event_call *call,
 	pred->offset = field->offset;
 
 	if (is_string_field(field->type)) {
-		if (!pred->str_len)
-			return -EINVAL;
 		fn = filter_pred_string;
 		pred->str_len = field->size;
 		return filter_add_pred_fn(call, pred, fn);
 	} else {
-		if (pred->str_len)
+		if (strict_strtoull(pred->str_val, 0, &val))
 			return -EINVAL;
+		pred->val = val;
 	}
 
 	switch (field->size) {
@@ -413,12 +413,16 @@ int filter_add_subsystem_pred(struct event_subsystem *system,
 	return 0;
 }
 
+/*
+ * The filter format can be
+ *   - 0, which means remove all filter preds
+ *   - [||/&&] <field> ==/!= <val>
+ */
 int filter_parse(char **pbuf, struct filter_pred *pred)
 {
-	char *tmp, *tok, *val_str = NULL;
+	char *tok, *val_str = NULL;
 	int tok_n = 0;
 
-	/* field ==/!= number, or/and field ==/!= number, number */
 	while ((tok = strsep(pbuf, " \n"))) {
 		if (tok_n == 0) {
 			if (!strcmp(tok, "0")) {
@@ -478,19 +482,13 @@ int filter_parse(char **pbuf, struct filter_pred *pred)
 		return -EINVAL;
 	}
 
+	strcpy(pred->str_val, val_str);
+	pred->str_len = strlen(val_str);
+
 	pred->field_name = kstrdup(pred->field_name, GFP_KERNEL);
 	if (!pred->field_name)
 		return -ENOMEM;
 
-	pred->str_len = 0;
-	pred->val = simple_strtoull(val_str, &tmp, 0);
-	if (tmp == val_str) {
-		strncpy(pred->str_val, val_str, MAX_FILTER_STR_VAL);
-		pred->str_len = strlen(val_str);
-		pred->str_val[pred->str_len] = '\0';
-	} else if (*tmp != '\0')
-		return -EINVAL;
-
 	return 0;
 }
 

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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21 10:07       ` Ingo Molnar
@ 2009-04-21 10:14         ` Li Zefan
  2009-04-21 10:16           ` Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Li Zefan @ 2009-04-21 10:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML

Ingo Molnar wrote:
> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> 
>> Ingo Molnar wrote:
>>> * Li Zefan <lizf@cn.fujitsu.com> wrote:
>>>
>>>> I guess because user input is often ended with '\n' (like "echo 
>>>> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
>>>> just strip tailing spaces.
>>> Hm, how about:
>>>
>>> ( echo 'x'
>>>   echo '|| y' ) > filter
>>>
>>> type of scripts? Shouldnt the parser be permissive in general?
>>>
>> This patch doesn't forbid this usage: ;)
>>
>> ( echo 'parent_comm == a'
>>   echo '|| parent_comm == b' ) > filter
>>
>> This patch does forbid this usage:
>>
>> ( echo 'parent_comm'
>>   echo '=='
>>   echo 'a' ) > filter
> 
> Same argument though, no?
> 

Then I have no strong opinion on this. I'm fine to drop this patch.



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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21 10:14         ` Li Zefan
@ 2009-04-21 10:16           ` Ingo Molnar
  2009-04-22  5:21             ` Tom Zanussi
  0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2009-04-21 10:16 UTC (permalink / raw)
  To: Li Zefan; +Cc: Tom Zanussi, Steven Rostedt, Frederic Weisbecker, LKML


* Li Zefan <lizf@cn.fujitsu.com> wrote:

> Ingo Molnar wrote:
> > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > 
> >> Ingo Molnar wrote:
> >>> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> >>>
> >>>> I guess because user input is often ended with '\n' (like "echo 
> >>>> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
> >>>> just strip tailing spaces.
> >>> Hm, how about:
> >>>
> >>> ( echo 'x'
> >>>   echo '|| y' ) > filter
> >>>
> >>> type of scripts? Shouldnt the parser be permissive in general?
> >>>
> >> This patch doesn't forbid this usage: ;)
> >>
> >> ( echo 'parent_comm == a'
> >>   echo '|| parent_comm == b' ) > filter
> >>
> >> This patch does forbid this usage:
> >>
> >> ( echo 'parent_comm'
> >>   echo '=='
> >>   echo 'a' ) > filter
> > 
> > Same argument though, no?
> > 
> 
> Then I have no strong opinion on this. I'm fine to drop this patch.

I've applied the other two - no strong opinion either about this 
patch. Tom, what do you think? (there's also some new parser in the 
works i suspect)

	Ingo

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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-21 10:16           ` Ingo Molnar
@ 2009-04-22  5:21             ` Tom Zanussi
  2009-04-22  8:09               ` Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Tom Zanussi @ 2009-04-22  5:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Li Zefan, Steven Rostedt, Frederic Weisbecker, LKML

On Tue, 2009-04-21 at 12:16 +0200, Ingo Molnar wrote:
> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> 
> > Ingo Molnar wrote:
> > > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > > 
> > >> Ingo Molnar wrote:
> > >>> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > >>>
> > >>>> I guess because user input is often ended with '\n' (like "echo 
> > >>>> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
> > >>>> just strip tailing spaces.
> > >>> Hm, how about:
> > >>>
> > >>> ( echo 'x'
> > >>>   echo '|| y' ) > filter
> > >>>
> > >>> type of scripts? Shouldnt the parser be permissive in general?
> > >>>
> > >> This patch doesn't forbid this usage: ;)
> > >>
> > >> ( echo 'parent_comm == a'
> > >>   echo '|| parent_comm == b' ) > filter
> > >>
> > >> This patch does forbid this usage:
> > >>
> > >> ( echo 'parent_comm'
> > >>   echo '=='
> > >>   echo 'a' ) > filter
> > > 
> > > Same argument though, no?
> > > 
> > 
> > Then I have no strong opinion on this. I'm fine to drop this patch.
> 
> I've applied the other two - no strong opinion either about this 
> patch. Tom, what do you think? (there's also some new parser in the 
> works i suspect)

I think it works ok as it is, so dropping this patch would be fine with
me.

I am working on a new parser; I'd hoped to have it finished by now, but
I seem to be continually distracted lately. :-(  At this point I have a
parser that basically works; the main thing it still needs and what I'm
working on now is a way to allow it to be easily extended to support
special-case handling for special types e.g. if a predicate field refers
to something that's a dev_t, the user should be able to specify 'device
== /dev/sda' or 'device == sda' or 'device == (8,1)' or 'device == 8:1',
so it should be relatively easy to add that kind of support to the
parser when there's a need for it.

Once that's done, I'll hook it all up and post it as soon as I can, at
the end of the week hopefully...

Tom

> 
> 	Ingo


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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-22  5:21             ` Tom Zanussi
@ 2009-04-22  8:09               ` Ingo Molnar
  2009-04-23  5:18                 ` Tom Zanussi
  0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2009-04-22  8:09 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: Li Zefan, Steven Rostedt, Frederic Weisbecker, LKML


* Tom Zanussi <tzanussi@gmail.com> wrote:

> On Tue, 2009-04-21 at 12:16 +0200, Ingo Molnar wrote:
> > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > 
> > > Ingo Molnar wrote:
> > > > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > > > 
> > > >> Ingo Molnar wrote:
> > > >>> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > > >>>
> > > >>>> I guess because user input is often ended with '\n' (like "echo 
> > > >>>> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
> > > >>>> just strip tailing spaces.
> > > >>> Hm, how about:
> > > >>>
> > > >>> ( echo 'x'
> > > >>>   echo '|| y' ) > filter
> > > >>>
> > > >>> type of scripts? Shouldnt the parser be permissive in general?
> > > >>>
> > > >> This patch doesn't forbid this usage: ;)
> > > >>
> > > >> ( echo 'parent_comm == a'
> > > >>   echo '|| parent_comm == b' ) > filter
> > > >>
> > > >> This patch does forbid this usage:
> > > >>
> > > >> ( echo 'parent_comm'
> > > >>   echo '=='
> > > >>   echo 'a' ) > filter
> > > > 
> > > > Same argument though, no?
> > > > 
> > > 
> > > Then I have no strong opinion on this. I'm fine to drop this patch.
> > 
> > I've applied the other two - no strong opinion either about this 
> > patch. Tom, what do you think? (there's also some new parser in the 
> > works i suspect)
> 
> I think it works ok as it is, so dropping this patch would be fine 
> with me.
> 
> I am working on a new parser; I'd hoped to have it finished by 
> now, but I seem to be continually distracted lately. :-( At this 
> point I have a parser that basically works; the main thing it 
> still needs and what I'm working on now is a way to allow it to be 
> easily extended to support special-case handling for special types 
> e.g. if a predicate field refers to something that's a dev_t, the 
> user should be able to specify 'device == /dev/sda' or 'device == 
> sda' or 'device == (8,1)' or 'device == 8:1', so it should be 
> relatively easy to add that kind of support to the parser when 
> there's a need for it.
> 
> Once that's done, I'll hook it all up and post it as soon as I 
> can, at the end of the week hopefully...

Nice! :-)

If your current lineup works you might want to post that straight 
away even without the type extensions, if you think there's value in 
testing/reviewing those bits independently. It generally works 
better to have gradual patches. (we can find bugs sooner, review is 
easier, etc.)

	Ingo

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

* Re: [PATCH 3/3] tracing/filters: disallow newline as delimeter
  2009-04-22  8:09               ` Ingo Molnar
@ 2009-04-23  5:18                 ` Tom Zanussi
  0 siblings, 0 replies; 13+ messages in thread
From: Tom Zanussi @ 2009-04-23  5:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Li Zefan, Steven Rostedt, Frederic Weisbecker, LKML

On Wed, 2009-04-22 at 10:09 +0200, Ingo Molnar wrote:
> * Tom Zanussi <tzanussi@gmail.com> wrote:
> 
> > On Tue, 2009-04-21 at 12:16 +0200, Ingo Molnar wrote:
> > > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > > 
> > > > Ingo Molnar wrote:
> > > > > * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > > > > 
> > > > >> Ingo Molnar wrote:
> > > > >>> * Li Zefan <lizf@cn.fujitsu.com> wrote:
> > > > >>>
> > > > >>>> I guess because user input is often ended with '\n' (like "echo 
> > > > >>>> xxx"), thus '\n' is used as a delimeter besides ' ', but we can 
> > > > >>>> just strip tailing spaces.
> > > > >>> Hm, how about:
> > > > >>>
> > > > >>> ( echo 'x'
> > > > >>>   echo '|| y' ) > filter
> > > > >>>
> > > > >>> type of scripts? Shouldnt the parser be permissive in general?
> > > > >>>
> > > > >> This patch doesn't forbid this usage: ;)
> > > > >>
> > > > >> ( echo 'parent_comm == a'
> > > > >>   echo '|| parent_comm == b' ) > filter
> > > > >>
> > > > >> This patch does forbid this usage:
> > > > >>
> > > > >> ( echo 'parent_comm'
> > > > >>   echo '=='
> > > > >>   echo 'a' ) > filter
> > > > > 
> > > > > Same argument though, no?
> > > > > 
> > > > 
> > > > Then I have no strong opinion on this. I'm fine to drop this patch.
> > > 
> > > I've applied the other two - no strong opinion either about this 
> > > patch. Tom, what do you think? (there's also some new parser in the 
> > > works i suspect)
> > 
> > I think it works ok as it is, so dropping this patch would be fine 
> > with me.
> > 
> > I am working on a new parser; I'd hoped to have it finished by 
> > now, but I seem to be continually distracted lately. :-( At this 
> > point I have a parser that basically works; the main thing it 
> > still needs and what I'm working on now is a way to allow it to be 
> > easily extended to support special-case handling for special types 
> > e.g. if a predicate field refers to something that's a dev_t, the 
> > user should be able to specify 'device == /dev/sda' or 'device == 
> > sda' or 'device == (8,1)' or 'device == 8:1', so it should be 
> > relatively easy to add that kind of support to the parser when 
> > there's a need for it.
> > 
> > Once that's done, I'll hook it all up and post it as soon as I 
> > can, at the end of the week hopefully...
> 
> Nice! :-)
> 
> If your current lineup works you might want to post that straight 
> away even without the type extensions, if you think there's value in 
> testing/reviewing those bits independently. It generally works 
> better to have gradual patches. (we can find bugs sooner, review is 
> easier, etc.)
> 

Sure, I understand.  I wasn't planning on adding any type extensions
with the initial parser, just restructuring the code so that adding them
wouldn't require a lot of restructuring later.  So, yeah, just the basic
parser once I get it into a postable state, very soon, and anything else
for later...

Tom 

> 	Ingo


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

end of thread, other threads:[~2009-04-23  5:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-21  9:11 [PATCH 1/3] tracing/filters: don't remove old filters when failed to write subsys->filter Li Zefan
2009-04-21  9:12 ` [PATCH 2/3] tracing/filters: allow user-input to be integer-like string Li Zefan
2009-04-21 10:08   ` [tip:tracing/core] " tip-bot for Li Zefan
2009-04-21  9:12 ` [PATCH 3/3] tracing/filters: disallow newline as delimeter Li Zefan
2009-04-21  9:57   ` Ingo Molnar
2009-04-21 10:06     ` Li Zefan
2009-04-21 10:07       ` Ingo Molnar
2009-04-21 10:14         ` Li Zefan
2009-04-21 10:16           ` Ingo Molnar
2009-04-22  5:21             ` Tom Zanussi
2009-04-22  8:09               ` Ingo Molnar
2009-04-23  5:18                 ` Tom Zanussi
2009-04-21 10:08 ` [tip:tracing/core] tracing/filters: don't remove old filters when failed to write subsys->filter tip-bot for Li Zefan

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