Re: [PATCH v5 3/6] LoongArch: KVM: Add cpucfg area for kvm hypervisor

2024-02-25 Thread Huacai Chen
On Mon, Feb 26, 2024 at 10:04 AM maobibo wrote: > > > > On 2024/2/24 下午5:13, Huacai Chen wrote: > > Hi, Bibo, > > > > On Thu, Feb 22, 2024 at 11:28 AM Bibo Mao wrote: > >> > >> Instruction cpucfg can be used to get processor features. And there > >> is trap exception when it is executed in VM mod

Re: [PATCH v5 3/6] LoongArch: KVM: Add cpucfg area for kvm hypervisor

2024-02-25 Thread WANG Xuerui
Hi, On 2/26/24 10:04, maobibo wrote: On 2024/2/24 下午5:13, Huacai Chen wrote: Hi, Bibo, On Thu, Feb 22, 2024 at 11:28 AM Bibo Mao wrote: Instruction cpucfg can be used to get processor features. And there is trap exception when it is executed in VM mode, and also it is to provide cpu feature

Re: [PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop

2024-02-25 Thread Jason Wang
On Fri, Feb 23, 2024 at 3:22 AM Michael S. Tsirkin wrote: > > On Tue, Jul 25, 2023 at 11:03:11AM +0800, Jason Wang wrote: > > On Mon, Jul 24, 2023 at 3:18 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jul 24, 2023 at 02:52:49PM +0800, Jason Wang wrote: > > > > On Mon, Jul 24, 2023 at 2:46 PM M

Re: [PATCH net-next v5] virtio_net: Support RX hash XDP hint

2024-02-25 Thread Jason Wang
On Fri, Feb 23, 2024 at 9:42 AM Xuan Zhuo wrote: > > On Fri, 09 Feb 2024 13:57:25 +0100, Paolo Abeni wrote: > > On Fri, 2024-02-09 at 18:39 +0800, Liang Chen wrote: > > > On Wed, Feb 7, 2024 at 10:27 PM Paolo Abeni wrote: > > > > > > > > On Wed, 2024-02-07 at 10:54 +0800, Liang Chen wrote: > > >

Re: [PATCH v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

2024-02-25 Thread Haitao Huang
On Sun, 25 Feb 2024 19:38:26 -0600, Huang, Kai wrote: On 24/02/2024 6:00 am, Haitao Huang wrote: On Fri, 23 Feb 2024 04:18:18 -0600, Huang, Kai wrote: > Right. When code reaches to here, we already passed reclaim per cgroup. Yes if try_charge() failed we must do pre-cgroup reclaim.

Re: [PATCH v5 6/6] LoongArch: Add pv ipi support on LoongArch system

2024-02-25 Thread maobibo
On 2024/2/24 下午5:19, Huacai Chen wrote: Hi, Bibo, On Thu, Feb 22, 2024 at 11:28 AM Bibo Mao wrote: On LoongArch system, ipi hw uses iocsr registers, there is one iocsr register access on ipi sending, and two iocsr access on ipi receiving which is ipi interrupt handler. On VM mode all iocsr

Re: [PATCH v5 4/6] LoongArch: Add paravirt interface for guest kernel

2024-02-25 Thread maobibo
On 2024/2/24 下午5:15, Huacai Chen wrote: Hi, Bibo, On Thu, Feb 22, 2024 at 11:28 AM Bibo Mao wrote: Paravirt interface pv_ipi_init() is added here for guest kernel, it firstly checks whether system runs on VM mode. If kernel runs on VM mode, it will call function kvm_para_available() to det

Re: [PATCH v5 3/6] LoongArch: KVM: Add cpucfg area for kvm hypervisor

2024-02-25 Thread maobibo
On 2024/2/24 下午5:13, Huacai Chen wrote: Hi, Bibo, On Thu, Feb 22, 2024 at 11:28 AM Bibo Mao wrote: Instruction cpucfg can be used to get processor features. And there is trap exception when it is executed in VM mode, and also it is to provide cpu features to VM. On real hardware cpucfg are

Re: [PATCH v5 3/6] LoongArch: KVM: Add cpucfg area for kvm hypervisor

2024-02-25 Thread maobibo
On 2024/2/24 下午5:13, Huacai Chen wrote: Hi, Bibo, On Thu, Feb 22, 2024 at 11:28 AM Bibo Mao wrote: Instruction cpucfg can be used to get processor features. And there is trap exception when it is executed in VM mode, and also it is to provide cpu features to VM. On real hardware cpucfg are

Re: [PATCH v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

2024-02-25 Thread Huang, Kai
On 24/02/2024 6:00 am, Haitao Huang wrote: On Fri, 23 Feb 2024 04:18:18 -0600, Huang, Kai wrote: > Right. When code reaches to here, we already passed reclaim per cgroup. Yes if try_charge() failed we must do pre-cgroup reclaim. The cgroup may not at or reach limit but system has run ou

Re: [PATCH] ftrace: fix most kernel-doc warnings

2024-02-25 Thread Google
On Thu, 22 Feb 2024 21:48:33 -0800 Randy Dunlap wrote: > Reduce the number of kernel-doc warnings from 52 down to 10, i.e., > fix 42 kernel-doc warnings by (a) using the Returns: format for > function return values or (b) using "@var:" instead of "@var -" > for function parameter descriptions. >

Re: [PATCH] tracing: Remove second parameter to __assign_rel_str()

2024-02-25 Thread Google
On Fri, 23 Feb 2024 16:25:19 -0500 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The second parameter of __assign_rel_str() is no longer used. It can be > removed. > > Note, the only real users of rel_string is user events. This code is just > in the sample code for testing purp

Re: [PATCH v2] tracing: Add warning if string in __assign_str() does not match __string()

2024-02-25 Thread Google
On Fri, 23 Feb 2024 16:13:56 -0500 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > In preparation to remove the second parameter of __assign_str(), make sure > it is really a duplicate of __string() by adding a WARN_ON_ONCE(). > Looks good to me. So eventually this is removed when

Re: [PATCH] tracing: Use div64_u64() instead of do_div()

2024-02-25 Thread Google
On Sun, 25 Feb 2024 17:45:08 +0100 Thorsten Blum wrote: > Fixes Coccinelle/coccicheck warnings reported by do_div.cocci. > > Compared to do_div(), div64_u64() does not implicitly cast the divisor and > does not unnecessarily calculate the remainder. > Looks good to me. Acked-by: Masami Hirama

Re: [PATCH] ring-buffer: use READ_ONCE() to read cpu_buffer->commit_page in concurrent environment

2024-02-25 Thread Steven Rostedt
On Sun, 25 Feb 2024 11:05:06 +0800 linke li wrote: > In function ring_buffer_iter_empty(), cpu_buffer->commit_page and > curr_commit_page->page->time_stamp is read using READ_ONCE() in > line 4354, 4355 > > 4354curr_commit_page = READ_ONCE(cpu_buffer->commit_page); > 4355curr_commit_ts

[PATCH] tracing: Use div64_u64() instead of do_div()

2024-02-25 Thread Thorsten Blum
Fixes Coccinelle/coccicheck warnings reported by do_div.cocci. Compared to do_div(), div64_u64() does not implicitly cast the divisor and does not unnecessarily calculate the remainder. Signed-off-by: Thorsten Blum --- kernel/trace/trace_benchmark.c | 5 ++--- 1 file changed, 2 insertions(+), 3

[PATCH v8 35/35] Documentation: probes: Update fprobe on function-graph tracer

2024-02-25 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 v8 34/35] selftests/ftrace: Add a test case for repeating register/unregister fprobe

2024-02-25 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 v8 33/35] selftests: ftrace: Remove obsolate maxactive syntax check

2024-02-25 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 v8 32/35] tracing/fprobe: Remove nr_maxactive from fprobe

2024-02-25 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 v8 31/35] fprobe: Rewrite fprobe on function-graph tracer

2024-02-25 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 v8 30/35] ftrace: Add CONFIG_HAVE_FTRACE_GRAPH_FUNC

2024-02-25 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 v8 29/35] bpf: Enable kprobe_multi feature if CONFIG_FPROBE is enabled

2024-02-25 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 v8 28/35] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2024-02-25 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 v8 27/35] tracing: Add ftrace_fill_perf_regs() for perf event

2024-02-25 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 v8 26/35] tracing: Add ftrace_partial_regs() for converting ftrace_regs to pt_regs

2024-02-25 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 v8 25/35] fprobe: Use ftrace_regs in fprobe exit handler

2024-02-25 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 v8 24/35] fprobe: Use ftrace_regs in fprobe entry handler

2024-02-25 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 v8 23/35] function_graph: Pass ftrace_regs to retfunc

2024-02-25 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 v8 22/35] function_graph: Replace fgraph_ret_regs with ftrace_regs

2024-02-25 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 v8 21/35] function_graph: Pass ftrace_regs to entryfunc

2024-02-25 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 v8 20/35] ftrace: Add multiple fgraph storage selftest

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a selftest for multiple function graph tracer with storage on a same function. In this case, the shadow stack entry will be shared among those fgraph with different data storage. So this will ensure the fgraph will not mixed those storage data. Signed-off-by:

[PATCH v8 19/35] function_graph: Add selftest for passing local variables

2024-02-25 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) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Add reserved size test. - U

[PATCH v8 18/35] function_graph: Implement fgraph_reserve_data() and fgraph_retrieve_data()

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Added functions that can be called by a fgraph_ops entryfunc and retfunc to store state between the entry of the function being traced to the exit of the same function. The fgraph_ops entryfunc() may call fgraph_reserve_data() to store up to 32 words onto the task's

[PATCH v8 17/35] function_graph: Move graph notrace bit to shadow stack global var

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) The use of the task->trace_recursion for the logic used for the function graph no-trace was a bit of an abuse of that variable. Now that there exists global vars that are per stack for registered graph traces, use that instead. Signed-off-by: Steven Rostedt (VMware)

[PATCH v8 16/35] function_graph: Move graph depth stored data to shadow stack global var

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) The use of the task->trace_recursion for the logic used for the function graph depth was a bit of an abuse of that variable. Now that there exists global vars that are per stack for registered graph traces, use that instead. Signed-off-by: Steven Rostedt (VMware) S

[PATCH v8 15/35] function_graph: Move set_graph_function tests to shadow stack global var

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) The use of the task->trace_recursion for the logic used for the set_graph_funnction was a bit of an abuse of that variable. Now that there exists global vars that are per stack for registered graph traces, use that instead. Signed-off-by: Steven Rostedt (VMware) Si

[PATCH v8 14/35] function_graph: Add "task variables" per task for fgraph_ops

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Add a "task variables" array on the tasks shadow ret_stack that is the size of longs for each possible registered fgraph_ops. That's a total of 16, taking up 8 * 16 = 128 bytes (out of a page size 4k). This will allow for fgraph_ops to do specific features on a per

[PATCH v8 13/35] function_graph: Use a simple LRU for fgraph_array index number

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the fgraph_array index is used for the bitmap on the shadow stack, it may leave some entries after a function_graph instance is removed. Thus if another instance reuses the fgraph_array index soon after releasing it, the fgraph may confuse to call the newer c

[PATCH v8 12/35] function_graph: Have the instances use their own ftrace_ops for filtering

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Allow for instances to have their own ftrace_ops part of the fgraph_ops that makes the funtion_graph tracer filter on the set_ftrace_filter file of the instance and not the top instance. Note that this also requires to update ftrace_graph_func() to call new function

[PATCH v8 11/35] ftrace: Allow ftrace startup flags exist without dynamic ftrace

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Some of the flags for ftrace_startup() may be exposed even when CONFIG_DYNAMIC_FTRACE is not configured in. This is fine as the difference between dynamic ftrace and static ftrace is done within the internals of ftrace itself. No need to have use cases fail to compil

[PATCH v8 10/35] ftrace: Allow function_graph tracer to be enabled in instances

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Now that function graph tracing can handle more than one user, allow it to be enabled in the ftrace instances. Note, the filtering of the functions is still joined by the top level set_ftrace_filter and friends, as well as the graph and nograph files. Signed-off-by:

[PATCH v8 09/35] ftrace/function_graph: Pass fgraph_ops to function graph callbacks

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Pass the fgraph_ops structure to the function graph callbacks. This will allow callbacks to add a descriptor to a fgraph_ops private field that wil be added in the future and use it for the callbacks. This will be useful when more than one callback can be registered

[PATCH v8 08/35] function_graph: Remove logic around ftrace_graph_entry and return

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) The function pointers ftrace_graph_entry and ftrace_graph_return are no longer called via the function_graph tracer. Instead, an array structure is now used that will allow for multiple users of the function_graph infrastructure. The variables are still used by the a

[PATCH v8 07/35] function_graph: Allow multiple users to attach to function graph

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Allow for multiple users to attach to function graph tracer at the same time. Only 16 simultaneous users can attach to the tracer. This is because there's an array that stores the pointers to the attached fgraph_ops. When a function being traced is entered, each of t

[PATCH v8 06/35] function_graph: Add an array structure that will allow multiple callbacks

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Add an array structure that will eventually allow the function graph tracer to have up to 16 simultaneous callbacks attached. It's an array of 16 fgraph_ops pointers, that is assigned when one is registered. On entry of a function the entry of the first item in the a

[PATCH v8 05/35] fgraph: Use BUILD_BUG_ON() to make sure we have structures divisible by long

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Instead of using "ALIGN()", use BUILD_BUG_ON() as the structures should always be divisible by sizeof(long). Link: http://lkml.kernel.org/r/2019052444.gi2...@hirez.programming.kicks-ass.net Suggested-by: Peter Zijlstra Signed-off-by: Steven Rostedt (VMware)

[PATCH v8 04/35] function_graph: Convert ret_stack to a series of longs

2024-02-25 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) In order to make it possible to have multiple callbacks registered with the function_graph tracer, the retstack needs to be converted from an array of ftrace_ret_stack structures to an array of longs. This will allow to store the list of callbacks on the stack for th

[PATCH v8 03/35] x86: tracing: Add ftrace_regs definition in the header

2024-02-25 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_regs definition for x86_64 in the ftrace header to clarify what register will be accessible from ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add rip to be saved. Changes in v2: - Newly added. --- arch/x86/include/a

[PATCH v8 02/35] tracing: Rename ftrace_regs_return_value to ftrace_regs_get_return_value

2024-02-25 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 v8 01/35] tracing: Add a comment about ftrace_regs definition

2024-02-25 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 v8 00/35] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph

2024-02-25 Thread Masami Hiramatsu (Google)
Hi, Here is the 8th version of the series to re-implement the fprobe on function-graph tracer. The previous version is; https://lore.kernel.org/all/170723204881.502590.11906735097521170661.stgit@devnote2/ In this version, I droped very rare case pop operation fix. This also drops x86/arm64 HAVE_

Re: [PATCH] virtiofs: limit the length of ITER_KVEC dio by max_nopage_rw

2024-02-25 Thread Michael S. Tsirkin
On Fri, Feb 23, 2024 at 10:42:37AM +0100, Miklos Szeredi wrote: > On Wed, 3 Jan 2024 at 11:58, Hou Tao wrote: > > > > From: Hou Tao > > > > When trying to insert a 10MB kernel module kept in a virtiofs with cache > > disabled, the following warning was reported: > > > > [ cut here ]