[PATCH v3 2/2] nvdimm: Remove dead code for ENODEV checking in scan_labels()

2024-08-18 Thread Li Zhijian
The only way create_namespace_pmem() returns an ENODEV code is if select_pmem_id(nd_region, &uuid) returns ENODEV when its 2nd parameter is a null pointer. However, this is impossible because &uuid is always valid. Furthermore, create_namespace_pmem() is the only user of select_pmem_id(), it's saf

[PATCH v3 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-18 Thread Li Zhijian
scan_labels() leaks memory when label scanning fails and it falls back to just creating a default "seed" namespace for userspace to configure. Root can force the kernel to leak memory. Allocate the minimum resources unconditionally and release them when unneeded to avoid the memory leak. A kmemle

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-18 Thread Zhijian Li (Fujitsu)
On 10/08/2024 06:55, Dan Williams wrote: > Dan Williams wrote: > [..] >> @@ -2036,12 +2038,10 @@ static struct device **scan_labels(struct nd_region >> *nd_region) > > ...of course you would also need something like: > > if (!count) { > kfree(devs); > return NULL; > } It seems we

Re: [syzbot] [mm?] possible deadlock in __mmap_lock_do_trace_released

2024-08-18 Thread syzbot
syzbot suspects this issue was fixed by commit: commit 7d6be67cfdd4a53cea7147313ca13c531e3a470f Author: Tetsuo Handa Date: Fri Jun 21 01:08:41 2024 + mm: mmap_lock: replace get_memcg_path_buf() with on-stack buffer bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12d488939

Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()

2024-08-18 Thread Zhijian Li (Fujitsu)
(Just back from the summer holiday) Sorry for the late reply. On 10/08/2024 06:38, Dan Williams wrote: > I notice this patch is not upstream yet. Let's try to get it over the > goal line. > > Li Zhijian wrote: >> The leakage would happen when create_namespace_pmem() meets an invalid >> label wh

[PATCH v3] remoteproc: xlnx: add sram support

2024-08-18 Thread Tanmay Shah
AMD-Xilinx zynqmp platform contains on-chip sram memory (OCM). R5 cores can access OCM and access is faster than DDR memory but slower than TCM memories available. Sram region can have optional multiple power-domains. Platform management firmware is responsible to operate these power-domains. Sign

Re: [PATCH] usb: typec: fsa4480: Relax CHIP_ID check

2024-08-18 Thread Luca Weiss
probe(dev, -ENODEV, "FSA4480 not found\n"); > > dev_dbg(dev, "Found FSA4480 v%lu.%lu (Vendor ID = %lu)\n", > > --- > base-commit: ccdbf91fdf5a71881ef32b41797382c4edd6f670 > change-id: 20240818-fsa4480-chipid-fix-2c7cf5810135 > > Best regards,

[PATCH] usb: typec: fsa4480: Relax CHIP_ID check

2024-08-18 Thread Luca Weiss
lu.%lu (Vendor ID = %lu)\n", --- base-commit: ccdbf91fdf5a71881ef32b41797382c4edd6f670 change-id: 20240818-fsa4480-chipid-fix-2c7cf5810135 Best regards, -- Luca Weiss

[PATCH v13 20/20] fgraph: Skip recording calltime/rettime if it is not nneeded

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Skip recording calltime and rettime if the fgraph_ops does not need it. This is a kind of performance optimization for fprobe. Since the fprobe user does not use these entries, recording timestamp in fgraph is just a overhead (e.g. eBPF, ftrace). So introduce the s

[PATCH v13 19/20] Documentation: probes: Update fprobe on function-graph tracer

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Update fprobe documentation for the new fprobe on function-graph tracer. This includes some bahvior changes and pt_regs to ftrace_regs interface change. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Update @fregs parameter explanation. --- Doc

[PATCH v13 18/20] selftests/ftrace: Add a test case for repeating register/unregister fprobe

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) This test case repeats define and undefine the fprobe dynamic event to ensure that the fprobe does not cause any issue with such operations. Signed-off-by: Masami Hiramatsu (Google) --- .../test.d/dynevent/add_remove_fprobe_repeat.tc| 19 ++

[PATCH v13 17/20] selftests: ftrace: Remove obsolate maxactive syntax check

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the fprobe event does not support maxactive anymore, stop testing the maxactive syntax error checking. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/fprobe_syntax_errors.tc |4 +--- 1 file changed, 1 insertion(+), 3 deletions(

[PATCH v13 16/20] tracing/fprobe: Remove nr_maxactive from fprobe

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Remove depercated fprobe::nr_maxactive. This involves fprobe events to rejects the maxactive number. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Newly added. --- include/linux/fprobe.h |2 -- kernel/trace/trace_fprobe.c | 44 +

[PATCH v13 15/20] tracing: Fix function timing profiler to initialize hashtable

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the new fgraph requires to initialize fgraph_ops.ops.func_hash before calling register_ftrace_graph(), initialize it with default (tracing all functions) parameter. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/ftrace.c |4 1 file chan

[PATCH v13 14/20] fprobe: Rewrite fprobe on function-graph tracer

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rewrite fprobe implementation on function-graph tracer. Major API changes are: - 'nr_maxactive' field is deprecated. - This depends on CONFIG_DYNAMIC_FTRACE_WITH_ARGS or !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS, and CONFIG_HAVE_FUNCTION_GRAPH_FREGS. So cur

[PATCH v13 13/20] ftrace: Add CONFIG_HAVE_FTRACE_GRAPH_FUNC

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add CONFIG_HAVE_FTRACE_GRAPH_FUNC kconfig in addition to ftrace_graph_func macro check. This is for the other feature (e.g. FPROBE) which requires to access ftrace_regs from fgraph_ops::entryfunc() can avoid compiling if the fgraph can not pass the valid ftrace_reg

[PATCH v13 12/20] bpf: Enable kprobe_multi feature if CONFIG_FPROBE is enabled

2024-08-18 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). Sig

[PATCH v13 11/20] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2024-08-18 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 p

[PATCH v13 10/20] tracing: Add ftrace_fill_perf_regs() for perf event

2024-08-18 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 Hiramat

[PATCH v13 09/20] tracing: Add ftrace_partial_regs() for converting ftrace_regs to pt_regs

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_partial_regs() which converts the ftrace_regs to pt_regs. This is for the eBPF which needs this to keep the same pt_regs interface to access registers. Thus when replacing the pt_regs with ftrace_regs in fprobes (which is used by kprobe_multi eBPF event)

[PATCH v13 08/20] fprobe: Use ftrace_regs in fprobe exit handler

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Change the fprobe exit handler 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. Fprobe introduces a new dependen

[PATCH v13 07/20] fprobe: Use ftrace_regs in fprobe entry handler

2024-08-18 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 in v6: - Keep using SAVE_REG

[PATCH v13 06/20] function_graph: Pass ftrace_regs to retfunc

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Pass ftrace_regs to the fgraph_ops::retfunc(). If ftrace_regs is not available, it passes a NULL instead. User callback function can access some registers (including return address) via this ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v8

[PATCH v13 05/20] function_graph: Replace fgraph_ret_regs with ftrace_regs

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Use ftrace_regs instead of fgraph_ret_regs for tracing return value on function_graph tracer because of simplifying the callback interface. The CONFIG_HAVE_FUNCTION_GRAPH_RETVAL is also replaced by CONFIG_HAVE_FUNCTION_GRAPH_FREGS. Signed-off-by: Masami Hiramatsu

[PATCH v13 04/20] function_graph: Pass ftrace_regs to entryfunc

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Pass ftrace_regs to the fgraph_ops::entryfunc(). If ftrace_regs is not available, it passes a NULL instead. User callback function can access some registers (including return address) via this ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in

[PATCH v13 03/20] tracing: Rename ftrace_regs_return_value to ftrace_regs_get_return_value

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rename ftrace_regs_return_value to ftrace_regs_get_return_value as same as other ftrace_regs_get/set_* APIs. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Mark Rutland --- Changes in v6: - Moved to top of the series. Changes in v3: - Newly added. ---

[PATCH v13 02/20] tracing: Add a comment about ftrace_regs definition

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) To clarify what will be expected on ftrace_regs, add a comment to the architecture independent definition of the ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Mark Rutland --- Changes in v8: - Update that the saved registers depends on the c

[PATCH v13 01/20] tracing: fgraph: Fix to add new fgraph_ops to array after ftrace_startup_subops()

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the register_ftrace_graph() assigns a new fgraph_ops to fgraph_array before registring it by ftrace_startup_subops(), the new fgraph_ops can be used in function_graph_enter(). In most cases, it is still OK because those fgraph_ops's hashtable is already init

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

2024-08-18 Thread Masami Hiramatsu (Google)
Hi, Here is the 13th version of the series to re-implement the fprobe on function-graph tracer. The previous version is; https://lore.kernel.org/all/172000134410.63468.1374887213469474.stgit@devnote2/ This version is based on v6.11-rc3. In this version, I added a bugfix as [1/20], which shou

[PATCH v3 5/5] sefltests/tracing: Add a test for tracepoint events on modules

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a test case for tracepoint events on modules. This checks if it can add and remove the events correctly. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add not-loaded module test. --- tools/testing/selftests/ftrace/config |

[PATCH v3 4/5] tracing/fprobe: Support raw tracepoints on future loaded modules

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support raw tracepoint events on future loaded (unloaded) modules. This allows user to create raw tracepoint events which can be used from module's __init functions. Note: since the kernel does not have any information about the tracepoints in the unloaded modules

[PATCH v3 3/5] tracing/fprobe: Support raw tracepoint events on modules

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support raw tracepoint event on module by fprobe events. Since it only uses for_each_kernel_tracepoint() to find a tracepoint, the tracepoints on modules are not handled. Thus if user specified a tracepoint on a module, it shows an error. This adds new for_each_mod

[PATCH v3 2/5] tracepoint: Support tterating tracepoints in a loading module

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add for_each_tracepoint_in_module() function to iterate tracepoints in a module. This API is needed for handling tracepoints in a loading module from tracepoint_module_notifier callback function. This also update for_each_module_tracepoint() to pass the module to c

[PATCH v3 1/5] tracepoint: Support iterating over tracepoints on modules

2024-08-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add for_each_module_tracepoint() for iterating over tracepoints on modules. This is similar to the for_each_kernel_tracepoint() but only for the tracepoints on modules (not including kernel built-in tracepoints). Signed-off-by: Masami Hiramatsu (Google) --- Chan

[PATCH v3 0/5] tracing/probes: Support tracepoint events on modules

2024-08-18 Thread Masami Hiramatsu (Google)
Hi, This is the 3rd version of the raw tracepoint events on modules. The previous version is here; https://lore.kernel.org/all/fbfec8d9-d0ed-4384-bbd2-dd5c1e568...@efficios.com/ This version supports tracepoint event on unloaded modules according to Mathies' suggestion ([2/5],[4/5] and part of [