public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wen Yang <wen.yang@linux.dev>
To: Gabriele Monaco <gmonaco@redhat.com>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Nam Cao <namcao@linutronix.de>,
	Thomas Weissschuh <thomas.weissschuh@linutronix.de>,
	Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>
Subject: Re: [RFC PATCH 00/12] rv: Add selftests to tools and KUnit tests
Date: Tue, 28 Apr 2026 23:09:33 +0800	[thread overview]
Message-ID: <d0c1fe9d-8d51-4c4f-897b-45444de1286d@linux.dev> (raw)
In-Reply-To: <20260427151134.192971-1-gmonaco@redhat.com>



On 4/27/26 23:11, Gabriele Monaco wrote:
> This series adds support to the make check target in the rv userspace
> tool and the rvgen script, this allows to quickly validate its
> functionality. The selftest framework is inspired by the one used in
> RTLA.
> 
> A few bugs in both tools were also discovered and are fixed as part of
> this series.
> 
> Additionally it adds unit tests for models. This is achieved by running
> the handlers functions directly within KUnit, emulating all modules
> paths as if real kernel events fired.
> 
> Unit tests emulate a series of events that are expected to trigger
> violations and checks that a reaction occurred, stub structs and
> functions are used so the kernel is not affected by the test.
> 

Hi Gabriele,

Good direction overall. The approach of calling event handlers directly
inside KUnit is clean and avoids the complexity of setting up real
tracepoints. Patches 1-4 (bug fixes) look correct.

We are planning to build the KUnit and selftest coverage for the tlob
monitor on top of this infrastructure, so getting this merged would be
useful for us as well.

- One issue found in the KUnit patches:

   patch 10: nomiss test
   kernel/trace/rv/monitors/nomiss/nomiss.c:
     udelay(10 / 1000);

   The compiler folds it silently as udelay(0).
   Presumably intended as udelay(10)?

- minor: copyright year range
   rv_monitors_test.c: Copyright (C) 2025-2028
   kunit_stubs.h:      Copyright (C) 2026-2029

   Kernel copyright entries conventionally use only the year(s) the work
was actually created,eg:
https://lkml.indiana.edu/2510.0/01897.html


Reviewed-by: Wen Yang <wen.yang@linux.dev>

--
Best wishes,
Wen


> To: linux-trace-kernel@vger.kernel.org
> To: linux-kernel@vger.kernel.org
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Nam Cao <namcao@linutronix.de>
> Cc: Thomas Weissschuh <thomas.weissschuh@linutronix.de>
> Cc: Tomas Glozar <tglozar@redhat.com>
> Cc: John Kacur <jkacur@redhat.com>
> Cc: Wen Yang <wen.yang@linux.dev>
> 
> Gabriele Monaco (12):
>    tools/rv: Fix substring match bug in monitor name search
>    tools/rv: Fix substring match when listing container monitors
>    tools/rv: Fix exit status when monitor execution fails
>    tools/rv: Fix cleanup after failed trace setup
>    tools/rv: Add selftests
>    verification/rvgen: Fix options shared among commands
>    verification/rvgen: Add golden and spec folders for tests
>    verification/rvgen: Add selftests
>    rv: Add KUnit stub to rv_react() and rv_*_task_monitor_slot()
>    rv: Add KUnit tests for some DA/HA monitors
>    rv: Add KUnit stubs for current and smp_processor_id()
>    rv: Add KUnit tests for some LTL monitors
> 
>   include/rv/da_monitor.h                       |  32 +++
>   include/rv/kunit_stubs.h                      |  17 ++
>   include/rv/ltl_monitor.h                      |  32 +++
>   kernel/trace/rv/Kconfig                       |  14 +
>   kernel/trace/rv/Makefile                      |   3 +
>   kernel/trace/rv/monitors/nomiss/nomiss.c      |  30 +++
>   kernel/trace/rv/monitors/opid/opid.c          |  27 ++
>   .../trace/rv/monitors/pagefault/pagefault.c   |  26 +-
>   kernel/trace/rv/monitors/sco/sco.c            |  23 ++
>   kernel/trace/rv/monitors/sleep/sleep.c        |  64 ++++-
>   kernel/trace/rv/monitors/sssw/sssw.c          |  27 ++
>   kernel/trace/rv/monitors/sts/sts.c            |  35 +++
>   kernel/trace/rv/rv.c                          |   5 +
>   kernel/trace/rv/rv_monitors_test.c            |  99 +++++++
>   kernel/trace/rv/rv_monitors_test.h            |  90 +++++++
>   kernel/trace/rv/rv_reactors.c                 |   3 +
>   tools/verification/rv/Makefile                |   5 +-
>   tools/verification/rv/src/in_kernel.c         |  58 ++--
>   tools/verification/rv/src/rv.c                |   2 +-
>   tools/verification/rv/tests/rv_list.t         |  48 ++++
>   tools/verification/rv/tests/rv_mon.t          |  95 +++++++
>   tools/verification/rvgen/Makefile             |   4 +
>   tools/verification/rvgen/__main__.py          |  10 +-
>   .../rvgen/tests/golden/da_global/Kconfig      |   9 +
>   .../rvgen/tests/golden/da_global/da_global.c  |  95 +++++++
>   .../rvgen/tests/golden/da_global/da_global.h  |  47 ++++
>   .../tests/golden/da_global/da_global_trace.h  |  15 ++
>   .../tests/golden/da_perobj_parent/Kconfig     |  11 +
>   .../da_perobj_parent/da_perobj_parent.c       | 110 ++++++++
>   .../da_perobj_parent/da_perobj_parent.h       |  64 +++++
>   .../da_perobj_parent/da_perobj_parent_trace.h |  15 ++
>   .../tests/golden/da_pertask_desc/Kconfig      |   9 +
>   .../golden/da_pertask_desc/da_pertask_desc.c  | 105 ++++++++
>   .../golden/da_pertask_desc/da_pertask_desc.h  |  64 +++++
>   .../da_pertask_desc/da_pertask_desc_trace.h   |  15 ++
>   .../rvgen/tests/golden/ha_percpu/Kconfig      |   9 +
>   .../rvgen/tests/golden/ha_percpu/ha_percpu.c  | 244 +++++++++++++++++
>   .../rvgen/tests/golden/ha_percpu/ha_percpu.h  |  72 +++++
>   .../tests/golden/ha_percpu/ha_percpu_trace.h  |  19 ++
>   .../rvgen/tests/golden/ltl_pertask/Kconfig    |   9 +
>   .../tests/golden/ltl_pertask/ltl_pertask.c    | 107 ++++++++
>   .../tests/golden/ltl_pertask/ltl_pertask.h    | 108 ++++++++
>   .../golden/ltl_pertask/ltl_pertask_trace.h    |  14 +
>   .../rvgen/tests/golden/test_container/Kconfig |   5 +
>   .../golden/test_container/test_container.c    |  35 +++
>   .../golden/test_container/test_container.h    |   3 +
>   .../rvgen/tests/golden/test_da/Kconfig        |   9 +
>   .../rvgen/tests/golden/test_da/test_da.c      |  95 +++++++
>   .../rvgen/tests/golden/test_da/test_da.h      |  47 ++++
>   .../tests/golden/test_da/test_da_trace.h      |  15 ++
>   .../rvgen/tests/golden/test_ha/Kconfig        |   9 +
>   .../rvgen/tests/golden/test_ha/test_ha.c      | 247 ++++++++++++++++++
>   .../rvgen/tests/golden/test_ha/test_ha.h      |  72 +++++
>   .../tests/golden/test_ha/test_ha_trace.h      |  19 ++
>   .../rvgen/tests/golden/test_ltl/Kconfig       |  11 +
>   .../rvgen/tests/golden/test_ltl/test_ltl.c    | 108 ++++++++
>   .../rvgen/tests/golden/test_ltl/test_ltl.h    | 108 ++++++++
>   .../tests/golden/test_ltl/test_ltl_trace.h    |  14 +
>   .../rvgen/tests/rvgen_container.t             |  20 ++
>   .../verification/rvgen/tests/rvgen_monitor.t  |  87 ++++++
>   .../rvgen/tests/specs/test_da.dot             |  16 ++
>   .../rvgen/tests/specs/test_da2.dot            |  18 ++
>   .../rvgen/tests/specs/test_ha.dot             |  27 ++
>   .../rvgen/tests/specs/test_invalid.dot        |   8 +
>   .../rvgen/tests/specs/test_invalid.ltl        |   1 +
>   .../rvgen/tests/specs/test_invalid_ha.dot     |  16 ++
>   .../rvgen/tests/specs/test_ltl.ltl            |   1 +
>   tools/verification/tests/engine.sh            | 156 +++++++++++
>   68 files changed, 2993 insertions(+), 44 deletions(-)
>   create mode 100644 include/rv/kunit_stubs.h
>   create mode 100644 kernel/trace/rv/rv_monitors_test.c
>   create mode 100644 kernel/trace/rv/rv_monitors_test.h
>   create mode 100644 tools/verification/rv/tests/rv_list.t
>   create mode 100644 tools/verification/rv/tests/rv_mon.t
>   create mode 100644 tools/verification/rvgen/tests/golden/da_global/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/da_global/da_global.c
>   create mode 100644 tools/verification/rvgen/tests/golden/da_global/da_global.h
>   create mode 100644 tools/verification/rvgen/tests/golden/da_global/da_global_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/da_perobj_parent/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/da_perobj_parent/da_perobj_parent.c
>   create mode 100644 tools/verification/rvgen/tests/golden/da_perobj_parent/da_perobj_parent.h
>   create mode 100644 tools/verification/rvgen/tests/golden/da_perobj_parent/da_perobj_parent_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/da_pertask_desc/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/da_pertask_desc/da_pertask_desc.c
>   create mode 100644 tools/verification/rvgen/tests/golden/da_pertask_desc/da_pertask_desc.h
>   create mode 100644 tools/verification/rvgen/tests/golden/da_pertask_desc/da_pertask_desc_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/ha_percpu/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
>   create mode 100644 tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.h
>   create mode 100644 tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/ltl_pertask/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/ltl_pertask/ltl_pertask.c
>   create mode 100644 tools/verification/rvgen/tests/golden/ltl_pertask/ltl_pertask.h
>   create mode 100644 tools/verification/rvgen/tests/golden/ltl_pertask/ltl_pertask_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_container/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/test_container/test_container.c
>   create mode 100644 tools/verification/rvgen/tests/golden/test_container/test_container.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_da/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/test_da/test_da.c
>   create mode 100644 tools/verification/rvgen/tests/golden/test_da/test_da.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_da/test_da_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ha/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ha/test_ha.c
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ha/test_ha.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ha/test_ha_trace.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ltl/Kconfig
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ltl/test_ltl.c
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ltl/test_ltl.h
>   create mode 100644 tools/verification/rvgen/tests/golden/test_ltl/test_ltl_trace.h
>   create mode 100644 tools/verification/rvgen/tests/rvgen_container.t
>   create mode 100644 tools/verification/rvgen/tests/rvgen_monitor.t
>   create mode 100644 tools/verification/rvgen/tests/specs/test_da.dot
>   create mode 100644 tools/verification/rvgen/tests/specs/test_da2.dot
>   create mode 100644 tools/verification/rvgen/tests/specs/test_ha.dot
>   create mode 100644 tools/verification/rvgen/tests/specs/test_invalid.dot
>   create mode 100644 tools/verification/rvgen/tests/specs/test_invalid.ltl
>   create mode 100644 tools/verification/rvgen/tests/specs/test_invalid_ha.dot
>   create mode 100644 tools/verification/rvgen/tests/specs/test_ltl.ltl
>   create mode 100644 tools/verification/tests/engine.sh
> 
> 
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

  parent reply	other threads:[~2026-04-28 15:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 15:11 [RFC PATCH 00/12] rv: Add selftests to tools and KUnit tests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 01/12] tools/rv: Fix substring match bug in monitor name search Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 02/12] tools/rv: Fix substring match when listing container monitors Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 03/12] tools/rv: Fix exit status when monitor execution fails Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 04/12] tools/rv: Fix cleanup after failed trace setup Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 05/12] tools/rv: Add selftests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 06/12] verification/rvgen: Fix options shared among commands Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 07/12] verification/rvgen: Add golden and spec folders for tests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 08/12] verification/rvgen: Add selftests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 09/12] rv: Add KUnit stub to rv_react() and rv_*_task_monitor_slot() Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 10/12] rv: Add KUnit tests for some DA/HA monitors Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 11/12] rv: Add KUnit stubs for current and smp_processor_id() Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 12/12] rv: Add KUnit tests for some LTL monitors Gabriele Monaco
2026-04-28 15:09 ` Wen Yang [this message]
2026-04-28 15:27   ` [RFC PATCH 00/12] rv: Add selftests to tools and KUnit tests Gabriele Monaco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0c1fe9d-8d51-4c4f-897b-45444de1286d@linux.dev \
    --to=wen.yang@linux.dev \
    --cc=gmonaco@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=namcao@linutronix.de \
    --cc=rostedt@goodmis.org \
    --cc=tglozar@redhat.com \
    --cc=thomas.weissschuh@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox