[PATCH v5 3/3] selftests/tracing: Add hist poll() support test

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a testcase for poll() on hist file. This introduces a helper binary to the ftracetest, because there is no good way to reliably execute poll() on hist file. Signed-off-by: Masami Hiramatsu (Google) Reviewed-by: Shuah Khan --- Changes in v5: - Update

[PATCH v5 2/3] tracing/hist: Support POLLPRI event for poll on histogram

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since POLLIN will not be flashed until read the hist file, user needs to repeat read() and poll() on hist for monitoring the event continuously. But the read() is somewhat redundant only for monitoring events. This add POLLPRI poll event on hist, this event

[PATCH v5 1/3] tracing/hist: Add poll(POLLIN) support on hist file

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add poll syscall support on the `hist` file. The Waiter will be waken up when the histogram is updated with POLLIN. Currently, there is no way to wait for a specific event in userspace. So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`. But

[PATCH v5 0/3] tracing: Support poll on event hist file

2024-08-18 Thread Masami Hiramatsu (Google)
or update poll pri $EVENT/hist # Event arrived. echo "process free event is comming" tail $TRACEFS/trace The 'poll' command is in the selftest patch. You can take this series also from here; https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/eve

[PATCH v4 3/3] selftests/tracing: Add hist poll() support test

2024-08-15 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a testcase for poll() on hist file. This introduces a helper binary to the ftracetest, because there is no good way to reliably execute poll() on hist file. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v4: - Use getopt() in poll.c (command

[PATCH v4 2/3] tracing/hist: Support POLLPRI event for poll on histogram

2024-08-15 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since POLLIN will not be flashed until read the hist file, user needs to repeat read() and poll() on hist for monitoring the event continuously. But the read() is somewhat redundant only for monitoring events. This add POLLPRI poll event on hist, this event

[PATCH v4 1/3] tracing/hist: Add poll(POLLIN) support on hist file

2024-08-15 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add poll syscall support on the `hist` file. The Waiter will be waken up when the histogram is updated with POLLIN. Currently, there is no way to wait for a specific event in userspace. So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`. But

[PATCH v4 0/3] tracing: Support poll on event hist file

2024-08-15 Thread Masami Hiramatsu (Google)
/mhiramat/linux.git/log/?h=topic/event-hist-poll Thank you, --- Masami Hiramatsu (Google) (3): tracing/hist: Add poll(POLLIN) support on hist file tracing/hist: Support POLLPRI event for poll on histogram selftests/tracing: Add hist poll() support test include/linux/

[PATCH v3 3/3] selftests/tracing: Add hist poll() support test

2024-08-13 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a testcase for poll() on hist file. This introduces a helper binary to the ftracetest, because there is no good way to reliably execute poll() on hist file. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Update poll command to support both

[PATCH v3 2/3] tracing/hist: Support POLLPRI event for poll on histogram

2024-08-13 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since POLLIN will not be flashed until read the hist file, user needs to repeat read() and poll() on hist for monitoring the event continuously. But the read() is somewhat redundant only for monitoring events. This add POLLPRI poll event on hist, this event

[PATCH v3 1/3] tracing/hist: Add poll(POLLIN) support on hist file

2024-08-13 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add poll syscall support on the `hist` file. The Waiter will be waken up when the histogram is updated with POLLIN. Currently, there is no way to wait for a specific event in userspace. So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`. But

[PATCH v3 0/3] tracing: Support poll on event hist file

2024-08-13 Thread Masami Hiramatsu (Google)
rived. echo "process free event is comming" tail $TRACEFS/trace The 'poll' command is in the selftest patch. You can take this series also from here; https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/event-hist-poll Thank you, --- Masam

[PATCH v2 3/3] selftests/tracing: Add hist poll() support test

2024-07-02 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a testcase for poll() on hist file. This introduces a helper binary to the ftracetest, because there is no good way to reliably execute poll() on hist file. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Update poll command to support both

[PATCH v2 2/3] tracing/hist: Support POLLPRI event for poll on histogram

2024-07-02 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since POLLIN will not be flashed until read the hist file, user needs to repeat read() and poll() on hist for monitoring the event continuously. But the read() is somewhat redundant only for monitoring events. This add POLLPRI poll event on hist, this event

[PATCH v2 1/3] tracing/hist: Add poll(POLLIN) support on hist file

2024-07-02 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add poll syscall support on the `hist` file. The Waiter will be waken up when the histogram is updated with POLLIN. Currently, there is no way to wait for a specific event in userspace. So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`. But

[PATCH v2 0/3] tracing: Support poll on event hist file

2024-07-02 Thread Masami Hiramatsu (Google)
$EVENT/hist # Event arrived. echo "process free event is comming" tail $TRACEFS/trace The 'poll' command is in the selftest patch. You can take this series also from here; https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/event-hist-poll Thank y

[RFC PATCH 3/3] selftests/tracing: Add hist poll() support test

2024-06-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a testcase for poll() on hist file. This introduces a helper binary to the ftracetest, because there is no good way to reliably execute poll() on hist file. Signed-off-by: Masami Hiramatsu (Google) --- tools/testing/selftests/ftrace/Makefile

[RFC PATCH 2/3] tracing/hist: Support POLLPRI event for poll on histogram

2024-06-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since POLLIN will not be flashed until read the hist file, user needs to repeat read() and poll() on hist for monitoring the event continuously. But the read() is somewhat redundant only for monitoring events. This add POLLPRI poll event on hist, this event

[RFC PATCH 1/3] tracing/hist: Add poll(POLLIN) support on hist file

2024-06-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add poll syscall support on the `hist` file. The Waiter will be waken up when the histogram is updated with POLLIN. Currently, there is no way to wait for a specific event in userspace. So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`. But

[RFC PATCH 0/3] tracing: Support poll on event hist file

2024-06-25 Thread Masami Hiramatsu (Google)
/kernel/git/mhiramat/linux.git/log/?h=topic/event-hist-poll Thank you, --- Masami Hiramatsu (Google) (3): tracing/hist: Add poll(POLLIN) support on hist file tracing/hist: Support POLLPRI event for poll on histogram selftests/tracing: Add hist poll() support test include/linux

[PATCH] selftests/ftrace: Add required dependency for kprobe tests

2024-06-12 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) kprobe_args_{char,string}.tc are using available_filter_functions file which is provided by function tracer. Thus if function tracer is disabled, these tests are failed on recent kernels because tracefs_create_dir is not raised events by adding a dynamic event

[PATCH 2/2] selftests/tracing: Fix to check the required syscall event

2024-05-31 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since test_duplicates.tc depends on syscalls/sys_enter_openat event, it must add the event file to `requires`. Without this fix, the test fails if CONFIG_FTRACE_SYSCALLS=n. Fixes: 297e1dcdca3d ("selftests/ftrace: Add selftest for testing duplicate eprobe

[PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times

2024-05-31 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Commit eb50d0f250e9 ("selftests/ftrace: Choose target function for filter test from samples") choose the target function from samples, but sometimes this test failes randomly because the target function does not hit at the next time. So retry getting sam

[PATCH 0/2] selftests/tracing: Fix ftracetest testcase issues

2024-05-31 Thread Masami Hiramatsu (Google)
Here is a couple of patches to fix issues related to runing environment and kernel configuration. Thank you, --- Masami Hiramatsu (Google) (2): selftests/tracing: Fix event filter test to retry up to 10 times selftests/tracing: Fix to check the required syscall event .../ftrace

[PATCH] selftests/uprobes: Add a basic uprobe testcase

2024-05-23 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a basic uprobe testcase which checks whether add/remove/trace operations works on /bin/sh. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/add_remove_uprobe.tc| 26 1 file changed, 26 insertions(+) create

[PATCH 2/2] selftests/ftrace: Update required config

2024-05-20 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Update required config options for running all tests. This also sorts the config entries alphabetically. Signed-off-by: Masami Hiramatsu (Google) --- tools/testing/selftests/ftrace/config | 26 +++--- 1 file changed, 19 insertions(+), 7

[PATCH 1/2] selftests/ftrace: Fix to check required event file

2024-05-20 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) The dynevent/test_duplicates.tc test case uses `syscalls/sys_enter_openat` event for defining eprobe on it. Since this `syscalls` events depend on CONFIG_FTRACE_SYSCALLS=y, if it is not set, the test will fail. Add the event file to `required` line so that the

[PATCH 0/2] selftests/ftrace: Fix config related issues

2024-05-20 Thread Masami Hiramatsu (Google)
Here is a couple of patches to fix some issues related to kconfig. I found these issues when I built the kernel with tools/testing/selftests/ftrace/config. Thank you, --- Masami Hiramatsu (Google) (2): selftests/ftrace: Fix to check required event file selftests/ftrace: Update

[PATCH for-next] selftests/ftrace: Fix required features for VFS type test case

2024-05-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the VFS type argument test case uses fprobe events, it must check the availablity of dynamic_events file and fprobe events syntax in README. Without this fix, the test fails if CONFIG_FPROBE_EVENTS=n. Fixes: ee97e5e135c6 ("selftests/ftrace: add fprobe

[PATCH 2/2] selftests/ftrace: Fix checkbashisms errors

2024-05-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix the below checkbashisms errors. Because of these errors, these tests will fail on dash shell. possible bashism in test.d/kprobe/kretprobe_entry_arg.tc line 14 ('function' is useless): function streq() { possible bashism in test.d/dynevent/fprobe_en

[PATCH 1/2] selftests/ftrace: Fix BTFARG testcase to check fprobe is enabled correctly

2024-05-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the dynevent/add_remove_btfarg.tc test case forgets to ensure that fprobe is enabled for some structure field access tests which uses the fprobe, it fails if CONFIG_FPROBE=n or CONFIG_FPROBE_EVENTS=n. Fixes it to ensure the fprobe events are supported

[PATCH 0/2] selftests/ftrace: Fix some errors

2024-05-03 Thread Masami Hiramatsu (Google)
Here is a couple of patches for fixing errors on ftracetest. Shuah, can you pick these to your fixes branch? Or I also can push it. Thank you, --- Masami Hiramatsu (Google) (2): selftests/ftrace: Fix BTFARG testcase to check fprobe is enabled correctly selftests/ftrace: Fix

[PATCH v3 8/8] Documentation: tracing: Add entry argument access at function exit

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a notes about the entry argument access at function exit probes for kprobes and fprobe trace event. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add usage example in fprobetrace.rst. --- Documentation/trace/fprobetrace.rst | 31

[PATCH v3 7/8] selftests/ftrace: Add test cases for entry args at function exit

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add kretprobe and function exit probe test cases for checking whether those can access entry arguments at function exit correctly. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/fprobe_entry_arg.tc | 18

[PATCH v3 6/8] tracing/probes: Support $argN in return probe (kprobe and fprobe)

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support accessing $argN in the return probe events. This will help users to record entry data in function return (exit) event for simplfing the function entry/exit information in one event, and record the result values (e.g. allocated object/initialized object) at

[PATCH v3 5/8] tracing: Remove redundant #else block for BTF args from README

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Remove redundant #else block for BTF args from README message. This is a cleanup, so no change on the message. Signed-off-by: Masami Hiramatsu (Google) Reviewed-by: Steven Rostedt (Google) --- kernel/trace/trace.c |4 +--- 1 file changed, 1 insertion(+), 3

[PATCH v3 4/8] tracing/probes: cleanup: Set trace_probe::nr_args at trace_probe_init

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Instead of incrementing the trace_probe::nr_args, init it at trace_probe_init(). Without this change, there is no way to get the number of trace_probe arguments while parsing it. This is a cleanup, so the behavior is not changed. Signed-off-by: Masami Hiramatsu

[PATCH v3 3/8] tracing/probes: Cleanup probe argument parser

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Cleanup traceprobe_parse_probe_arg_body() to split out the type parser and post-processing part of fetch_insn. This makes no functional change. Signed-off-by: Masami Hiramatsu (Google) Reviewed-by: Steven Rostedt (Google) --- kernel/trace/trace_probe.c | 230

[PATCH v3 2/8] tracing/fprobe-event: cleanup: Fix a wrong comment in fprobe event

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Despite the fprobe event, "Kretprobe" was commented. So fix it. Signed-off-by: Masami Hiramatsu (Google) Reviewed-by: Steven Rostedt (Google) --- kernel/trace/trace_fprobe.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ke

[PATCH v3 1/8] fprobe: Fix to allocate entry_data_size buffer with rethook instances

2024-03-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix to allocate fprobe::entry_data_size buffer with rethook instances. If fprobe doesn't allocate entry_data_size buffer for each rethook instance, fprobe entry handler can cause a buffer overrun when storing entry data in entry handler. Link:

[PATCH v3 0/8] tracing/probes: Support function parameter access from return probe

2024-03-03 Thread Masami Hiramatsu (Google)
4/0x3d0 <- vfs_open) mode=0xa800d inode=0x888004ada8d8 So as you can see those fields are initialized at exit. This series is based on v6.8-rc5 kernel or you can checkout from https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/entry-data Thank you, ---

[PATCH v2 7/7] Documentation: tracing: Add entry argument access at function exit

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a notes about the entry argument access at function exit probes for kprobes and fprobe trace event. Signed-off-by: Masami Hiramatsu (Google) --- Documentation/trace/fprobetrace.rst |7 +++ Documentation/trace/kprobetrace.rst |7 +++ 2 files

[PATCH v2 6/7] selftests/ftrace: Add test cases for entry args at function exit

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add kretprobe and function exit probe test cases for checking whether those can access entry arguments at function exit correctly. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/fprobe_entry_arg.tc | 18

[PATCH v2 5/7] tracing/probes: Support $argN in return probe (kprobe and fprobe)

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support accessing $argN in the return probe events. This will help users to record entry data in function return (exit) event for simplfing the function entry/exit information in one event, and record the result values (e.g. allocated object/initialized object) at

[PATCH v2 4/7] tracing: Remove redundant #else block for BTF args from README

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Remove redundant #else block for BTF args from README message. This is a cleanup, so no change on the message. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel

[PATCH v2 3/7] tracing/probes: cleanup: Set trace_probe::nr_args at trace_probe_init

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Instead of incrementing the trace_probe::nr_args, init it at trace_probe_init(). This is a cleanup, so the behavior is not changed. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_eprobe.c |2 +- kernel/trace/trace_probe.c | 10

[PATCH v2 2/7] tracing/probes: Cleanup probe argument parser

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Cleanup traceprobe_parse_probe_arg_body() to split out the type parser and post-processing part of fetch_insn. This makes no functional change. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_probe.c | 230

[PATCH v2 1/7] tracing/fprobe-event: cleanup: Fix a wrong comment in fprobe event

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Despite the fprobe event, "Kretprobe" was commented. So fix it. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_fprobe.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_fprobe.c b/ke

[PATCH v2 0/7] tracing/probes: Support function parameter access from return probe

2024-02-25 Thread Masami Hiramatsu (Google)
. 1945.728263: vfs_open__exit: (do_open+0x274/0x3d0 <- vfs_open) mode=0xa800d inode=0x888004ada8d8 So as you can see those fields are initialized at exit. This series is based on v6.8-rc5 kernel or you can checkout from https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/lo

[PATCH] selftests/ftrace: Add test case for a symbol in a module without module name

2023-10-27 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a test case for probing on a symbol in a module without module name. When probing on a symbol in a module, ftrace accepts both the syntax that : and . Current test case only checks the former syntax. This adds a test for the latter one. Signed-off-by: Masami

[FIX PATCH v2] selftests: tracing: Fix to unmount tracefs for recovering environment

2023-09-11 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix to unmount the tracefs if the ftracetest mounted it for recovering system environment. If the tracefs is already mounted, this does nothing. Suggested-by: Mark Brown Link: https://lore.kernel.org/all/29fce076-746c-4650-8358-b4e0fa215...@sirena.org.uk/ Fixes