Re: [RFC PATCH v4 08/17] powerpc/ftrace: Move ftrace stub used for init text before _einittext

2024-07-14 Thread Nicholas Piggin
On Sun Jul 14, 2024 at 6:27 PM AEST, Naveen N Rao wrote: > Move the ftrace stub used to cover inittext before _einittext so that it > is within kernel text, as seen through core_kernel_text(). This is > required for a subsequent change to ftrace. Hmm, is there a reason it was outside einittext any

Re: [PATCH v3] x86/paravirt: Disable virt spinlock on bare metal

2024-07-14 Thread Chen Yu
On 2024-06-25 at 20:54:03 +0800, Chen Yu wrote: > The kernel can change spinlock behavior when running as a guest. But > this guest-friendly behavior causes performance problems on bare metal. > So there's a 'virt_spin_lock_key' static key to switch between the two > modes. > > The static key is a

Re: [PATCH 2/2] selftests/bpf: Change uretprobe syscall number in uprobe_syscall test

2024-07-14 Thread Google
On Fri, 12 Jul 2024 11:27:30 -0700 Andrii Nakryiko wrote: > On Fri, Jul 12, 2024 at 6:53 AM Jiri Olsa wrote: > > > > Fixing the syscall number value. > > > > Fixes: 9e7f74e64ae5 ("selftests/bpf: Add uretprobe syscall call from user > > space test") > > Signed-off-by: Jiri Olsa > > --- > > too

Re: [PATCH net-next] virtio_net: Fix napi_skb_cache_put warning

2024-07-14 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Fri, 12 Jul 2024 04:53:25 -0700 you wrote: > After the commit bdacf3e34945 ("net: Use nested-BH locking for > napi_alloc_cache.") was merged, the following warning began to appear: > >WARNING: CPU: 5 PID:

Re: [PATCH net-next] virtio_net: Fix napi_skb_cache_put warning

2024-07-14 Thread Heng Qi
在 2024/7/12 下午7:53, Breno Leitao 写道: After the commit bdacf3e34945 ("net: Use nested-BH locking for napi_alloc_cache.") was merged, the following warning began to appear: WARNING: CPU: 5 PID: 1 at net/core/skbuff.c:1451 napi_skb_cache_put+0x82/0x4b0 __warn+0x12f/0x340

Re: [PATCH V2 5/7] vhost-vdpa: VHOST_IOTLB_REMAP

2024-07-14 Thread Jason Wang
On Fri, Jul 12, 2024 at 9:19 PM Steve Sistare wrote: > > When device ownership is passed to a new process via VHOST_NEW_OWNER, > some devices need to know the new userland addresses of the dma mappings. > Define the new iotlb message type VHOST_IOTLB_REMAP to update the uaddr > of a mapping. The

Re: [PATCH V2 4/7] vhost-vdpa: VHOST_BACKEND_F_NEW_OWNER

2024-07-14 Thread Jason Wang
On Fri, Jul 12, 2024 at 9:19 PM Steve Sistare wrote: > > Add the VHOST_BACKEND_F_NEW_OWNER backend capability, which indicates that > VHOST_NEW_OWNER is supported. > > Signed-off-by: Steve Sistare Doesn't harm but should this be part of the previous patch? Thanks

Re: [PATCH V2 3/7] vhost-vdpa: VHOST_NEW_OWNER

2024-07-14 Thread Jason Wang
On Fri, Jul 12, 2024 at 9:19 PM Steve Sistare wrote: > > Add an ioctl to transfer file descriptor ownership and pinned memory > accounting from one process to another. > > This is more efficient than VHOST_RESET_OWNER followed by VHOST_SET_OWNER, > as that would unpin all physical pages, requiring

Re: [PATCH V2 0/7] vdpa live update

2024-07-14 Thread Jason Wang
On Fri, Jul 12, 2024 at 9:19 PM Steve Sistare wrote: > > Live update is a technique wherein an application saves its state, exec's > to an updated version of itself, and restores its state. Clients of the > application experience a brief suspension of service, on the order of > 100's of milliseco

Re: [PATCH] vdpa/octeon_ep: Fix error code in octep_process_mbox()

2024-07-14 Thread Jason Wang
On Fri, Jul 12, 2024 at 10:06 PM Dan Carpenter wrote: > > Return -EINVAL for invalid signatures. Don't return success. > > Fixes: 8b6c724cdab8 ("virtio: vdpa: vDPA driver for Marvell OCTEON DPU > devices") > Signed-off-by: Dan Carpenter > --- > Nag mode: When we add a new driver, then could we

Re: [PATCH net-next] virtio_net: Fix napi_skb_cache_put warning

2024-07-14 Thread Jason Wang
On Fri, Jul 12, 2024 at 7:54 PM Breno Leitao wrote: > > After the commit bdacf3e34945 ("net: Use nested-BH locking for > napi_alloc_cache.") was merged, the following warning began to appear: > > WARNING: CPU: 5 PID: 1 at net/core/skbuff.c:1451 > napi_skb_cache_put+0x82/0x4b0 > >

[PATCH] tracing: Replace 21 seq_puts() calls by seq_putc() calls

2024-07-14 Thread Markus Elfring
From: Markus Elfring Date: Sun, 14 Jul 2024 15:40:34 +0200 Single characters should be put into a sequence. Thus use the corresponding function “seq_putc”. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring --- kernel/trace/trace_events_hist.c | 26

[PATCH] module: tracking: Extend format string of a seq_printf() call in unloaded_tainted_modules_seq_show()

2024-07-14 Thread Markus Elfring
From: Markus Elfring Date: Sun, 14 Jul 2024 13:43:06 +0200 Subject: [PATCH] module: tracking: Extend format string of a seq_printf() call in unloaded_tainted_modules_seq_show() * Move the specification of a single line break from a seq_puts() call into the format string of a previous seq_print

[PATCH] module: Use seq_putc() in two functions

2024-07-14 Thread Markus Elfring
From: Markus Elfring Date: Sun, 14 Jul 2024 13:13:15 +0200 Single characters should be put into a sequence. Thus use the corresponding function “seq_putc”. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring --- kernel/module/procfs.c | 4 ++-- 1 file ch

[RFC PATCH v4 01/17] powerpc/trace: Account for -fpatchable-function-entry support by toolchain

2024-07-14 Thread Naveen N Rao
So far, we have relied on the fact that gcc supports both -mprofile-kernel, as well as -fpatchable-function-entry, and clang supports neither. Our Makefile only checks for CONFIG_MPROFILE_KERNEL to decide which files to build. Clang has a feature request out [*] to implement -fpatchable-function-en

[RFC PATCH v4 10/17] powerpc/ftrace: Add a postlink script to validate function tracer

2024-07-14 Thread Naveen N Rao
Function tracer on powerpc can only work with vmlinux having a .text size of up to ~64MB due to powerpc branch instruction having a limited relative branch range of 32MB. Today, this is only detected on kernel boot when ftrace is init'ed. Add a post-link script to check the size of .text so that we

[RFC PATCH v4 09/17] powerpc64/bpf: Fold bpf_jit_emit_func_call_hlp() into bpf_jit_emit_func_call_rel()

2024-07-14 Thread Naveen N Rao
Commit 61688a82e047 ("powerpc/bpf: enable kfunc call") enhanced bpf_jit_emit_func_call_hlp() to handle calls out to module region, where bpf progs are generated. The only difference now between bpf_jit_emit_func_call_hlp() and bpf_jit_emit_func_call_rel() is in handling of the initial pass where ta

[RFC PATCH v4 08/17] powerpc/ftrace: Move ftrace stub used for init text before _einittext

2024-07-14 Thread Naveen N Rao
Move the ftrace stub used to cover inittext before _einittext so that it is within kernel text, as seen through core_kernel_text(). This is required for a subsequent change to ftrace. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/vmlinux.lds.S | 3 +-- 1 file changed, 1 insertion(+), 2 del

[RFC PATCH v4 07/17] powerpc/ftrace: Skip instruction patching if the instructions are the same

2024-07-14 Thread Naveen N Rao
To simplify upcoming changes to ftrace, add a check to skip actual instruction patching if the old and new instructions are the same. We still validate that the instruction is what we expect, but don't actually patch the same instruction again. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel

[RFC PATCH v4 06/17] powerpc/ftrace: Remove pointer to struct module from dyn_arch_ftrace

2024-07-14 Thread Naveen N Rao
Pointer to struct module is only relevant for ftrace records belonging to kernel modules. Having this field in dyn_arch_ftrace wastes memory for all ftrace records belonging to the kernel. Remove the same in favour of looking up the module from the ftrace record address, similar to other architectu

[RFC PATCH v4 05/17] powerpc/module_64: Convert #ifdef to IS_ENABLED()

2024-07-14 Thread Naveen N Rao
Minor refactor for converting #ifdef to IS_ENABLED(). Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/module_64.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c ind

[RFC PATCH v4 04/17] powerpc32/ftrace: Unify 32-bit and 64-bit ftrace entry code

2024-07-14 Thread Naveen N Rao
On 32-bit powerpc, gcc generates a three instruction sequence for function profiling: mflrr0 stw r0, 4(r1) bl _mcount On kernel boot, the call to _mcount() is nop-ed out, to be patched back in when ftrace is actually enabled. The 'stw' instruction therefore is

[RFC PATCH v4 03/17] powerpc64/ftrace: Nop out additional 'std' instruction emitted by gcc v5.x

2024-07-14 Thread Naveen N Rao
Gcc v5.x emits a 3-instruction sequence for -mprofile-kernel: mflrr0 std r0, 16(r1) bl _mcount Gcc v6.x moved to a simpler 2-instruction sequence by removing the 'std' instruction. The store saved the return address in the LR save area in the caller stack frame

[RFC PATCH v4 02/17] powerpc/kprobes: Use ftrace to determine if a probe is at function entry

2024-07-14 Thread Naveen N Rao
Rather than hard-coding the offset into a function to be used to determine if a kprobe is at function entry, use ftrace_location() to determine the ftrace location within the function and categorize all instructions till that offset to be function entry. For functions that cannot be traced, we fal

[RFC PATCH v4 17/17] powerpc64/bpf: Add support for bpf trampolines

2024-07-14 Thread Naveen N Rao
Add support for bpf_arch_text_poke() and arch_prepare_bpf_trampoline() for 64-bit powerpc. While the code is generic, BPF trampolines are only enabled on 64-bit powerpc. 32-bit powerpc will need testing and some updates. BPF Trampolines adhere to the existing ftrace ABI utilizing a two-instruction

[RFC PATCH v4 16/17] samples/ftrace: Add support for ftrace direct samples on powerpc

2024-07-14 Thread Naveen N Rao
Add powerpc 32-bit and 64-bit samples for ftrace direct. This serves to show the sample instruction sequence to be used by ftrace direct calls to adhere to the ftrace ABI. On 64-bit powerpc, TOC setup requires some additional work. Signed-off-by: Naveen N Rao --- arch/powerpc/Kconfig

[RFC PATCH v4 15/17] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS

2024-07-14 Thread Naveen N Rao
Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS similar to the arm64 implementation. ftrace direct calls allow custom trampolines to be called into directly from function ftrace call sites, bypassing the ftrace trampoline completely. This functionality is currently utilized by BPF trampolines to

[RFC PATCH v4 14/17] powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_CALL_OPS

2024-07-14 Thread Naveen N Rao
Implement support for DYNAMIC_FTRACE_WITH_CALL_OPS similar to the arm64 implementation. This works by patching-in a pointer to an associated ftrace_ops structure before each traceable function. If multiple ftrace_ops are associated with a call site, then a special ftrace_list_ops is used to enable

[RFC PATCH v4 13/17] powerpc64/ftrace: Support .text larger than 32MB with out-of-line stubs

2024-07-14 Thread Naveen N Rao
We are restricted to a .text size of ~32MB when using out-of-line function profile sequence. Allow this to be extended up to the previous limit of ~64MB by reserving space in the middle of .text. A new config option CONFIG_PPC_FTRACE_OUT_OF_LINE_NUM_RESERVE is introduced to specify the number of f

[RFC PATCH v4 12/17] powerpc64/ftrace: Move ftrace sequence out of line

2024-07-14 Thread Naveen N Rao
Function profile sequence on powerpc includes two instructions at the beginning of each function: mflrr0 bl ftrace_caller The call to ftrace_caller() gets nop'ed out during kernel boot and is patched in when ftrace is enabled. Given the sequence, we cannot return from ftr

[RFC PATCH v4 11/17] kbuild: Add generic hook for architectures to use before the final vmlinux link

2024-07-14 Thread Naveen N Rao
On powerpc, we would like to be able to make a pass on vmlinux.o and generate a new object file to be linked into vmlinux. Add a generic pass in Makefile.vmlinux that architectures can use for this purpose. Architectures need to select CONFIG_ARCH_WANTS_PRE_LINK_VMLINUX and must provide arch//tool

[RFC PATCH v4 00/17] powerpc: Core ftrace rework, support for ftrace direct and bpf trampolines

2024-07-14 Thread Naveen N Rao
This is v4 of the series posted here: http://lkml.kernel.org/r/cover.1718908016.git.nav...@kernel.org This series reworks core ftrace support on powerpc to have the function profiling sequence moved out of line. This enables us to have a single nop at kernel function entry virtually eliminating

Re: [PATCH net-next] virtio_net: Fix napi_skb_cache_put warning

2024-07-14 Thread Michael S. Tsirkin
On Fri, Jul 12, 2024 at 04:53:25AM -0700, Breno Leitao wrote: > After the commit bdacf3e34945 ("net: Use nested-BH locking for > napi_alloc_cache.") was merged, the following warning began to appear: > >WARNING: CPU: 5 PID: 1 at net/core/skbuff.c:1451 > napi_skb_cache_put+0x82/0x4b0 > >