[PATCH 0/2] selftests/verification: Add initial RV tests

Gabriele Monaco posted 2 patches 4 months, 2 weeks ago
There is a newer version of this series
MAINTAINERS                                   |  1 +
tools/testing/selftests/ftrace/ftracetest     | 34 ++++++---
.../ftrace/test.d/00basic/mount_options.tc    |  2 +-
.../testing/selftests/ftrace/test.d/functions |  6 +-
.../testing/selftests/verification/.gitignore |  2 +
tools/testing/selftests/verification/Makefile |  8 ++
tools/testing/selftests/verification/config   |  1 +
tools/testing/selftests/verification/settings |  1 +
.../selftests/verification/test.d/functions   | 39 ++++++++++
.../test.d/rv_monitor_enable_disable.tc       | 75 +++++++++++++++++++
.../verification/test.d/rv_monitor_reactor.tc | 68 +++++++++++++++++
.../test.d/rv_monitors_available.tc           | 18 +++++
.../verification/test.d/rv_wwnr_printk.tc     | 29 +++++++
.../verification/verificationtest-ktap        |  8 ++
14 files changed, 278 insertions(+), 14 deletions(-)
create mode 100644 tools/testing/selftests/verification/.gitignore
create mode 100644 tools/testing/selftests/verification/Makefile
create mode 100644 tools/testing/selftests/verification/config
create mode 100644 tools/testing/selftests/verification/settings
create mode 100644 tools/testing/selftests/verification/test.d/functions
create mode 100644 tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc
create mode 100644 tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc
create mode 100644 tools/testing/selftests/verification/test.d/rv_monitors_available.tc
create mode 100644 tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
create mode 100644 tools/testing/selftests/verification/verificationtest-ktap
[PATCH 0/2] selftests/verification: Add initial RV tests
Posted by Gabriele Monaco 4 months, 2 weeks ago
Add a series of tests to validate the RV tracefs API and basic
functionality.

* available monitors:
    Check that all monitors (from the monitors folder) appear as
    available and have a description. Works with nested monitors.

* enable/disable:
    Enable and disable all monitors and validate both the enabled file
    and the enabled_monitors. Check that enabling container monitors
    enables all nested monitors.

* reactors:
    Set all reactors and validate the setting, also for nested monitors.

* wwnr with printk:
    wwnr is broken on purpose, run it with a load and check that the
    printk reactor works. Also validate disabling reacting_on or
    monitoring_on prevents reactions.

These tests use the ftracetest suite. The first patch of the series
adapts ftracetest to make this possible.

The enable/disable test cannot pass on upstream without the application
of the fix in [1].

[1] - https://lore.kernel.org/lkml/87tt0t4u19.fsf@yellow.woof

To: Steven Rostedt <rostedt@goodmis.org>
To: Nam Cao <namcao@linutronix.de>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: John Kacur <jkacur@redhat.com>
Cc: Waylon Cude <wcude@redhat.com>
Cc: linux-trace-kernel@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org

Gabriele Monaco (2):
  selftest/ftrace: Generalise ftracetest to use with RV
  selftests/verification: Add initial RV tests

 MAINTAINERS                                   |  1 +
 tools/testing/selftests/ftrace/ftracetest     | 34 ++++++---
 .../ftrace/test.d/00basic/mount_options.tc    |  2 +-
 .../testing/selftests/ftrace/test.d/functions |  6 +-
 .../testing/selftests/verification/.gitignore |  2 +
 tools/testing/selftests/verification/Makefile |  8 ++
 tools/testing/selftests/verification/config   |  1 +
 tools/testing/selftests/verification/settings |  1 +
 .../selftests/verification/test.d/functions   | 39 ++++++++++
 .../test.d/rv_monitor_enable_disable.tc       | 75 +++++++++++++++++++
 .../verification/test.d/rv_monitor_reactor.tc | 68 +++++++++++++++++
 .../test.d/rv_monitors_available.tc           | 18 +++++
 .../verification/test.d/rv_wwnr_printk.tc     | 29 +++++++
 .../verification/verificationtest-ktap        |  8 ++
 14 files changed, 278 insertions(+), 14 deletions(-)
 create mode 100644 tools/testing/selftests/verification/.gitignore
 create mode 100644 tools/testing/selftests/verification/Makefile
 create mode 100644 tools/testing/selftests/verification/config
 create mode 100644 tools/testing/selftests/verification/settings
 create mode 100644 tools/testing/selftests/verification/test.d/functions
 create mode 100644 tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc
 create mode 100644 tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc
 create mode 100644 tools/testing/selftests/verification/test.d/rv_monitors_available.tc
 create mode 100644 tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
 create mode 100644 tools/testing/selftests/verification/verificationtest-ktap


base-commit: cec1e6e5d1ab33403b809f79cd20d6aff124ccfe
-- 
2.51.0
Re: [PATCH 0/2] selftests/verification: Add initial RV tests
Posted by Nam Cao 3 months, 3 weeks ago
Gabriele Monaco <gmonaco@redhat.com> writes:
> Add a series of tests to validate the RV tracefs API and basic
> functionality.

Thanks for the writing this test. My bash knowledge is not great, and
I'm not familiar with the existing ftrace test, so I am not able to
review all the details. But looks good as far as I can tell:

Acked-by: Nam Cao <namcao@linutronix.de>
Re: [PATCH 0/2] selftests/verification: Add initial RV tests
Posted by Gabriele Monaco 3 months, 3 weeks ago
On Fri, 2025-10-17 at 09:38 +0200, Nam Cao wrote:
> Gabriele Monaco <gmonaco@redhat.com> writes:
> > Add a series of tests to validate the RV tracefs API and basic
> > functionality.
> 
> Thanks for the writing this test. My bash knowledge is not great, and
> I'm not familiar with the existing ftrace test, so I am not able to
> review all the details. But looks good as far as I can tell:
> 
> Acked-by: Nam Cao <namcao@linutronix.de>

Thanks for the ack!
I think that's good for now as it's going to go to Steve as a next step anyway.

I'm going to send a V2 with the following change just to increase the likelihood
of a wwnr reaction and prepare a PR.
I'll keep your ack there unless you explicitly mean otherwise.

Thanks,
Gabriele

diff --git a/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
b/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
index bc0b2668bf7c..5a59432b1d93 100644
--- a/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
+++ b/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
@@ -4,9 +4,10 @@
 # requires: available_reactors wwnr:monitor printk:reactor stress-ng:program
 
 load() { # returns true if there was a reaction
-       local lines_before
+       local lines_before num
+       num=$((($(nproc) + 1) / 2))
        lines_before=$(dmesg | wc -l)
-       stress-ng --cpu-sched 2 --timer 2 -t 5 -q
+       stress-ng --cpu-sched "$num" --timer "$num" -t 5 -q
        dmesg | tail -n $((lines_before + 1)) | grep -q "rv: monitor wwnr does
not allow event"
 }
Re: [PATCH 0/2] selftests/verification: Add initial RV tests
Posted by Gabriele Monaco 3 months, 3 weeks ago
On Fri, 2025-09-26 at 11:46 +0200, Gabriele Monaco wrote:
> Add a series of tests to validate the RV tracefs API and basic
> functionality.
> 
> * available monitors:
>     Check that all monitors (from the monitors folder) appear as
>     available and have a description. Works with nested monitors.
> 
> * enable/disable:
>     Enable and disable all monitors and validate both the enabled file
>     and the enabled_monitors. Check that enabling container monitors
>     enables all nested monitors.
> 
> * reactors:
>     Set all reactors and validate the setting, also for nested monitors.
> 
> * wwnr with printk:
>     wwnr is broken on purpose, run it with a load and check that the
>     printk reactor works. Also validate disabling reacting_on or
>     monitoring_on prevents reactions.
> 
> These tests use the ftracetest suite. The first patch of the series
> adapts ftracetest to make this possible.
> 
> The enable/disable test cannot pass on upstream without the application
> of the fix in [1].

Steve, Nam, would you have time to have a look at this series.
If possible, I'd like to get this minimal selftest to next together with Nam's
(urgent) patches.

Thanks,
Gabriele

> 
> [1] - https://lore.kernel.org/lkml/87tt0t4u19.fsf@yellow.woof
> 
> To: Steven Rostedt <rostedt@goodmis.org>
> To: Nam Cao <namcao@linutronix.de>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: John Kacur <jkacur@redhat.com>
> Cc: Waylon Cude <wcude@redhat.com>
> Cc: linux-trace-kernel@vger.kernel.org
> Cc: linux-kselftest@vger.kernel.org
> 
> Gabriele Monaco (2):
>   selftest/ftrace: Generalise ftracetest to use with RV
>   selftests/verification: Add initial RV tests
> 
>  MAINTAINERS                                   |  1 +
>  tools/testing/selftests/ftrace/ftracetest     | 34 ++++++---
>  .../ftrace/test.d/00basic/mount_options.tc    |  2 +-
>  .../testing/selftests/ftrace/test.d/functions |  6 +-
>  .../testing/selftests/verification/.gitignore |  2 +
>  tools/testing/selftests/verification/Makefile |  8 ++
>  tools/testing/selftests/verification/config   |  1 +
>  tools/testing/selftests/verification/settings |  1 +
>  .../selftests/verification/test.d/functions   | 39 ++++++++++
>  .../test.d/rv_monitor_enable_disable.tc       | 75 +++++++++++++++++++
>  .../verification/test.d/rv_monitor_reactor.tc | 68 +++++++++++++++++
>  .../test.d/rv_monitors_available.tc           | 18 +++++
>  .../verification/test.d/rv_wwnr_printk.tc     | 29 +++++++
>  .../verification/verificationtest-ktap        |  8 ++
>  14 files changed, 278 insertions(+), 14 deletions(-)
>  create mode 100644 tools/testing/selftests/verification/.gitignore
>  create mode 100644 tools/testing/selftests/verification/Makefile
>  create mode 100644 tools/testing/selftests/verification/config
>  create mode 100644 tools/testing/selftests/verification/settings
>  create mode 100644 tools/testing/selftests/verification/test.d/functions
>  create mode 100644
> tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc
>  create mode 100644
> tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc
>  create mode 100644
> tools/testing/selftests/verification/test.d/rv_monitors_available.tc
>  create mode 100644
> tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
>  create mode 100644 tools/testing/selftests/verification/verificationtest-ktap
> 
> 
> base-commit: cec1e6e5d1ab33403b809f79cd20d6aff124ccfe
Re: [PATCH 0/2] selftests/verification: Add initial RV tests
Posted by Nam Cao 3 months, 3 weeks ago
Gabriele Monaco <gmonaco@redhat.com> writes:
> Steve, Nam, would you have time to have a look at this series.
> If possible, I'd like to get this minimal selftest to next together with Nam's
> (urgent) patches.

Right, I completely forgot that this exists.

I am at the final steps in another project, should be able to look at
this tomorrow.

Nam