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

Krzysztof Kozlowski posted 1 patch 4 years, 4 months ago
.../selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc      | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT
Posted by Krzysztof Kozlowski 4 years, 4 months ago
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 externally visible function for the test.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

---

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

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..1d0c7601865f 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="_printk"
 
 ALL_FUNCS="#### all functions enabled ####"
 
-- 
2.32.0

Re: [PATCH] selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT
Posted by Shuah Khan 4 years, 4 months ago
On 2/9/22 9:24 AM, Krzysztof Kozlowski wrote:
> 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 externally visible function for the test.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> 
> ---
> 
> 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(-)
> 
> 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..1d0c7601865f 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="_printk"
>   
>   ALL_FUNCS="#### all functions enabled ####"
>   
> 

Change looks good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

Re: [PATCH] selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT
Posted by Steven Rostedt 4 years, 4 months ago
On Wed,  9 Feb 2022 17:24:30 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote:

> 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 externally visible function for the test.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> 
> ---
> 
> 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(-)
> 
> 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..1d0c7601865f 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="_printk"

The problem with the above, is that it is not guaranteed to trigger (and
probably will not), where as the do_softirq is. The filtering is suppose to
trace something that actually happens.

How about using: scheduler_tick ?

-- Steve


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

Re: [PATCH] selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT
Posted by Krzysztof Kozlowski 4 years, 4 months ago
On 10/02/2022 06:00, Steven Rostedt wrote:
> On Wed,  9 Feb 2022 17:24:30 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote:
> 
>> 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 externally visible function for the test.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>>
>> ---
>>
>> 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(-)
>>
>> 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..1d0c7601865f 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="_printk"
> 
> The problem with the above, is that it is not guaranteed to trigger (and
> probably will not), where as the do_softirq is. The filtering is suppose to
> trace something that actually happens.
> 
> How about using: scheduler_tick ?
> 

This works as well. I had impression that the test is only about
filtering interface and actual function does not have to hit/trigger.

I'll send v2 with scheduler_tick.


Best regards,
Krzysztof