[RFC PATCH 25/32] fprobe: Use ftrace_regs in fprobe entry handler

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) This allows fprobes to be available with CONFIG_DYNAMIC_FTRACE_WITH_ARGS instead of CONFIG_DYNAMIC_FTRACE_WITH_REGS, then we can enable fprobe on arm64. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Florent Revest --- Changes from previous series: NOTHING

[RFC PATCH 24/32] x86/ftrace: Enable HAVE_FUNCTION_GRAPH_FREGS

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support HAVE_FUNCTION_GRAPH_FREGS on x86-64, which saves ftrace_regs on the stack in ftrace_graph return trampoline so that the callbacks can access registers via ftrace_regs APIs. Note that this only recovers 'rax' and 'rdx' registers because other registers

[RFC PATCH 23/32] function_graph: Add a new exit handler with parent_ip and ftrace_regs

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a new return handler to fgraph_ops as 'retregfunc' which takes parent_ip and ftrace_regs instead of ftrace_graph_ret. This handler is available only if the arch support CONFIG_HAVE_FUNCTION_GRAPH_FREGS. Note that the 'retfunc' and 'reregfunc' are mutual

[RFC PATCH 22/32] function_graph: Add a new entry handler with parent_ip and ftrace_regs

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a new entry handler to fgraph_ops as 'entryregfunc' which takes parent_ip and ftrace_regs. Note that the 'entryfunc' and 'entryregfunc' are mutual exclusive. You can set only one of them. Signed-off-by: Masami Hiramatsu (Google) --- arch/arm64/kernel

[RFC PATCH 21/32] function_graph: Expand the max reserved data size

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Expand the maximum reserved data size to 32 from 4. On 64bit system, this will allow reserving 256 bytes on the ret_stack in maximum but that may not happen. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c |4 ++-- 1 file changed, 2

[RFC PATCH 20/32] function_graph: Pass the size of reserved data when retrieving it

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Make the fgraph_retrieve_data() returns the reverved data size via size_byte parameter. Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h|2 +- kernel/trace/fgraph.c |5 - kernel/trace/trace_selftest.c | 10

[RFC PATCH 19/32] function_graph: Fix to check the return value of ftrace_pop_return_trace()

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix to check the return value ('ret_stack') of ftrace_pop_return_trace() instead of passed storage ('ret') because ret_stack becomes NULL in error case. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c |2 +- 1 file changed, 1 insertion

[RFC PATCH 18/32] function_graph: Fix to initalize ftrace_ops for fgraph with ftrace_graph_func

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix to initialize the ftrace_ops of fgraph_ops with ftrace_graph_func instead of ftrace_stub. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/fgraph.c b

[RFC PATCH 17/32] function_graph: Fix to update curr_ret_stack with ARRAY entry size

2023-11-05 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) __ftrace_return_to_handler() missed to update the curr_ret_stack when it gets a FGRAPH_TYPE_ARRAY. Since that type entry will follows some data words, it must update curr_ret_stack by entry size value (__get_index(val)) instead of 1. Signed-off-by: Masami

[RFC PATCH 16/32] function_graph: Add selftest for passing local variables

2023-11-05 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Add boot up selftest that passes variables from a function entry to a function exit, and make sure that they do get passed around. Signed-off-by: Steven Rostedt (VMware) --- kernel/trace/trace_selftest.c | 161 + 1 file

[RFC PATCH 15/32] function_graph: Implement fgraph_reserve_data() and fgraph_retrieve_data()

2023-11-05 Thread Masami Hiramatsu (Google)
shadow ret_stack and this then can be retrived by fgraph_retrieve_data() called by the corresponding retfunc(). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h |3 + kernel/trace/fgraph.c | 244

[RFC PATCH 14/32] function_graph: Move graph notrace bit to shadow stack global var

2023-11-05 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h |7 --- kernel/trace/trace.h |9 + kernel/trace/trace_functions_graph.c | 10 ++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/li

[RFC PATCH 13/32] function_graph: Move graph depth stored data to shadow stack global var

2023-11-05 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h | 29 - kernel/trace/trace.h| 34 -- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/linux/trace_recursion.h b/incl

[RFC PATCH 12/32] function_graph: Move set_graph_function tests to shadow stack global var

2023-11-05 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h |5 + kernel/trace/trace.h | 32 +--- kernel/trace/trace_functions_graph.c |6 +++--- kernel/trace/trace_irqsoff.c |4 ++-- kernel/tr

[RFC PATCH 11/32] function_graph: Add "task variables" per task for fgraph_ops

2023-11-05 Thread Masami Hiramatsu (Google)
s on a per task basis having a way to maintain state for each task. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h |2 + kernel/trace/fgraph.c | 73 +++- 2 files changed, 74 insert

[RFC PATCH 10/32] function_graph: Have the instances use their own ftrace_ops for filtering

2023-11-05 Thread Masami Hiramatsu (Google)
(Google) --- include/linux/ftrace.h |1 + kernel/trace/fgraph.c| 60 +- kernel/trace/ftrace.c|6 ++- kernel/trace/trace.h | 16 + kernel/trace/trace_functions.c |2 + kernel/trace

[RFC PATCH 09/32] ftrace: Allow ftrace startup flags exist without dynamic ftrace

2023-11-05 Thread Masami Hiramatsu (Google)
to compile because dynamic ftrace is disabled. This change is needed to move some of the logic of what is passed to ftrace_startup() out of the parameters of ftrace_startup(). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h | 18

[RFC PATCH 08/32] ftrace: Allow function_graph tracer to be enabled in instances

2023-11-05 Thread Masami Hiramatsu (Google)
-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h |1 + kernel/trace/ftrace.c|1 + kernel/trace/trace.h | 12 ++ kernel/trace/trace_functions.c |8 kernel/trace

[RFC PATCH 07/32] ftrace/function_graph: Pass fgraph_ops to function graph callbacks

2023-11-05 Thread Masami Hiramatsu (Google)
to the function graph tracer. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h | 10 +++--- kernel/trace/fgraph.c| 17 ++--- kernel/trace/ftrace.c|6 -- kernel

[RFC PATCH 06/32] function_graph: Remove logic around ftrace_graph_entry and return

2023-11-05 Thread Masami Hiramatsu (Google)
into the function_graph tracer. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c | 72 +++- kernel/trace/ftrace.c |2 - kernel/trace/ftrace_internal.h |2 - 3 files changed, 20 insertions(+), 56

[RFC PATCH 05/32] function_graph: Allow multiple users to attach to function graph

2023-11-05 Thread Masami Hiramatsu (Google)
are called is not completely handled yet, but that shouldn't be too hard to manage. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c | 332 + 1 file changed, 280 insertions(+), 52 deletions

[RFC PATCH 04/32] function_graph: Add an array structure that will allow multiple callbacks

2023-11-05 Thread Masami Hiramatsu (Google)
on the shadow stack. We need to only save the index, because this will allow the fgraph_ops to be freed before the function returns (which may happen if the function call schedule for a long time). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c

[RFC PATCH 02/32] function_graph: Convert ret_stack to a series of longs

2023-11-05 Thread Masami Hiramatsu (Google)
for the return side of the functions. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/sched.h |2 - kernel/trace/fgraph.c | 124 - 2 files changed, 71 insertions(+), 55 deletions(-) diff --git

[RFC PATCH 03/32] fgraph: Use BUILD_BUG_ON() to make sure we have structures divisible by long

2023-11-05 Thread Masami Hiramatsu (Google)
dt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 30edeb6d4aa9..837daf929d2a 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trac

[RFC PATCH 01/32] seq_buf: Export seq_buf_puts()

2023-11-05 Thread Masami Hiramatsu (Google)
-by: Steven Rostedt (Google) Signed-off-by: Masami Hiramatsu (Google) --- lib/seq_buf.c |1 + 1 file changed, 1 insertion(+) diff --git a/lib/seq_buf.c b/lib/seq_buf.c index 45c450f423fa..46a1b00c3815 100644 --- a/lib/seq_buf.c +++ b/lib/seq_buf.c @@ -189,6 +189,7 @@ int seq_buf_puts(struct

[RFC PATCH 00/32] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph

2023-11-05 Thread Masami Hiramatsu (Google)
below branch. https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/fprobe-on-fgraph Thank you, --- Christophe JAILLET (1): seq_buf: Export seq_buf_puts() Masami Hiramatsu (Google) (16): function_graph: Fix to update curr_ret_stack with ARRAY entry size

[PATCH] tracing: fprobe-event: Fix to check tracepoint event and return

2023-11-03 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix to check the tracepoint event is not valid with $retval. The commit 08c9306fc2e3 ("tracing/fprobe-event: Assume fprobe is a return event by $retval") introduced automatic return probe conversion with $retval. But since tracepoint event does not supp

Re: [PATCH for-next] tracing/kprobes: Add symbol counting check when module loads

2023-11-02 Thread Google
; > and all modules. If mod is sepecified, search the symbol on the specific > > module'. > > > > Thus, "if func_name is only part of the module named mod", the > > module_kallsyms_on_each_symbol() will count the 'func_name' in 'mod' module > > correctly. > > Sorry, I looked to quickly and forgot about the return value of strcmp()... No problem, strcmp() always traps us :) > > From the code, everything seems OK! > If I have some time, I will test it and potentially come back with a "Tested- > by" tag but without any warranty. Thank you! > > > Thank you, > > > > > > Thank you, > > Best regards. > > -- Masami Hiramatsu (Google)

Re: [PATCH v6 8/8] eventfs: Use simple_recursive_removal() to clean up dentries

2023-11-02 Thread Google
On Wed, 01 Nov 2023 13:25:49 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Looking at how dentry is removed via the tracefs system, I found that > eventfs does not do everything that it did under tracefs. The tracefs > removal of a dentry calls

Re: [PATCH] tracing: Have trace_event_file have ref counters

2023-11-01 Thread Google
On Tue, 31 Oct 2023 12:24:53 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The following can crash the kernel: > > # cd /sys/kernel/tracing > # echo 'p:sched schedule' > kprobe_events > # exec 5>>events/kprobes/sched

Re: [PATCH v6 7/8] eventfs: Remove special processing of dput() of events directory

2023-11-01 Thread Google
On Wed, 01 Nov 2023 13:25:48 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The top level events directory is no longer special with regards to how it > should be delete. Remove the extra processing for it in > eventfs_set_ei_status_free(). >

Re: [PATCH v6 5/8] eventfs: Hold eventfs_mutex when calling callback functions

2023-11-01 Thread Google
On Wed, 01 Nov 2023 13:25:46 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The callback function that is used to create inodes and dentries is not > protected by anything and the data that is passed to it could become > stale. After event

Re: [PATCH v5 4/7] eventfs: Save ownership and mode

2023-11-01 Thread Google
On Tue, 31 Oct 2023 18:33:30 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Now that inodes and dentries are created on the fly, they are also > reclaimed on memory pressure. Since the ownership and file mode are saved > in the inode, if th

Re: [PATCH v5 2/7] eventfs: Have a free_ei() that just frees the eventfs_inode

2023-11-01 Thread Google
On Tue, 31 Oct 2023 18:33:28 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > As the eventfs_inode is freed in two different locations, make a helper > function free_ei() to make sure all the allocated fields of the > eventfs_inode is freed. &g

Re: [PATCH v5 1/7] eventfs: Remove "is_freed" union with rcu head

2023-11-01 Thread Google
On Tue, 31 Oct 2023 18:33:27 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The eventfs_inode->is_freed was a union with the rcu_head with the > assumption that when it was on the srcu list the head would contain a > pointer whic

Re: [PATCH for-next] tracing/kprobes: Add symbol counting check when module loads

2023-10-31 Thread Google
continue; ... So with above change, 'if mod is not specified, search the symbols in kernel and all modules. If mod is sepecified, search the symbol on the specific module'. Thus, "if func_name is only part of the module named mod", the module_kallsyms_on_each_symbol() will count the 'func_name' in 'mod' module correctly. Thank you, Thank you, -- Masami Hiramatsu (Google)

Re: [PATCH v2] eventfs: Test for ei->is_freed when accessing ei->dentry

2023-10-28 Thread Google
On Sat, 28 Oct 2023 16:46:50 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The eventfs_inode (ei) is protected by SRCU, but the ei->dentry is not. It > is protected by the eventfs_mutex. Anytime the eventfs_mutex is released, > and access to the

[PATCH for-next] tracing/kprobes: Add symbol counting check when module loads

2023-10-28 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Check the number of probe target symbols in the target module when the module is loaded. If the probe is not on the unique name symbols in the module, it will be rejected at that point. Note that the symbol which has a unique name in the target module

Re: [PATCH 3/3] locking/atomic: openrisc: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local

2023-10-28 Thread Google
blems if you end up doing operations on both > > the entire word and a sub-unit of the same thing. > > Thank you for pointing out this. I'll do some research on these > implementations. arc also has the LL-SC instruction but depends on the core feature, so I think we can use it. Thank you, > > > Arnd > > Regards, > wuqiang > -- Masami Hiramatsu (Google)

Re: [PATCH] tracing/kprobes: Fix symbol counting logic by looking at modules as well

2023-10-27 Thread Google
On Sat, 28 Oct 2023 10:41:44 +0900 Masami Hiramatsu (Google) wrote: > Hi, > > On Fri, 27 Oct 2023 16:31:26 -0700 > Andrii Nakryiko wrote: > > > Recent changes to count number of matching symbols when creating > > a kprobe event failed to take

Re: [PATCH] tracing/kprobes: Fix symbol counting logic by looking at modules as well

2023-10-27 Thread Google
t; > - count = 0; > - kallsyms_on_each_match_symbol(count_symbols, func_name, ); > + module_kallsyms_on_each_symbol(NULL, count_mod_symbols, ); > > - return count; > + return ctx.count; > } > > static int __trace_kprobe_create(int argc, const char *argv[]) > -- > 2.34.1 > -- Masami Hiramatsu (Google)

Re: [PATCH] tracing/kprobes: Fix symbol counting logic by looking at modules as well

2023-10-27 Thread Google
org > > Cc: Masami Hiramatsu > > Cc: Steven Rostedt > > Fixes: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func > > matches several symbols") > > Signed-off-by: Andrii Nakryiko > > Acked-by: Song Liu Good catch! Thanks! -- Masami Hiramatsu (Google)

Re: [PATCH] tracing/kprobes: Fix the description of variable length arguments

2023-10-27 Thread Google
* @cmd: A pointer to the dynevent_cmd struct representing the new event > > - * @args: Variable number of arg (pairs), one pair for each field > > + * @...: Variable number of arg (pairs), one pair for each field > >* > >* NOTE: Users normally won't want to call this function directly, but > >* rather use the kprobe_event_add_fields() wrapper, which -- Masami Hiramatsu (Google)

Re: [PATCH] eventfs: Fix WARN_ON() in create_file_dentry()

2023-10-26 Thread Google
On Tue, 24 Oct 2023 12:36:28 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > As the comment right above a WARN_ON() in create_file_dentry() states: > > * Note, with the mutex held, the e_dentry cannot have content > * and the ei->is

Re: [PATCH v6] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms

2023-10-25 Thread Google
966e1740 T device_show_int > 966e1770 T device_show_bool > c04e10a0 t device_show [mmc_core] > c04e10a0 t device_show@drivers_mmc_core_sdio_bus_c_45 [mmc_core] > > Signed-off-by: Alessandro Carminati (Red Hat) > Thanks for update. I tested that.

Re: [External] [PATCH] locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

2023-10-25 Thread Google
On Wed, 25 Oct 2023 19:26:37 +0800 "wuqiang.matt" wrote: > On 2023/10/24 22:52, Masami Hiramatsu (Google) wrote: > > From: Masami Hiramatsu (Google) > > > > Use generic_cmpxchg_local() for arch_cmpxchg_local() implementation > > in SH archi

[PATCH v2] locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

2023-10-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Use __generic_cmpxchg_local() for arch_cmpxchg_local() implementation in SH architecture because it does not implement arch_cmpxchg_local(). Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.ir5uukog-...@intel.com/ Signed

Re: [PATCH] locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

2023-10-25 Thread Google
matsu wrote: > > > > On Tue, 24 Oct 2023 16:08:12 +0100 > > > > Mark Rutland wrote: > > > > > On Tue, Oct 24, 2023 at 11:52:54PM +0900, Masami Hiramatsu (Google) > > > > > wrote: > > > > > > From: Masami Hiramatsu (G

Re: [PATCH] locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

2023-10-24 Thread Google
On Tue, 24 Oct 2023 16:08:12 +0100 Mark Rutland wrote: > On Tue, Oct 24, 2023 at 11:52:54PM +0900, Masami Hiramatsu (Google) wrote: > > From: Masami Hiramatsu (Google) > > > > Use generic_cmpxchg_local() for arch_cmpxchg_local() implementation > > in SH a

[PATCH] locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

2023-10-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Use generic_cmpxchg_local() for arch_cmpxchg_local() implementation in SH architecture because it does not implement arch_cmpxchg_local(). Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.ir5uukog-...@intel.com/ Signed

Re: [PATCH v1] lib,kprobes: using try_cmpxchg_local in objpool_push

2023-10-24 Thread Google
On Tue, 24 Oct 2023 09:57:17 +0800 "wuqiang.matt" wrote: > On 2023/10/24 09:01, Masami Hiramatsu (Google) wrote: > > On Mon, 23 Oct 2023 11:43:04 -0400 > > Steven Rostedt wrote: > > > >> On Mon, 23 Oct 2023 19:24:52 +0800 > >> "wuqiang.mat

Re: [PATCH v1] lib,kprobes: using try_cmpxchg_local in objpool_push

2023-10-23 Thread Google
uot; as a parameter to objpool_try_add_slot() and adding: > > int cpu = raw_smp_processor_id(); > > Which now shows that this function *only* deals with the current CPU. Oh indeed. It used to search all CPUs to push the object, but I asked him to stop that because there should be enough space to push it in the local ring. This is a remnant of that time. Wuqiang, can you make another patch to fix it? Thank you, > > -- Steve -- Masami Hiramatsu (Google)

Re: [PATCH v1] lib,kprobes: using try_cmpxchg_local in objpool_push

2023-10-23 Thread Google
32T48T64T96T 128T > lock: 957553042 1435814086 1680872925 2043126796 2165424198 > local: 968526317 1454991286 1861053557 2059530343 2171732306 > Yeah, slot->tail is only used on the local CPU. This looks good to me. Acked-by: Masa

Re: [PATCH v1] kprobes: unused header files removed

2023-10-23 Thread Google
ll of them > should be removed. > > Reported-by: kernel test robot > Closes: > https://lore.kernel.org/oe-kbuild-all/202310191512.vvypku5z-...@intel.com/ Looks good to me. Acked-by: Masami Hiramatsu (Google) Thanks, > > Signed-off-by: wuqiang.matt > --- > kerne

Re: [PATCH v6 0/2] Return EADDRNOTAVAIL when func matches several symbols during kprobe creation

2023-10-20 Thread Google
when func matches several > symbols > selftests/ftrace: Add new test case which checks non unique symbol > > kernel/trace/trace_kprobe.c | 63 +++ > kernel/trace/trace_probe.h| 1 + > .../test.d/kprobe/kprobe_non_uniq_symbol.tc | 13 > 3 files changed, 77 insertions(+) > create mode 100644 > tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc > > Best regards and thank you in advance. > --- > [1]: > https://lore.kernel.org/lkml/20230816163517.112518-1-flan...@linux.microsoft.com/ > [2]: > https://lore.kernel.org/lkml/20230819101105.b0c104ae4494a7d1f2eea...@kernel.org/ > -- > 2.34.1 > -- Masami Hiramatsu (Google)

Re: [PATCH v5 0/2] Return EADDRNOTAVAIL when func matches several symbols during kprobe creation

2023-10-19 Thread Google
On Thu, 19 Oct 2023 09:51:04 -0400 Steven Rostedt wrote: > On Thu, 19 Oct 2023 21:18:43 +0900 > Masami Hiramatsu (Google) wrote: > > > > So why is this adding stable? (and as Greg's form letter states, that's > > > not > > > how you do that) > > &g

Re: [PATCH v5 0/2] Return EADDRNOTAVAIL when func matches several symbols during kprobe creation

2023-10-19 Thread Google
address may NOT be the instruction boundary. To avoid this issue, it should check the given symbol is unique. Thank you, > > -- Steve -- Masami Hiramatsu (Google)

Re: [PATCH v10 4/5] kprobes: freelist.h removed

2023-10-18 Thread Google
Hi, On Mon, 16 Oct 2023 22:23:14 +0900 Masami Hiramatsu (Google) wrote: > Hi Peter, > > This freelist has been introduced by you, is it OK to remove this because no > other user exists? I'll pick this on my probes/for-next branch. If there is any issue reported, I'll revert it

Re: [PATCH v11 0/5] lib,kprobes: kretprobe scalability improvement

2023-10-18 Thread Google
alability improvement with objpool > kprobes: freelist.h removed > MAINTAINERS: objpool added OK, this version looks good to me. Acked-by: Masami Hiramatsu (Google) I'll pick this series on for-next branch. Thank you, > > MAINTAINERS | 7 + > include/linu

Re: [PATCH v3 1/1] tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols

2023-10-18 Thread Google
Hi Francis, On Thu, 31 Aug 2023 09:14:55 +0200 Francis Laniel wrote: > Hi. > > Le mercredi 30 août 2023, 01:57:19 CEST Steven Rostedt a écrit : > > On Fri, 25 Aug 2023 22:13:21 +0900 > > > > Masami Hiramatsu (Google) wrote: > > > > Excellent catch! Than

Re: [PATCH v10 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-16 Thread Google
r_id(); > + for (i = 0; i < num_possible_cpus(); i++) { > + obj = objpool_try_get_slot(pool, cpu); > + if (obj) > + break; > + cpu = cpumask_next_wrap(cpu, cpu_possible_mask, -1, 1); > + } > + raw_l

[PATCH] fprobe: Fix to ensure the number of active retprobes is not zero

2023-10-16 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) The number of active retprobes can be zero but it is not acceptable, so return EINVAL error if detected. Reported-by: wuqiang.matt Closes: https://lore.kernel.org/all/20231016222103.cb9f426edc60220eabd8a...@kernel.org/ Fixes: 5b0ab78998e3 ("fprobe

Re: [PATCH v10 4/5] kprobes: freelist.h removed

2023-10-16 Thread Google
*/ > - atomic_fetch_add(-2, >refs); > - > - return head; > - } > - > - /* > - * OK, the head must have changed on us, but we still need to > decrement > - * the refcount we increased. > - */ > - refs = atomic_fetch_add(-1, >refs); > - if (refs == REFS_ON_FREELIST + 1) > - __freelist_add(prev, list); > - } > - > - return NULL; > -} > - > -#endif /* FREELIST_H */ > -- > 2.40.1 > -- Masami Hiramatsu (Google)

Re: [PATCH v10 3/5] kprobes: kretprobe scalability improvement with objpool

2023-10-16 Thread Google
, GFP_KERNEL, > + rp->rph, kretprobe_init_inst, kretprobe_fini_pool)) { > + kfree(rp->rph); > + rp->rph = NULL; > + return -ENOMEM; > } > - refcount_set(>rph->ref, i); > - > + rp->rph->rp = rp; > rp->nmissed = 0; > /* Establish function entry probe point */ > ret = register_kprobe(>kp); > diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c > index 3b21f4063258..f5bf98e6b2ac 100644 > --- a/kernel/trace/fprobe.c > +++ b/kernel/trace/fprobe.c > @@ -187,9 +187,9 @@ static void fprobe_init(struct fprobe *fp) > > static int fprobe_init_rethook(struct fprobe *fp, int num) > { > - int i, size; > + int size; > > - if (num < 0) > + if (num <= 0) > return -EINVAL; Oops, this must be a bugfix. Let me fix it. > > if (!fp->exit_handler) { > @@ -202,29 +202,21 @@ static int fprobe_init_rethook(struct fprobe *fp, int > num) > size = fp->nr_maxactive; > else > size = num * num_possible_cpus() * 2; > - if (size < 0) > + if (size <= 0) > return -E2BIG; Here too. Except for this point, it looks good to me. Thanks! -- Masami Hiramatsu (Google)

Re: [PATCH v10 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-16 Thread Google
Hi Wuqiang, On Mon, 16 Oct 2023 10:45:30 +0800 "wuqiang.matt" wrote: > On 2023/10/16 07:26, Masami Hiramatsu (Google) wrote: > > On Mon, 16 Oct 2023 00:06:11 +0800 > > "wuqiang.matt" wrote: > > > >> On 2023/10/15 23:43, Masami Hiramatsu (Googl

Re: [PATCH v10 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-15 Thread Google
On Mon, 16 Oct 2023 00:06:11 +0800 "wuqiang.matt" wrote: > On 2023/10/15 23:43, Masami Hiramatsu (Google) wrote: > > On Sun, 15 Oct 2023 13:32:47 +0800 > > "wuqiang.matt" wrote: > > > >> objpool is a scalable implementation of high performanc

Re: [PATCH] riscv: ftrace: Fix to pass correct ftrace_regs to ftrace_func_t functions

2023-10-15 Thread Google
Hi, Sorry please ignore this. I found that the arch/riscv doesn't support HAVE_DYNAMIC_FTRACE_WITH_ARGS. Thus this might add a new feature support. Let me update it. Thank you, On Sun, 15 Oct 2023 23:15:23 +0900 Masami Hiramatsu (Google) wrote: > Hi, > > Gentry ping. > > I th

Re: [PATCH v10 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-15 Thread Google
during pool > + * initialization in objpool_init() > + */ > + if (refcount_dec_and_test(>ref)) > + objpool_free(pool); Nit: you can call objpool_drop() instead of repeating the same thing here. Thank you, > + } while (obj); > +} > +EXPORT_SYMBOL_GPL(objpool_fini); > -- > 2.40.1 > -- Masami Hiramatsu (Google)

Re: [PATCH] riscv: ftrace: Fix to pass correct ftrace_regs to ftrace_func_t functions

2023-10-15 Thread Google
Hi, Gentry ping. I think this should be an important fix because if a fprobe handler without FTRACE_OPS_FL_SAVE_REGS tries to access any register via ftrace_regs, that will get a wrong value. Thank you, On Mon, 2 Oct 2023 21:50:34 +0900 "Masami Hiramatsu (Google)" wrote: >

Re: [PATCH v9 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-12 Thread Google
On Fri, 13 Oct 2023 01:36:05 +0800 "wuqiang.matt" wrote: > On 2023/10/12 22:02, Masami Hiramatsu (Google) wrote: > > Hi Wuqiang, > > > > On Mon, 9 Oct 2023 17:23:34 +0800 > > wuqiang wrote: > > > >> Hello Masami, > >> > >>

Re: [PATCH v9 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-12 Thread Google
try_cmpxchg_acquire(>tail, , next) >WRITE_ONCE(slot->entries[tail & slot->mask], obj) > return slot->entries[head & slot->mask] > > > Regards, > wuqiang > > On 2023/9/25 17:42, Masami Hiramatsu (Google) wrote: > &

[PATCH] bpf/btf: Move tracing BTF APIs to the BTF library

2023-10-10 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Move the BTF APIs used in tracing to the BTF library code for sharing it with others. Previously, to avoid complex dependency in a series I made it on the tracing tree, but now it is a good time to move it to BPF tree because these functions are pure BTF functions

Re: [PATCH v1] samples: kprobes: Fixes a typo

2023-10-09 Thread Google
> > > > > Hi all, can someone provide comments on this change. > > > > Hi all, can someone please review this change. It has > > been not > > reviewed for quite some time. > > That's because trivial typos in comments are considered very low priority, > and are usually only added (if they are ever added) if the maintainer has > extra time, which may not be for a while. Anyway, let me pick this. I found this in my inbox now. :) Thank you, > > -- Steve -- Masami Hiramatsu (Google)

Re: [PATCH v9 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-09 Thread Google
Hi, On Mon, 9 Oct 2023 02:40:53 +0800 wuqiang wrote: > On 2023/9/23 17:48, Masami Hiramatsu (Google) wrote: > > Hi Wuqiang, > > > > Sorry for replying later. > > > > On Tue, 5 Sep 2023 09:52:51 +0800 > > "wuqiang.matt" wrote: > > &

Re: [PATCH v9 1/5] lib: objpool added: ring-array based lockless MPMC

2023-10-09 Thread Google
_ONCE(slot->entries[tail & slot->mask], obj) > return slot->entries[head & slot->mask] > > > Regards, > wuqiang > > On 2023/9/25 17:42, Masami Hiramatsu (Google) wrote: > > Hi Wuqiang, > > > > On Tue, 5 S

Re: [PATCH v9 3/5] kprobes: kretprobe scalability improvement with objpool

2023-10-08 Thread Google
On Mon, 9 Oct 2023 02:31:34 +0800 wuqiang wrote: > On 2023/10/7 10:02, Masami Hiramatsu (Google) wrote: > > On Tue, 5 Sep 2023 09:52:53 +0800 > > "wuqiang.matt" wrote: > > > >> kretprobe is using freelist to manage return-instances, but freelist, > &

Re: [PATCH v9 0/5] lib,kprobes: kretprobe scalability improvement

2023-10-08 Thread Google
On Mon, 9 Oct 2023 02:33:09 +0800 wuqiang wrote: > On 2023/9/23 16:57, Masami Hiramatsu (Google) wrote: > > Hi Wuqiang, > > > > I dug my mail box and found this. Sorry for replying late. > > > > On Tue, 5 Sep 2023 09:52:50 +0800 > > "wuqia

Re: [PATCH v4] eventfs: Remove eventfs_file and just use eventfs_inode

2023-10-07 Thread Google
On Tue, 3 Oct 2023 18:40:59 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Instead of having a descriptor for every file represented in the eventfs > directory, only have the directory itself represented. Change the API to > send in a list of e

Re: [PATCH v9 3/5] kprobes: kretprobe scalability improvement with objpool

2023-10-06 Thread Google
gt; objpool: 334605663 448310646 675018951 903449904 1339693418 > This looks good to me (and I have tested with updated objpool) Acked-by: Masami Hiramatsu (Google) Wuqiang, can you update the above number with the simplified objpool? I got better number (always 80% of the native

Re: [PATCH -fixes] riscv: Fix ftrace syscall handling which are now prefixed with __riscv_

2023-10-03 Thread Google
fix this by implementing arch_syscall_match_sym_name() which allows us > to ignore this prefix. > > And also ignore compat syscalls like x86/arm64 by implementing > arch_trace_is_compat_syscall(). > Looks good to me, Acked-by: Masami Hiramatsu (Google) Thank you, > Fixes: 08d0ce30e0e4 (&q

Re: [PATCH v5 00/12] tracing: fprobe: rethook: Use ftrace_regs instead of pt_regs

2023-10-02 Thread Google
On Sat, 30 Sep 2023 18:14:35 +0900 Masami Hiramatsu (Google) wrote: > On Fri, 29 Sep 2023 17:12:07 -0700 > Alexei Starovoitov wrote: > > > On Thu, Sep 28, 2023 at 6:21 PM Masami Hiramatsu > > wrote: > > > > > > > > > Thus, what I need is to m

[PATCH] riscv: ftrace: Fix to pass correct ftrace_regs to ftrace_func_t functions

2023-10-02 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since ftrace_func_t requires to pass 'struct ftrace_regs *' as the 4th argument even if FTRACE_OPS_FL_SAVE_REGS is not set, ftrace_caller must pass 'struct ftrace_regs *', which is a partial pt_regs, on the stack to the ftrace_func_t functions, so

Re: [PATCH] eventfs: Test for dentries array allocated in eventfs_release()

2023-09-30 Thread Google
On Sat, 30 Sep 2023 09:01:06 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The dcache_dir_open_wrapper() could be called when a dynamic event is > being deleted leaving a dentry with no children. In this case the > dlist->dentries array will ne

Re: [PATCH] tracing/eprobe: drop unneeded breaks

2023-09-30 Thread Google
Good catch! This looks good to me. > > > > Acked-by: Masami Hiramatsu (Google) > > > > And > > > > Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events") > > Thanks. I didn't include that because it's not a bug. But it does

Re: [PATCH v5 00/12] tracing: fprobe: rethook: Use ftrace_regs instead of pt_regs

2023-09-30 Thread Google
*) https://lore.kernel.org/all/20230905015255.81545-1-wuqiang.m...@bytedance.com/ Thank you, -- Masami Hiramatsu (Google)

Re: [PATCH] tracing/eprobe: drop unneeded breaks

2023-09-29 Thread Google
On Thu, 28 Sep 2023 12:43:34 +0200 Julia Lawall wrote: > Drop break after return. > Good catch! This looks good to me. Acked-by: Masami Hiramatsu (Google) And Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events") > Signed-off-by: Julia Lawall >

Re: [PATCH v5] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms

2023-09-29 Thread Google
d: {str(e)}") > +raise SystemExit("Script terminated due to an error") > diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh > index a432b171be82..c110b0f58a19 100755 > --- a/scripts/link-vmlinux.sh > +++ b/scripts/link-vmlinux.sh > @@ -91,7 +91,12 @@ vmlinux_link() > > # The kallsyms linking does not need debug symbols included. > if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then > - ldflags="${ldflags} ${wl}--strip-debug" > + # The kallsyms linking does not need debug symbols included, > + # unless the KALLSYMS_ALIAS_SRCLINE. > + if ! is_enabled CONFIG_KALLSYMS_ALIAS_SRCLINE && \ > +[ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then > + ldflags="${ldflags} ${wl}--strip-debug" > + fi > fi > > if is_enabled CONFIG_VMLINUX_MAP; then > @@ -161,7 +166,19 @@ kallsyms() > fi > > info KSYMS ${2} > - scripts/kallsyms ${kallsymopt} ${1} > ${2} > + ALIAS="" > + KAS_DATA="" > + if is_enabled CONFIG_KALLSYMS_ALIAS_SRCLINE_DATA; then > + KAS_DATA="--data" > + fi > + if is_enabled CONFIG_KALLSYMS_ALIAS_SRCLINE; then > + ALIAS=".alias" > + ${srctree}/scripts/kas_alias.py \ > + --addr2line ${ADDR2LINE} --vmlinux ${kallsyms_vmlinux} \ > + --nmdata ${1} --outfile ${1}${ALIAS} \ > + --basedir ${srctree} --separator @ ${KAS_DATA} > + fi > + scripts/kallsyms ${kallsymopt} ${1}${ALIAS} > ${2} > } > > # Perform one step in kallsyms generation, including temporary linking of > -- > 2.34.1 > -- Masami Hiramatsu (Google)

Re: [PATCH v5 00/12] tracing: fprobe: rethook: Use ftrace_regs instead of pt_regs

2023-09-28 Thread Google
erf pt_regs. > - Update fprobe-events to use ftrace_regs natively. > - Update bpf multi-kprobe handler use ftrace_partial_regs(). And need to add patches - Introduce a generized function exit hook interface for ftrace. - Replace rethook in fprobe with the function exit hook interface.

Re: [PATCH v5 04/12] fprobe: Use ftrace_regs in fprobe entry handler

2023-09-25 Thread Google
On Tue, 26 Sep 2023 00:14:33 +0200 Jiri Olsa wrote: > On Mon, Sep 25, 2023 at 09:15:15PM +0900, Masami Hiramatsu wrote: > > Hi Jiri, > > > > On Mon, 25 Sep 2023 12:41:59 +0200 > > Jiri Olsa wrote: > > > > > On Sun, Sep 24, 2023 at 10:36:3

Re: [PATCH v5 04/12] fprobe: Use ftrace_regs in fprobe entry handler

2023-09-25 Thread Google
Hi Jiri, On Mon, 25 Sep 2023 12:41:59 +0200 Jiri Olsa wrote: > On Sun, Sep 24, 2023 at 10:36:36PM +0900, Masami Hiramatsu (Google) wrote: > > From: Masami Hiramatsu (Google) > > > > This allows fprobes to be available with CONFIG_DYNAMIC_FTRACE_

Re: [PATCH v9 1/5] lib: objpool added: ring-array based lockless MPMC

2023-09-25 Thread Google
248miss: 0async & hrtimer: percpu objpool from vmalloc Can you test it too? Thanks, >From f1f442ff653e329839e5452b8b88463a80a12ff3 Mon Sep 17 00:00:00 2001 From: "Masami Hiramatsu (Google)" Date: Mon, 25 Sep 2023 16:07:12 +0900 Subject: [PATCH] objpool: S

Re: [PATCH v9 1/5] lib: objpool added: ring-array based lockless MPMC

2023-09-24 Thread Google
t; + > + return -EAGAIN; > +} > +EXPORT_SYMBOL_GPL(objpool_drop); To make this work correctly, you need to disable the objpool (no more pop the object from it) and ensure the objpool is disabled. Also, when disabling the objpool, its refcount must be set to the "active" number of objects. Thank you, -- Masami Hiramatsu (Google)

Re: [PATCH] eventfs: Remember what dentries were created on dir open

2023-09-24 Thread Google
On Wed, 20 Sep 2023 22:15:37 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Using the following code with libtracefs: > > int dfd; > > // create the directory events/kprobes/kp1 > tracefs_kprobe_raw(NULL, &quo

[PATCH v5 12/12] Documentation: tracing: Add a note about argument and retval access

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a note about the argument and return value accecss will be best effort. Depending on the type, it will be passed via stack or a pair of the registers, but $argN and $retval only support the single register access. Suggested-by: Alexei Starovoitov Signed-off

[PATCH v5 11/12] Documentation: probes: Update fprobe document to use ftrace_regs

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Update fprobe document so that the entry/exit handler uses ftrace_regs instead of pt_regs. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Florent Revest --- Documentation/trace/fprobe.rst | 14 ++ 1 file changed, 6 insertions(+), 8 deletions

[PATCH v5 10/12] bpf: Enable kprobe_multi feature if CONFIG_FPROBE is enabled

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Enable kprobe_multi feature if CONFIG_FPROBE is enabled. The pt_regs is converted from ftrace_regs by ftrace_partial_regs(), thus some registers may always returns 0. But it should be enough for function entry (access arguments) and exit (access return value

[PATCH v5 09/12] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Allow fprobe events to be enabled with CONFIG_DYNAMIC_FTRACE_WITH_ARGS. With this change, fprobe events mostly use ftrace_regs instead of pt_regs. Note that if the arch doesn't enable HAVE_PT_REGS_COMPAT_FTRACE_REGS, fprobe events will not be able to be used from

[PATCH v5 08/12] tracing: Add ftrace_fill_perf_regs() for perf event

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_fill_perf_regs() which should be compatible with the perf_fetch_caller_regs(). In other words, the pt_regs returned from the ftrace_fill_perf_regs() must satisfy 'user_mode(regs) == false' and can be used for stack tracing. Signed-off-by: Masami

[PATCH v5 07/12] tracing: Add ftrace_partial_regs() for converting ftrace_regs to pt_regs

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_partial_regs() which converts the ftrace_regs to pt_regs. If the architecture defines its own ftrace_regs, this copies partial registers to pt_regs and returns it. If not, ftrace_regs is the same as pt_regs and ftrace_partial_regs() will return

[PATCH v5 06/12] fprobe: rethook: Use ftrace_regs in fprobe exit handler and rethook

2023-09-24 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Change the fprobe exit handler and rethook to use ftrace_regs structure instead of pt_regs. This also introduce HAVE_PT_REGS_TO_FTRACE_REGS_CAST which means the ftrace_regs's memory layout is equal to the pt_regs so that those are able to cast. Only

<    3   4   5   6   7   8   9   10   11   12   >