Skip to content

Add scheduler specification monitors

Gabriele Monaco linux-doc linux-trace-kernel lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest9 patches 2 repliesIn review
  2. v411 patches 4 repliesSuperseded
  3. v2 posting 2/211 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/211 patches7 repliesSuperseded
v111 patches3 repliesSuperseded

Changes in v5 from the cover letter

* fix state given to tracepoint in current_restore_rtlock_saved_state
* removed first 2 patches, added separately

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9sched: Add sched tracepoints for RV task modelinclude/linux/rv.h include/linux/sched.h include/trace/events/sched.h +2 more+53 -32 replies
2/9Add option for nested monitors and include schedinclude/linux/rv.h kernel/trace/rv/Kconfig kernel/trace/rv/Makefile +8 more+217 -290 replies
3/9Add sco and tss per-cpu monitorskernel/trace/rv/Kconfig kernel/trace/rv/Makefile kernel/trace/rv/monitors/sco/Kconfig +10 more+373 -00 replies
4/9Add snroc per-task monitorkernel/trace/rv/Kconfig kernel/trace/rv/Makefile kernel/trace/rv/monitors/snroc/Kconfig +5 more+182 -00 replies
5/9Add scpd, snep and sncid per-cpu monitorskernel/trace/rv/Kconfig kernel/trace/rv/Makefile kernel/trace/rv/monitors/scpd/Kconfig +15 more+588 -00 replies
6/9tools/rv: Add support for nested monitorstools/verification/rv/include/rv.h tools/verification/rv/src/in_kernel.c+179 -480 replies
7/9verification/dot2k: Add support for nested monitorstools/verification/dot2/dot2k tools/verification/dot2/dot2k.py tools/verification/dot2/dot2k_templates/Kconfig +3 more+125 -270 replies
8/9Documentation/rv: Add docs for the sched monitorsDocumentation/tools/rv/rv-mon-sched.rst Documentation/trace/rv/monitor_sched.rst+240 -00 replies
9/9tools/rv: Allow rv list to filter for containertools/verification/rv/include/in_kernel.h tools/verification/rv/src/in_kernel.c tools/verification/rv/src/rv.c+53 -230 replies

Reviews trailers per patch

1 of 9 patches has a Reviewed-by or Acked-by.

PatchPeter Zijlstra (Intel)
1/9A-b
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/9] rv: Add scheduler specification monitors

This patchset starts including adapted scheduler specifications from Daniel's task model [1].
As the model is fairly complicated, it is split in several generators and specifications. The tool used to create the model can output a unified model, but that would be hardly readable (9k states).

RV allows monitors to run and react concurrently. Running the cumulative model is equivalent to running single components using the same reactors, with the advantage that it's easier to point out which specification failed in case of error.

We allow this by introducing nested monitors, in short, the sysfs monitor folder will contain a monitor named sched, which is nothing but an empty container for other monitors. Controlling the sched monitor (enable, disable, set reactors) controls all nested monitors.

The task model proposed by Daniel includes 12 generators and 33 specifications. The generators are good for documentation but are usually implied in some specifications.
Not all monitors work out of the box, mainly because of those reasons:
* need to distinguish if preempt disable leads to schedule
* need to distinguish if irq disable comes from an actual irq
* assumptions not always true on SMP

The original task model was designed for PREEMPT_RT and this patchset is only tested on an upstream kernel with full preemption enabled.

In patch 3-5 are included only some specifications that work without further modifications. Ideally, we would adapt all specifications and add them gradually to the sched monitor.

The series is based on 1-2/11 from V4 and won't build without at least 1/11 applied, those two patches are included separately during review.

Patch 1 adds some additional tracepoints in the scheduler's code to complete the model, the tracepoints were already defined in Daniel's patches but, as far as I understand, were never submitted

Patch 2 adds the empty sched monitor container and the infrastructure for nested monitors

Patch 3 adds 2 per-cpu monitors using the tracepoints defined in 2

Patch 4 adds a per-task monitor using the tracepoints defined in 2

Patch 5 adds 3 more per-cpu monitors using the tracepoints defined in 2 and preemptirq tracepoints

Patch 6 adjusts the rv tool to support nested monitors

Patch 7 adjusts the dot2k tool to support nested monitors

Patch 8 adds some documentation for the sched monitors, including a description of the included specifications

Patch 9 adapts the rv tool to list also filtering by container

Changes since V4:
* fix state given to tracepoint in current_restore_rtlock_saved_state
* removed first 2 patches, added separately

Changes since V3:
* revert skip static_branch_unlikely
* remove argument curr_state from set_state tracepoint
* fix typo

Changes since V2:
* fix reported compilation warnings:
- missing __do_trace_ function if tracepoints are disabled
- remove unused DA_MON_EVENT in sched's Kconfig
* improve condition to detect empty monitor containers

Changes since V1:
* skip static_branch_unlikely in function exporting the tracepoint
* rename function and make clear it should not be called directly
* add missing parameter documentation in rv_register_monitor

Changes since RFC:
* use static_branch_unlikely to trace set_state via external function
* allow nested monitors to be disabled via Kconfig
- they are enabled by default if the container is enabled
* remove need_resched tracepoint as it needs a bit more work
- will come in a following patch together with a monitor using it

[1] - https://bristot.me/linux-task-model
[2] - https://lore.kernel.org/linux-trace-kernel/[email protected]

To: Steven Rostedt <[email protected]>
To: Ingo Molnar <[email protected]>
To: Peter Zijlstra <[email protected]>
To: Juri Lelli <[email protected]>
Cc: John Kacur <[email protected]>
Cc: Clark Williams <[email protected]>
Cc: Tomas Glozar <[email protected]>
Cc: [email protected]

Gabriele Monaco (9):
sched: Add sched tracepoints for RV task model
rv: Add option for nested monitors and include sched
rv: Add sco and tss per-cpu monitors
rv: Add snroc per-task monitor
rv: Add scpd, snep and sncid per-cpu monitors tools/rv: Add support for nested monitors verification/dot2k: Add support for nested monitors Documentation/rv: Add docs for the sched monitors tools/rv: Allow rv list to filter for container

 Documentation/tools/rv/rv-mon-sched.rst       |  69 +++++
 Documentation/trace/rv/monitor_sched.rst      | 171 ++++++++++++
 include/linux/rv.h                            |   4 +-
 include/linux/sched.h                         |  16 ++
 include/trace/events/sched.h                  |  13 +
 kernel/sched/core.c                           |  23 +-
 kernel/trace/rv/Kconfig                       |   7 +
 kernel/trace/rv/Makefile                      |   7 +
 kernel/trace/rv/monitors/sched/Kconfig        |  11 +
 kernel/trace/rv/monitors/sched/sched.c        |  38 +++
 kernel/trace/rv/monitors/sched/sched.h        |   3 +
 kernel/trace/rv/monitors/sco/Kconfig          |  14 +
 kernel/trace/rv/monitors/sco/sco.c            |  88 ++++++
 kernel/trace/rv/monitors/sco/sco.h            |  47 ++++
 kernel/trace/rv/monitors/sco/sco_trace.h      |  15 +
 kernel/trace/rv/monitors/scpd/Kconfig         |  15 +
 kernel/trace/rv/monitors/scpd/scpd.c          |  96 +++++++
 kernel/trace/rv/monitors/scpd/scpd.h          |  49 ++++
 kernel/trace/rv/monitors/scpd/scpd_trace.h    |  15 +
 kernel/trace/rv/monitors/sncid/Kconfig        |  15 +
 kernel/trace/rv/monitors/sncid/sncid.c        |  96 +++++++
 kernel/trace/rv/monitors/sncid/sncid.h        |  49 ++++
 kernel/trace/rv/monitors/sncid/sncid_trace.h  |  15 +
 kernel/trace/rv/monitors/snep/Kconfig         |  15 +
 kernel/trace/rv/monitors/snep/snep.c          |  96 +++++++
 kernel/trace/rv/monitors/snep/snep.h          |  49 ++++
 kernel/trace/rv/monitors/snep/snep_trace.h    |  15 +
 kernel/trace/rv/monitors/snroc/Kconfig        |  14 +
 kernel/trace/rv/monitors/snroc/snroc.c        |  85 ++++++
 kernel/trace/rv/monitors/snroc/snroc.h        |  47 ++++
 kernel/trace/rv/monitors/snroc/snroc_trace.h  |  15 +
 kernel/trace/rv/monitors/tss/Kconfig          |  14 +
 kernel/trace/rv/monitors/tss/tss.c            |  91 +++++++
 kernel/trace/rv/monitors/tss/tss.h            |  47 ++++
 kernel/trace/rv/monitors/tss/tss_trace.h      |  15 +
 kernel/trace/rv/monitors/wip/wip.c            |   2 +-
 kernel/trace/rv/monitors/wwnr/wwnr.c          |   2 +-
 kernel/trace/rv/rv.c                          | 154 +++++++++--
 kernel/trace/rv/rv.h                          |   4 +
 kernel/trace/rv/rv_reactors.c                 |  28 +-
 kernel/trace/rv/rv_trace.h                    |   6 +
 tools/verification/dot2/dot2k                 |  27 +-
 tools/verification/dot2/dot2k.py              |  79 ++++--
 .../verification/dot2/dot2k_templates/Kconfig |   1 +
 .../verification/dot2/dot2k_templates/main.c  |   4 +-
 .../dot2/dot2k_templates/main_container.c     |  38 +++
 .../dot2/dot2k_templates/main_container.h     |   3 +
 tools/verification/models/sched/sco.dot       |  18 ++
 tools/verification/models/sched/scpd.dot      |  18 ++
 tools/verification/models/sched/sncid.dot     |  18 ++
 tools/verification/models/sched/snep.dot      |  18 ++
 tools/verification/models/sched/snroc.dot     |  18 ++
 tools/verification/models/sched/tss.dot       |  18 ++
 tools/verification/rv/include/in_kernel.h     |   2 +-
 tools/verification/rv/include/rv.h            |   3 +-
 tools/verification/rv/src/in_kernel.c         | 256 ++++++++++++++----
 tools/verification/rv/src/rv.c                |  38 ++-
 57 files changed, 2007 insertions(+), 127 deletions(-)
 create mode 100644 Documentation/tools/rv/rv-mon-sched.rst
 create mode 100644 Documentation/trace/rv/monitor_sched.rst
 create mode 100644 kernel/trace/rv/monitors/sched/Kconfig
 create mode 100644 kernel/trace/rv/monitors/sched/sched.c
 create mode 100644 kernel/trace/rv/monitors/sched/sched.h
 create mode 100644 kernel/trace/rv/monitors/sco/Kconfig
 create mode 100644 kernel/trace/rv/monitors/sco/sco.c
 create mode 100644 kernel/trace/rv/monitors/sco/sco.h
 create mode 100644 kernel/trace/rv/monitors/sco/sco_trace.h
 create mode 100644 kernel/trace/rv/monitors/scpd/Kconfig
 create mode 100644 kernel/trace/rv/monitors/scpd/scpd.c
 create mode 100644 kernel/trace/rv/monitors/scpd/scpd.h
 create mode 100644 kernel/trace/rv/monitors/scpd/scpd_trace.h
 create mode 100644 kernel/trace/rv/monitors/sncid/Kconfig
 create mode 100644 kernel/trace/rv/monitors/sncid/sncid.c
 create mode 100644 kernel/trace/rv/monitors/sncid/sncid.h
 create mode 100644 kernel/trace/rv/monitors/sncid/sncid_trace.h
 create mode 100644 kernel/trace/rv/monitors/snep/Kconfig
 create mode 100644 kernel/trace/rv/monitors/snep/snep.c
 create mode 100644 kernel/trace/rv/monitors/snep/snep.h
 create mode 100644 kernel/trace/rv/monitors/snep/snep_trace.h
 create mode 100644 kernel/trace/rv/monitors/snroc/Kconfig
 create mode 100644 kernel/trace/rv/monitors/snroc/snroc.c
 create mode 100644 kernel/trace/rv/monitors/snroc/snroc.h
 create mode 100644 kernel/trace/rv/monitors/snroc/snroc_trace.h
 create mode 100644 kernel/trace/rv/monitors/tss/Kconfig
 create mode 100644 kernel/trace/rv/monitors/tss/tss.c
 create mode 100644 kernel/trace/rv/monitors/tss/tss.h
 create mode 100644 kernel/trace/rv/monitors/tss/tss_trace.h
 create mode 100644 tools/verification/dot2/dot2k_templates/main_container.c
 create mode 100644 tools/verification/dot2/dot2k_templates/main_container.h
 create mode 100644 tools/verification/models/sched/sco.dot
 create mode 100644 tools/verification/models/sched/scpd.dot
 create mode 100644 tools/verification/models/sched/sncid.dot
 create mode 100644 tools/verification/models/sched/snep.dot
 create mode 100644 tools/verification/models/sched/snroc.dot
 create mode 100644 tools/verification/models/sched/tss.dot

base-commit: 5860c6175c02e9f45af8cf5e6e32772232f5c2f3

Signature · 1 line
2.48.1