about use wild cards for set_ftrace_filter and so on
Hi Steven and Ingo,
I encountered an issue when using ftrace.
We know that we can use wild cards to set set_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name to set_ftrace_filter, not "h*". For example:
#cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
#ls
#touch hraa hrdd
#ls
hraa hrdd
#echo hr* > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filter
No output in /debug/tracing/set_ftrace_filter!
If we use "" to enclose wild cards, it works:
#ls
hraa hrdd
#echo "hr*" > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filter |wc -l
23
This problem can lead to unexpected result if current directory has a lot of files.
I suppose that we can add some notes to document, so a patch attached.
Impact: imporve document
--- Documentation/ftrace.txt | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Documentation/ftrace.txt +3 -0
@@ -1251,6 +1251,9 @@ These are the only wild cards which are supported. <match>*<match> will not work. +Note: you'd better to use "" to enclose wild cards, otherwise in some +case you can't get the correct result. + # echo hrtimer_* > /debug/tracing/set_ftrace_filter Produces:
Signature · 1 line
1.6.0.3
Quoted 26 lines · walimis
I encountered an issue when using ftrace.
We know that we can use wild cards to setset_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name toset_ftrace_filter, not "h*". For example:#cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
#ls
#touch hraa hrdd
#ls
hraa hrdd
#echo hr* > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filterNo output in /debug/tracing/set_ftrace_filter!
If we use "" to enclose wild cards, it works:#ls
hraa hrdd
#echo "hr*" > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filter |wc -l
23
Quoted 3 lines
This problem can lead to unexpected result if current directory has a lot of files.
I suppose that we can add some notes to document, so a patch attached.
Using TB? It's best to inline the patch, that way I can comment on it better.
Anyway, you should fix the example. I also recommend a single quote over double, to prevent any other translation that bash might do.
The example in ftrace.txt should be:
# echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
Thanks,
-- Steve
/me goes back to eating turkeys.
Quoted 29 lines · Steven Rostedt
Quoted 26 lines · walimis
I encountered an issue when using ftrace.
We know that we can use wild cards to setset_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name toset_ftrace_filter, not "h*". For example:#cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
#ls
#touch hraa hrdd
#ls
hraa hrdd
#echo hr* > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filterNo output in /debug/tracing/set_ftrace_filter!
If we use "" to enclose wild cards, it works:#ls
hraa hrdd
#echo "hr*" > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filter |wc -l
23
Quoted 6 lines
Quoted 3 lines
This problem can lead to unexpected result if current directory has a lot of files.
I suppose that we can add some notes to document, so a patch attached.Using TB? It's best to inline the patch, that way I can comment on it better.
Using mutt, but I don't know how to inline the patch now.
Quoted 6 lines
Anyway, you should fix the example. I also recommend a single quote over double, to prevent any other translation that bash might do.
The example in ftrace.txt should be:
Quoted 8 lines
# echo 'hrtimer_*' > /debug/tracing/set_ftrace_filterThanks,
-- Steve
/me goes back to eating turkeys.
I only add a note, but I wonder whether enough.
If needed, I can add a example to this document.
Impact: imporve document
--- Documentation/ftrace.txt | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Documentation/ftrace.txt +3 -0
@@ -1251,6 +1251,9 @@ These are the only wild cards which are supported. <match>*<match> will not work. +Note: you'd better to use '' to enclose wild cards, otherwise in some +case you can't get the correct result. + # echo hrtimer_* > /debug/tracing/set_ftrace_filter Produces:
Signature · 1 line
1.6.0.3
2008/11/27 walimis <[email protected]>:
Quoted 77 lines · Steven Rostedt
Quoted 29 lines · walimis
Quoted 27 lines
I encountered an issue when using ftrace.
We know that we can use wild cards to setset_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name toset_ftrace_filter, not "h*". For example:#cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
#ls
#touch hraa hrdd
#ls
hraa hrdd
#echo hr* > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filterNo output in /debug/tracing/set_ftrace_filter!
If we use "" to enclose wild cards, it works:#ls
hraa hrdd
#echo "hr*" > /debug/tracing/set_ftrace_filter
#cat /debug/tracing/set_ftrace_filter |wc -l
23Quoted 6 lines
Quoted 3 lines
This problem can lead to unexpected result if current directory has a lot of files.
I suppose that we can add some notes to document, so a patch attached.Using TB? It's best to inline the patch, that way I can comment on it better.
Using mutt, but I don't know how to inline the patch now.
Quoted 6 lines
Anyway, you should fix the example. I also recommend a single quote over double, to prevent any other translation that bash might do.
The example in ftrace.txt should be:
Quoted 8 lines
# echo 'hrtimer_*' > /debug/tracing/set_ftrace_filterThanks,
-- Steve
/me goes back to eating turkeys.
I only add a note, but I wonder whether enough.
If needed, I can add a example to this document.Impact: imporve document
Signed-off-by walimis <[email protected]>--- Documentation/ftrace.txt | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)Documentation/ftrace.txt +3
-1@@ -1251,6 +1251,9 @@ These are the only wild cards which are supported. <match>*<match> will not work. +Note: you'd better to use '' to enclose wild cards, otherwise in some +case you can't get the correct result. + # echo hrtimer_* > /debug/tracing/set_ftrace_filter Produces: --
Quoted 1 line
1.6.0.3
Cc'ed Ingo.
Quoted 4 lines · walimis
I only add a note, but I wonder whether enough.
If needed, I can add a example to this document.Impact: imporve document
[ You need to slightly improve the commit log as well ;-) ]
Documentation/ftrace.txt These are the only wild cards which are supported. · line 1257
Quoted 4 lines
Documentation/ftrace.txt +3
-0+Note: you'd better to use '' to enclose wild cards, otherwise in some +case you can't get the correct result. + # echo hrtimer_* > /debug/tracing/set_ftrace_filter
Why not fix the example too? Something like:
Review
Quoted 5 lines
(quoted diff) +4
-0+Note: you'd better to use '' to enclose wild cards, otherwise in some +case you can't get the correct result due to shell wildcard +extension:. + # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
looks good otherwise.
Ingo
PATCH 1/1 ftrace: improve document
Impact: add notice of using wild cards correctly
We know that we can use wild cards to set set_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name to set_ftrace_filter, not "h*". For example:
$cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
$ls
$touch hraa hrdd
$ls
hraa hrdd
$echo hr* > /debug/tracing/set_ftrace_filter
$cat /debug/tracing/set_ftrace_filter
No output in /debug/tracing/set_ftrace_filter!
If we use '' to enclose wild cards, it works:
$ls
hraa hrdd
$echo "hr*" > /debug/tracing/set_ftrace_filter
$cat /debug/tracing/set_ftrace_filter |wc -l
23
This problem can lead to unexpected result if current directory has a lot of files.
--- Documentation/ftrace.txt | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
Documentation/ftrace.txt +5 -2
@@ -1251,7 +1251,10 @@ These are the only wild cards which are supported. <match>*<match> will not work. - # echo hrtimer_* > /debug/tracing/set_ftrace_filter +Note: you'd better to use '' to enclose wild cards, otherwise in some +cases you can't get the correct result. + + # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter Produces:
@@ -1306,7 +1309,7 @@ Again, now we want to append. # echo sys_nanosleep > /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter sys_nanosleep - # echo hrtimer_* >> /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pending
Signature · 1 line
1.6.0.3
Re: [PATCH 1/1] ftrace: improve document
Quoted 39 lines · walimis
Impact: add notice of using wild cards correctly
We know that we can use wild cards to set
set_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name toset_ftrace_filter, not "h*". For example:
$cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
$ls
$touch hraa hrdd
$ls
hraa hrdd
$echo hr* > /debug/tracing/set_ftrace_filter
$cat /debug/tracing/set_ftrace_filterNo output in /debug/tracing/set_ftrace_filter!
If we use '' to enclose wild cards, it works:$ls
hraa hrdd
$echo "hr*" > /debug/tracing/set_ftrace_filter
$cat /debug/tracing/set_ftrace_filter |wc -l
23This problem can lead to unexpected result if current directory has a lot of files.
Signed-off-by walimis <[email protected]>Reviewed-by Ingo Molnar <[email protected]>--- Documentation/ftrace.txt | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)Documentation/ftrace.txt +0
-0
Documentation/ftrace.txt These are the only wild cards which are supported. · line 1255
Quoted 6 lines
Documentation/ftrace.txt +2
-1@@ -1251,7 +1251,10 @@ These are the only wild cards which are supported. <match>*<match> will not work. - # echo hrtimer_* > /debug/tracing/set_ftrace_filter +Note: you'd better to use '' to enclose wild cards, otherwise in some +cases you can't get the correct result.
The above sounds awkward, perhaps something like:
Note: It is better to use quotes to enclose the wild cards, otherwise
the shell may expand the parameters into names of files in the local directory.
-- Steve
Quoted 19 lines
Documentation/ftrace.txt +3
-1+ + # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter Produces:@@ -1306,7 +1309,7 @@ Again, now we want to append. # echo sys_nanosleep > /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter sys_nanosleep - # echo hrtimer_* >> /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pendingSignature · 1 line
1.6.0.3
PATCH 1/1 ftrace: improve document
Impact: add notice of using wild cards correctly
We know that we can use wild cards to set set_ftrace_filter, but there's problem when using such as "echo h* > /debug/tracing/set_ftrace_filter". If there are files named with "h" prefix in current directory, echo "h*" will echo these files' name to set_ftrace_filter, not "h*". For example:
$cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23
$ls
$touch hraa hrdd
$ls
hraa hrdd
$echo hr* > /debug/tracing/set_ftrace_filter
$cat /debug/tracing/set_ftrace_filter
No output in /debug/tracing/set_ftrace_filter!
If we use '' to enclose wild cards, it works:
$ls
hraa hrdd
$echo "hr*" > /debug/tracing/set_ftrace_filter
$cat /debug/tracing/set_ftrace_filter |wc -l
23
This problem can lead to unexpected result if current directory has a lot of files.
--- Documentation/ftrace.txt | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
Documentation/ftrace.txt +6 -2
@@ -1251,7 +1251,11 @@ These are the only wild cards which are supported. <match>*<match> will not work. - # echo hrtimer_* > /debug/tracing/set_ftrace_filter +Note: It is better to use quotes to enclose the wild cards, otherwise + the shell may expand the parameters into names of files in the local + directory. + + # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter Produces:
@@ -1306,7 +1310,7 @@ Again, now we want to append. # echo sys_nanosleep > /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter sys_nanosleep - # echo hrtimer_* >> /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pending
Signature · 1 line
1.6.0.3
Re: [PATCH 1/1] ftrace: improve document
Quoted 4 lines · walimis
Signed-off-by walimis <[email protected]>Reviewed-by Ingo Molnar <[email protected]>Reviewed-by Steven Rostedt <[email protected]>
-- Steve
Quoted 35 lines
--- Documentation/ftrace.txt | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)Documentation/ftrace.txt +6
-2@@ -1251,7 +1251,11 @@ These are the only wild cards which are supported. <match>*<match> will not work. - # echo hrtimer_* > /debug/tracing/set_ftrace_filter +Note: It is better to use quotes to enclose the wild cards, otherwise + the shell may expand the parameters into names of files in the local + directory. + + # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter Produces:@@ -1306,7 +1310,7 @@ Again, now we want to append. # echo sys_nanosleep > /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter sys_nanosleep - # echo hrtimer_* >> /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pendingSignature · 1 line
1.6.0.3
Re: [PATCH 1/1] ftrace: improve document
Quoted 8 lines · Steven Rostedt
Quoted 4 lines · walimis
Signed-off-by walimis <[email protected]>Reviewed-by Ingo Molnar <[email protected]>Reviewed-by Steven Rostedt <[email protected]>Acked-by Steven Rostedt <[email protected]>
applied it to tip/tracing/ftrace, thanks guys! (Changed the commit log a bit, see the final commit below.)
Ingo
-------------->
Quoted 1 line
From
c072c24975ec4f0ccfcb6f5c8a8040b6eb75ef8fMon Sep 17 00:00:00 2001
From: walimis <[email protected]>
Date: Fri, 28 Nov 2008 12:21:19 +0800
Subject: [PATCH] ftrace: improve documentation
Impact: extend documentation with notice of using wild cards correctly
We know that we can use wild cards to set set_ftrace_filter, but there's problem when using them naively such as:
echo h* > /debug/tracing/set_ftrace_filter
If there are files named with "h" prefix in current directory, echo "h*" will echo these filenames to set_ftrace_filter, not the intended "h*".
For example:
$ cat /debug/tracing/available_filter_functions |grep ^hr |wc -l 23 $ ls $ touch hraa hrdd $ ls hraa hrdd $ echo hr* > /debug/tracing/set_ftrace_filter $ cat /debug/tracing/set_ftrace_filter
No output in /debug/tracing/set_ftrace_filter!
If we use '' to escape wild cards, it works:
$ ls hraa hrdd $ echo "hr*" > /debug/tracing/set_ftrace_filter $ cat /debug/tracing/set_ftrace_filter |wc -l 23
This problem can lead to unexpected result if current directory has a lot of files.
--- Documentation/ftrace.txt | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
Documentation/ftrace.txt +6 -2
@@ -1251,7 +1251,11 @@ These are the only wild cards which are supported. <match>*<match> will not work. - # echo hrtimer_* > /debug/tracing/set_ftrace_filter +Note: It is better to use quotes to enclose the wild cards, otherwise + the shell may expand the parameters into names of files in the local + directory. + + # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter Produces:
@@ -1306,7 +1310,7 @@ Again, now we want to append. # echo sys_nanosleep > /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter sys_nanosleep - # echo hrtimer_* >> /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter # cat /debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pending