While creating a new monitor in RV, besides generating code from dot2k, there are a few manual steps which can be tedious and error prone, like adding the tracepoints, makefile lines and kconfig, or selecting events that start the monitor in the initial state.
This patchset tries to automate as much as possible among those steps to make creating a new RV monitor much quicker. It is still required to select proper tracepoints, this step is harder to automate in a general way and, in several cases, would still need user intervention. The first 3 patches are preparatory work around the templates. Patch 1 fixes the template directory used if dot2k is not installed but is run from the kernel tree (tools/verification/). Patch 2 unifies the templates for the 3 monitor types to change them easier. Patch 3 makes the format used for variables replaced by the dot2k script a bit more robust. Patch 4 implements the already present -n and -D flags to set the monitor name and description, respectively. Patch 5 moves most of the monitor-specific code to the monitor directory (tracepoints, Kconfig). The user still needs to manually fill some content but the copy-paste-change is reduced. Patch 6 adapts dot2k to produce monitors as defined in patch 5, adding the necessary templates. Additionally, while printing the checklist, dot2k also suggests what lines to add and where. Patch 7 adds the possibility to further automate what is done in patch 5 and 6. If dot2k finds a valid kernel source and the -a flag is passed, it automatically changes the files accordingly (RV Makefile, tracepoints and Kconfig) and moves the new monitor folder in the final position. Patch 8 allows to automatically select events that start the monitor, to achieve this, the automata parser can now understand if there are events that always lead to the initial state or are only valid in the initial state. dot2k uses da_handle_start_event with the former and, as a fallback, da_handle_start_run_event for the latter. Gabriele Monaco (8): verification/dot2k: Fix template directory detection verification/dot2k: Unify main.c templates verification/dot2k: More robust template variables verification/dot2k: Add support for name and description options rv: Simplify manual steps in monitor creation verification/dot2k: Simplify manual steps in monitor creation verification/dot2k: Auto patch current kernel source verification/dot2k: Implement event type detection kernel/trace/rv/Kconfig | 27 +-- kernel/trace/rv/Makefile | 3 + kernel/trace/rv/monitors/wip/Kconfig | 12 + kernel/trace/rv/monitors/wip/wip.c | 2 +- kernel/trace/rv/monitors/wip/wip_trace.h | 15 ++ kernel/trace/rv/monitors/wwnr/Kconfig | 11 + kernel/trace/rv/monitors/wwnr/wwnr.c | 2 +- kernel/trace/rv/monitors/wwnr/wwnr_trace.h | 16 ++ kernel/trace/rv/rv.c | 2 +- .../events/rv.h => kernel/trace/rv/rv_trace.h | 26 +- tools/verification/dot2/automata.py | 36 ++- tools/verification/dot2/dot2c.py | 4 +- tools/verification/dot2/dot2k | 17 +- tools/verification/dot2/dot2k.py | 226 +++++++++++++++--- .../verification/dot2/dot2k_templates/Kconfig | 6 + .../verification/dot2/dot2k_templates/main.c | 91 +++++++ .../dot2/dot2k_templates/main_global.c | 91 ------- .../dot2/dot2k_templates/main_per_cpu.c | 91 ------- .../dot2/dot2k_templates/main_per_task.c | 91 ------- .../verification/dot2/dot2k_templates/trace.h | 13 + 20 files changed, 419 insertions(+), 363 deletions(-) create mode 100644 kernel/trace/rv/monitors/wip/Kconfig create mode 100644 kernel/trace/rv/monitors/wip/wip_trace.h create mode 100644 kernel/trace/rv/monitors/wwnr/Kconfig create mode 100644 kernel/trace/rv/monitors/wwnr/wwnr_trace.h rename include/trace/events/rv.h => kernel/trace/rv/rv_trace.h (79%) create mode 100644 tools/verification/dot2/dot2k_templates/Kconfig create mode 100644 tools/verification/dot2/dot2k_templates/main.c delete mode 100644 tools/verification/dot2/dot2k_templates/main_global.c delete mode 100644 tools/verification/dot2/dot2k_templates/main_per_cpu.c delete mode 100644 tools/verification/dot2/dot2k_templates/main_per_task.c create mode 100644 tools/verification/dot2/dot2k_templates/trace.h base-commit: aef25be35d23ec768eed08bfcf7ca3cf9685bc28 -- 2.47.1
