Skip to content

ARCv2/v3: Implemented ftrace #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: abrodkin-arc64-5.15.y
Choose a base branch
from

Conversation

BrunoASMauricio
Copy link

Implementation of ftrace with function graphing for ARCv2.

It has the exact same functionality as with ARCv3 (more information in this PR #146) except ARCv2 ABI requires special GCC support (provided here foss-for-synopsys-dwc-arc-processors/gcc@c52b7ec)

@BrunoASMauricio BrunoASMauricio self-assigned this Oct 23, 2023
@BrunoASMauricio BrunoASMauricio changed the title Bruno ftrace arcv2 ARCv2: Implemented ftrace Oct 23, 2023
@pavelvkozlov
Copy link

I've checked this patch with a set of ftrace tests from the kselftes package.

First of all, failed to build modules with enabled FTRACE.

ERROR: modpost: "_mcount" [net/ife/ife.ko] undefined!
ERROR: modpost: "_mcount" [net/psample/psample.ko] undefined!
ERROR: modpost: "_mcount" [net/can/can-gw.ko] undefined!
ERROR: modpost: "_mcount" [net/can/can-bcm.ko] undefined!
ERROR: modpost: "_mcount" [net/can/can-raw.ko] undefined!
ERROR: modpost: "_mcount" [net/can/can.ko] undefined!
ERROR: modpost: "_mcount" [net/mptcp/mptcp_diag.ko] undefined!
ERROR: modpost: "_mcount" [net/mpls/mpls_iptunnel.ko] undefined!
ERROR: modpost: "_mcount" [net/mpls/mpls_router.ko] undefined!
ERROR: modpost: "_mcount" [net/mpls/mpls_gso.ko] undefined!
WARNING: modpost: suppressed 85 unresolved symbol warnings because there were too many)

Please, add EXPORT_SYMBOL(_mcount) after _mcount function definition.

The following results on ARCHS QEMU:

# selftests: ftrace: ftracetest
# === Ftrace unit tests ===
# [1] Basic trace file check    [PASS]
# [2] Basic test for tracers    [PASS]
# [3] Basic trace clock test    [PASS]
# [4] Basic event tracing check [PASS]
# [5] Change the ringbuffer size        [PASS]
# [6] Snapshot and tracing setting      [PASS]
# [7] trace_pipe and trace_marker       [PASS]
# [8] Test ftrace direct functions against tracers      [UNRESOLVED]
# [9] Test ftrace direct functions against kprobes      [UNSUPPORTED]
# [10] Generic dynamic event - add/remove eprobe events [UNSUPPORTED]
# [11] Generic dynamic event - add/remove kprobe events [UNSUPPORTED]
# [12] Generic dynamic event - add/remove synthetic events      [UNSUPPORTED]
# [13] Generic dynamic event - selective clear (compatibility)  [UNSUPPORTED]
# [14] Generic dynamic event - generic clear event      [UNSUPPORTED]
# [15] Generic dynamic event - check if duplicate events are caught     [UNSUPPORTED]
# [16] event tracing - enable/disable with event level files    [PASS]
# [17] event tracing - restricts events based on pid notrace filtering  [PASS]
# [18] event tracing - restricts events based on pid    [PASS]
# [19] event tracing - enable/disable with subsystem level files        [PASS]
# [20] event tracing - enable/disable with top level files      [PASS]
 
**********************************************************
**   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
**                                                      **
** trace_printk() being used. Allocating extra memory.  **
**                                                      **
** This means that this is a DEBUG kernel and it is     **
** unsafe for production use.                           **
**                                                      **
** If you see this message and you are not debugging    **
** the kernel, report this immediately to your vendor!  **
**                                                      **
**   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
**********************************************************
# [21] Test trace_printk from module    [PASS]
# [22] ftrace - function graph filters with stack tracer        [UNSUPPORTED]
# [23] ftrace - function graph filters  [UNSUPPORTED]
# [24] ftrace - function glob filters   [UNSUPPORTED]
# [25] ftrace - function pid notrace filters    [UNSUPPORTED]
# [26] ftrace - function pid filters    [UNSUPPORTED]
# [27] ftrace - stacktrace filter command       [UNSUPPORTED]
# [28] ftrace - function trace with cpumask     [UNRESOLVED]
# [29] ftrace - test for function event triggers        [UNSUPPORTED]
# [30] ftrace - function trace on module        [UNSUPPORTED]
# [31] ftrace - function profiling      [PASS]
# [32] ftrace - function profiler with function tracing [UNSUPPORTED]
# [33] ftrace - test reading of set_ftrace_filter       [UNSUPPORTED]
# [34] ftrace - Max stack tracer        [UNSUPPORTED]
# [35] ftrace - test for function traceon/off triggers  [UNSUPPORTED]
# [36] ftrace - test tracing error log support  [FAIL]
# [37] Test creation and deletion of trace instances while setting an event     [PASS]
# [38] Test creation and deletion of trace instances    [PASS]
# [39] Kprobe dynamic event - adding and removing       [UNSUPPORTED]
# [40] Kprobe dynamic event - busy event check  [UNSUPPORTED]
# [41] Kprobe dynamic event with arguments      [UNSUPPORTED]
# [42] Kprobe event with comm arguments [UNSUPPORTED]
# [43] Kprobe event string type argument        [UNSUPPORTED]
# [44] Kprobe event symbol argument     [UNSUPPORTED]
# [45] Kprobe event argument syntax     [UNSUPPORTED]
# [46] Kprobes event arguments with types       [UNSUPPORTED]
# [47] Kprobe event user-memory access  [UNSUPPORTED]
# [48] Kprobe event auto/manual naming  [UNSUPPORTED]
# [49] Kprobe dynamic event with function tracer        [UNSUPPORTED]
# [50] Kprobe dynamic event - probing module    [UNSUPPORTED]
# [51] Create/delete multiprobe on kprobe event [UNSUPPORTED]
# [52] Kprobe event parser error log check      [UNSUPPORTED]
# [53] Kretprobe dynamic event with arguments   [UNSUPPORTED]
# [54] Kretprobe dynamic event with maxactive   [UNSUPPORTED]
# [55] Kretprobe %return suffix test    [UNSUPPORTED]
# [56] Register/unregister many kprobe events   [UNSUPPORTED]
# [57] Kprobe events - probe points     [UNSUPPORTED]
# [58] Kprobe dynamic event - adding and removing       [UNSUPPORTED]
# [59] Uprobe event parser error log check      [UNSUPPORTED]
random: crng init done
 
# [60] test for the preemptirqsoff tracer       [PASS]
# [61] Meta-selftest: Checkbashisms     [UNRESOLVED]
# [62] Test wakeup tracer       [PASS]
# [63] Test wakeup RT tracer    [PASS]
# [64] event trigger - test inter-event histogram trigger expected fail actions [UNSUPPORTED]
# [65] event trigger - test field variable support      [UNSUPPORTED]
# [66] event trigger - test inter-event combined histogram trigger      [UNSUPPORTED]
# [67] event trigger - test multiple actions on hist trigger    [UNSUPPORTED]
# [68] event trigger - test inter-event histogram trigger onchange action       [UNSUPPORTED]
# [69] event trigger - test inter-event histogram trigger onmatch action        [UNSUPPORTED]
# [70] event trigger - test inter-event histogram trigger onmatch-onmax action  [UNSUPPORTED]
# [71] event trigger - test inter-event histogram trigger onmax action  [UNSUPPORTED]
# [72] event trigger - test inter-event histogram trigger snapshot action       [UNSUPPORTED]
# [73] event trigger - test inter-event histogram trigger eprobe on synthetic event     [UNSUPPORTED]
# [74] event trigger - test synthetic event create remove       [UNSUPPORTED]
# [75] event trigger - test inter-event histogram trigger trace action with dynamic string param        [UNSUPPORTED]
# [76] event trigger - test synthetic_events syntax parser      [UNSUPPORTED]
# [77] event trigger - test synthetic_events syntax parser errors       [UNSUPPORTED]
# [78] event trigger - test inter-event histogram trigger trace action  [UNSUPPORTED]
# [79] event trigger - test event enable/disable trigger        [PASS]
# [80] event trigger - test trigger filter      [PASS]
# [81] event trigger - test histogram expression parsing        [UNSUPPORTED]
# [82] event trigger - test histogram modifiers [UNSUPPORTED]
# [83] event trigger - test histogram parser errors     [UNSUPPORTED]
# [84] event trigger - test histogram trigger   [UNSUPPORTED]
# [85] event trigger - test multiple histogram triggers [UNSUPPORTED]
# [86] event trigger - test snapshot-trigger    [PASS]
# [87] event trigger - test stacktrace-trigger  [PASS]
# [88] trace_marker trigger - test histogram trigger    [UNSUPPORTED]
# [89] trace_marker trigger - test snapshot trigger     [PASS]
# [90] trace_marker trigger - test histogram with synthetic event against kernel event  [UNSUPPORTED]
# [91] trace_marker trigger - test histogram with synthetic event       [UNSUPPORTED]
# [92] event trigger - test traceon/off trigger [PASS]
# [93] (instance)  Basic test for tracers       [PASS]
# [94] (instance)  Basic trace clock test       [PASS]
# [95] (instance)  Change the ringbuffer size   [PASS]
# [96] (instance)  Snapshot and tracing setting [PASS]
# [97] (instance)  trace_pipe and trace_marker  [PASS]
# [98] (instance)  event tracing - enable/disable with event level files        [PASS]
# [99] (instance)  event tracing - restricts events based on pid notrace filtering      [PASS]
# [100] (instance)  event tracing - restricts events based on pid       [PASS]
# [101] (instance)  event tracing - enable/disable with subsystem level files   [PASS]
# [102] (instance)  ftrace - function pid notrace filters       [UNSUPPORTED]
# [103] (instance)  ftrace - function pid filters       [UNSUPPORTED]
# [104] (instance)  ftrace - stacktrace filter command  [UNSUPPORTED]
# [105] (instance)  ftrace - test for function event triggers   [UNSUPPORTED]
# [106] (instance)  ftrace - test for function traceon/off triggers     [UNSUPPORTED]
# [107] (instance)  event trigger - test event enable/disable trigger   [PASS]
# [108] (instance)  event trigger - test trigger filter [PASS]
# [109] (instance)  event trigger - test histogram modifiers    [UNSUPPORTED]
# [110] (instance)  event trigger - test histogram trigger      [UNSUPPORTED]
# [111] (instance)  event trigger - test multiple histogram triggers    [UNSUPPORTED]
# [112] (instance)  trace_marker trigger - test histogram trigger       [UNSUPPORTED]
# [113] (instance)  trace_marker trigger - test snapshot trigger        [PASS]
# grep: dynamic_events: No such file or directory
#
# # of passed:  37
# # of failed:  1
# # of unresolved:  3
# # of untested:  0
# # of unsupported:  72
# # of xfailed:  0
# # of undefined(test bug):  0
not ok 1 selftests: ftrace: ftracetest # exit=1

Too many unsupported results. Some of skips are because of absence of DYNAMIC_FTRACE support and dynamic events.
Do you plan to add DYNAMIC_FTRACE optimization for ARC ftrace?

@BrunoASMauricio
Copy link
Author

Hello @pavelvkozlov !
I have added the missing export, thank you for the tip!
There is no plan to implement DYNAMIC_FTRACE.

Added support for both FTRACE and FUNCTION_GRAPH_TRACER (GCC > 14) in ARCv2

Signed-off-by: Bruno Mauricio <[email protected]>
@BrunoASMauricio BrunoASMauricio changed the title ARCv2: Implemented ftrace ARCv2/v3: Implemented ftrace Nov 24, 2023
@pavelvkozlov pavelvkozlov self-requested a review November 24, 2023 12:33
Copy link

@pavelvkozlov pavelvkozlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me.
I think it is ready for merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants