All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
@ 2015-12-24  5:22 Chuyu Hu
  2016-02-04 14:28 ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Chuyu Hu @ 2015-12-24  5:22 UTC (permalink / raw
  To: ltp

When running the tests on RHEL7, got message as below:
---------
/mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh: line 25: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled: Permission denied
/mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh: line 26: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled: Permission denied
---------

The reason is that the tracing_enabled file has been removed
since kernel v3.8 by commits:

02404ba tracing: Remove deprecated tracing_enabled file
0fb9656 tracing: Make tracing_enabled be equal to tracing_on
6752ab4 tracing: Deprecate tracing_enabled for tracing_on

This workaround fix just uses a similar way of the original author:
1. check if the tracing_enabled is supported when save/restore the value of the file.
2. check if the tracing_enabled is supported in the trace_tracing_enabled.sh

Signed-off-by: Chuyu Hu <chuhu@redhat.com>
---
 .../ftrace_stress/ftrace_tracing_enabled.sh                   | 11 +++++++++++
 .../kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh   | 10 ++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh b/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh
index 69f2ae6..af83b19 100755
--- a/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh
+++ b/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh
@@ -16,8 +16,19 @@
 MAX_LOOP=1500
 count=0
 
+if [ ! -e $TRACING_PATH/tracing_enabled ]; then
+	should_skip=1
+else
+	should_skip=0
+fi
+
 for ((; ;))
 {
+	if [ $should_skip -eq 1 ]; then
+		sleep 2
+		continue
+	fi
+
 	count=$(( $count + 1 ))
 
 	for ((i = 0; i < $MAX_LOOP; i++))
diff --git a/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh b/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh
index 6a111e9..f36c835 100755
--- a/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh
+++ b/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh
@@ -42,13 +42,16 @@ save_old_setting()
 
 	old_trace_options=( `cat trace_options` )
 	old_tracing_on=`cat tracing_on`
-	old_tracing_enabled=`cat tracing_enabled`
 	old_buffer_size=`cat buffer_size_kb`
 
 	if [ -e stack_max_size ]; then
 		old_stack_tracer_enabled=`cat /proc/sys/kernel/stack_tracer_enabled`
 	fi
 
+	if [ -e tracing_enabled ]; then
+		old_tracing_enabled=`cat tracing_enabled`
+	fi
+
 	if [ -e "/proc/sys/kernel/ftrace_enabled" ]; then
 		old_ftrace_enabled=`cat /proc/sys/kernel/ftrace_enabled`
 	fi
@@ -85,9 +88,12 @@ restore_old_setting()
 		echo 0 > stack_max_size
 	fi
 
+	if [ -e tracing_enabled ]; then
+		echo $old_tracing_enabled > tracing_enabled
+	fi
+
 	echo $old_buffer_size > buffer_size_kb
 	echo $old_tracing_on > tracing_on
-	echo $old_tracing_enabled > tracing_enabled
 
 	for option in $old_trace_options
 	do
-- 
1.8.3.1


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

* [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
  2015-12-24  5:22 [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported Chuyu Hu
@ 2016-02-04 14:28 ` Cyril Hrubis
  2016-02-04 15:06   ` Steven Rostedt
  2016-02-05  6:09   ` Chunyu Hu
  0 siblings, 2 replies; 6+ messages in thread
From: Cyril Hrubis @ 2016-02-04 14:28 UTC (permalink / raw
  To: ltp

Hi!
> When running the tests on RHEL7, got message as below:
> ---------
> /mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh: line 25: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled: Permission denied
> /mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh: line 26: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled: Permission denied
> ---------
> 
> The reason is that the tracing_enabled file has been removed
> since kernel v3.8 by commits:
> 
> 02404ba tracing: Remove deprecated tracing_enabled file
> 0fb9656 tracing: Make tracing_enabled be equal to tracing_on
> 6752ab4 tracing: Deprecate tracing_enabled for tracing_on

Looking at the commits shouldn't we use tracing_on instead of
tracing_enabled on newer kernels?

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
  2016-02-04 14:28 ` Cyril Hrubis
@ 2016-02-04 15:06   ` Steven Rostedt
  2016-02-04 15:11     ` Cyril Hrubis
  2016-02-05  6:09   ` Chunyu Hu
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2016-02-04 15:06 UTC (permalink / raw
  To: ltp

On Thu, 2016-02-04 at 15:28 +0100, Cyril Hrubis wrote:
> Hi!
> > When running the tests on RHEL7, got message as below:
> > ---------
> > /mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh: line 25: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled: Permission denied
> > /mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh: line 26: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled: Permission denied
> > ---------
> > 
> > The reason is that the tracing_enabled file has been removed
> > since kernel v3.8 by commits:
> > 
> > 02404ba tracing: Remove deprecated tracing_enabled file
> > 0fb9656 tracing: Make tracing_enabled be equal to tracing_on
> > 6752ab4 tracing: Deprecate tracing_enabled for tracing_on
> 
> Looking at the commits shouldn't we use tracing_on instead of
> tracing_enabled on newer kernels?
> 

Yes, and you should be using tracing_on even in older kernels.
tracing_enabled has been deprecated for a long time now.

-- Steve



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

* [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
  2016-02-04 15:06   ` Steven Rostedt
@ 2016-02-04 15:11     ` Cyril Hrubis
  2016-02-04 16:23       ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2016-02-04 15:11 UTC (permalink / raw
  To: ltp

Hi!
> > Looking at the commits shouldn't we use tracing_on instead of
> > tracing_enabled on newer kernels?
> > 
> 
> Yes, and you should be using tracing_on even in older kernels.
> tracing_enabled has been deprecated for a long time now.

Also looking at the stress test all it does is writing to various files
(in several background loops) that store tracing parameters. Is that
even reasonable test? I guess that it can find out race conditions
between functions that handle the write for the options...

And it uses the tracing_on file as well. So we can just skip starting
the loop writes to the ftrace_enabled file if it's not present.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
  2016-02-04 15:11     ` Cyril Hrubis
@ 2016-02-04 16:23       ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2016-02-04 16:23 UTC (permalink / raw
  To: ltp

On Thu, 2016-02-04 at 16:11 +0100, Cyril Hrubis wrote:

> Also looking at the stress test all it does is writing to various files
> (in several background loops) that store tracing parameters. Is that
> even reasonable test? I guess that it can find out race conditions
> between functions that handle the write for the options...

I don't use the LTP tests for ftrace, so I wouldn't know.

> 
> And it uses the tracing_on file as well. So we can just skip starting
> the loop writes to the ftrace_enabled file if it's not present.
> 

ftrace_enabled is completely different. It disables function tracing
capabilities (and should be avoided
if /sys/kernel/debug/tracing/options/function-trace is present. As that
will only disable function hooks for tracing,
where /proc/sys/kernel/ftrace_enabled disables *all* hooks (including
those for live kernel patching). Which I need to make a patch to prevent
that :-/

-- Steve



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

* [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
  2016-02-04 14:28 ` Cyril Hrubis
  2016-02-04 15:06   ` Steven Rostedt
@ 2016-02-05  6:09   ` Chunyu Hu
  1 sibling, 0 replies; 6+ messages in thread
From: Chunyu Hu @ 2016-02-05  6:09 UTC (permalink / raw
  To: ltp



Thanks & Regards
Name: Chunyu Hu (???)
Team: kernel QE  --general
Phon: 8388193 , 861062608193  
IRC : chunyu
Mail: chuhu@redhat.com
Red Hat China R&D Branch (Raycom)

----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Chuyu Hu" <chuhu@redhat.com>
> Cc: ltp@lists.linux.it, srostedt@redhat.com
> Sent: Thursday, February 4, 2016 10:28:30 PM
> Subject: Re: [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported
> 
> Hi!
> > When running the tests on RHEL7, got message as below:
> > ---------
> > /mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh:
> > line 25: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled:
> > Permission denied
> > /mnt/testarea/ltp/testcases/bin/ftrace_stress/ftrace_tracing_enabled.sh:
> > line 26: /mnt/testarea/ltp/testcases/bin/debugfs/tracing/tracing_enabled:
> > Permission denied
> > ---------
> > 
> > The reason is that the tracing_enabled file has been removed
> > since kernel v3.8 by commits:
> > 
> > 02404ba tracing: Remove deprecated tracing_enabled file
> > 0fb9656 tracing: Make tracing_enabled be equal to tracing_on
> > 6752ab4 tracing: Deprecate tracing_enabled for tracing_on
> 
> Looking at the commits shouldn't we use tracing_on instead of
> tracing_enabled on newer kernels?

Hi,

Thanks for review.Each script in this case is just responsible for one
trace file, In order to make this script aligned with the file name and
other scripts in this case,I didn't switch the tracing_enabled to tracing_on
in this script.It is just a light fix for avoiding the 'permission denied' 
warning log during testing.

There was a period that both the tracing_on and tracing_enabled exist in the tracing
directory.So remain the ftrace_tracing_enabled.sh there just for testing the
tracing_enabled file(through read/write parameter from/to the file) for old kernels that
supported this.And let it check if its target test file is there before reading/writing
against the file, if it's not there in new kernels,it will just keep sleeping in the loop.
And we have another script to test the 'tracing_on'.



> --
> Cyril Hrubis
> chrubis@suse.cz
>

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

end of thread, other threads:[~2016-02-05  6:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-24  5:22 [LTP] [PATCH] ftrace_stress_test: check if tracing_enabled is supported Chuyu Hu
2016-02-04 14:28 ` Cyril Hrubis
2016-02-04 15:06   ` Steven Rostedt
2016-02-04 15:11     ` Cyril Hrubis
2016-02-04 16:23       ` Steven Rostedt
2016-02-05  6:09   ` Chunyu Hu

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.