diff mbox series

[v2] selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT

Message ID 20220210083356.11212-1-krzysztof.kozlowski@canonical.com
State Superseded
Headers show
Series [v2] selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT | expand

Commit Message

Krzysztof Kozlowski Feb. 10, 2022, 8:33 a.m. UTC
The PREEMPT_RT patchset does not use soft IRQs thus trying to filter for
do_softirq fails for such kernel:

  echo do_softirq
  ftracetest: 81: echo: echo: I/O error

Choose some other visible function for the test.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

---

Changes since v1:
1. Use scheduler_tick.
2. Add review tag.

Notes:
I understand that the failure does not exist on mainline kernel (only
with PREEMPT_RT patchset) but the change does not harm it.

If it is not suitable alone, please consider it for RT patchset.
---
 .../selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sebastian Andrzej Siewior Feb. 10, 2022, 1:47 p.m. UTC | #1
On 2022-02-10 09:33:56 [+0100], Krzysztof Kozlowski wrote:
> The PREEMPT_RT patchset does not use soft IRQs thus trying to filter for
> do_softirq fails for such kernel:

PREEMPT_RT does use soft IRQs.

>   echo do_softirq
>   ftracetest: 81: echo: echo: I/O error
> 
> Choose some other visible function for the test.
> 
> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> @@ -19,7 +19,7 @@ fail() { # mesg
>  
>  FILTER=set_ftrace_filter
>  FUNC1="schedule"
> -FUNC2="do_softirq"
> +FUNC2="scheduler_tick"

What is the purpose of this?

>  ALL_FUNCS="#### all functions enabled ####"
>  

Sebastian
Sebastian Andrzej Siewior Feb. 10, 2022, 2:10 p.m. UTC | #2
On 2022-02-10 15:05:24 [+0100], Krzysztof Kozlowski wrote:
> On 10/02/2022 14:47, Sebastian Andrzej Siewior wrote:
> > On 2022-02-10 09:33:56 [+0100], Krzysztof Kozlowski wrote:
> >> The PREEMPT_RT patchset does not use soft IRQs thus trying to filter for
> >> do_softirq fails for such kernel:
> > 
> > PREEMPT_RT does use soft IRQs.
> 
> Correct. It does not use do_softirq() code, but follows different path
> with ksoftirqd.
> Shall I rephrase it towards something like this? Or maybe you have some
> more accurate description?

It would be good to describe what the purpose of the change in terms of
the actual problem and the aimed solution.

> The implementation detail is that do_softirq() is in ifndef.

So let me ask again.  We have
   FUNC1="schedule"
   FUNC2="do_softirq"

What is the purpose of this? Do you need FUNC2 when ksoftirqd is run or
when softirqs are served? Not sure how scheduler_tick fits in all this.

> Best regards,
> Krzysztof

Sebastian
Sebastian Andrzej Siewior Feb. 10, 2022, 2:48 p.m. UTC | #3
On 2022-02-10 15:13:15 [+0100], Krzysztof Kozlowski wrote:
> On 10/02/2022 15:10, Sebastian Andrzej Siewior wrote:
> 
> The purpose was explain - fix a failing test with PREEMPT_RT. I am not
> planning to rework entire test, it is merely a fix.

What I got confused by is the fact that you do
s/do_softirq/scheduler_tick/ without any explanation why that is correct.

After looking into the test it appears that two random functions are
enough to be specified because the actual purpose is it to figure out if
the function is recorded and not the actual functionality behind the
function.

> >> The implementation detail is that do_softirq() is in ifndef.
> > 
> > So let me ask again.  We have
> >    FUNC1="schedule"
> >    FUNC2="do_softirq"
> > 
> > What is the purpose of this? Do you need FUNC2 when ksoftirqd is run or
> > when softirqs are served? Not sure how scheduler_tick fits in all this.
> 
> I guess this is more a question to the author of the test. Unless you
> are now questioning the entire purpose of this test?

I questioned the purpose of FUNC2 in this context so I don't have to
look into the actual test. But I did, see above ;)

> Best regards,
> Krzysztof

Sebastian
Steven Rostedt Feb. 10, 2022, 3:07 p.m. UTC | #4
On Thu, 10 Feb 2022 15:48:41 +0100
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> After looking into the test it appears that two random functions are
> enough to be specified because the actual purpose is it to figure out if
> the function is recorded and not the actual functionality behind the
> function.

Correct. And if I ever do get a chance to revisit this test, I plan on
adding a bunch of comments to it. It's hard enough to add tests for one's
code, but even harder to document what those tests actually do ;-)

-- Steve
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
index e96e279e0533..25432b8cd5bd 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
@@ -19,7 +19,7 @@  fail() { # mesg
 
 FILTER=set_ftrace_filter
 FUNC1="schedule"
-FUNC2="do_softirq"
+FUNC2="scheduler_tick"
 
 ALL_FUNCS="#### all functions enabled ####"