[PATCH v3] rtla: Set distinctive exit value for failed tests

2025-05-15 Thread Costa Shulyupin
A test is considered failed when a sample trace exceeds the threshold. Failed tests return the same exit code as passed tests, requiring test frameworks to determine the result by searching for "hit stop tracing" in the output. Assign a distinct exit code for failed tests to enable the use of shel

Re: [PATCHv2 perf/core 08/22] uprobes/x86: Add mapping for optimized uprobe trampolines

2025-05-15 Thread Andrii Nakryiko
On Thu, May 15, 2025 at 5:13 AM Jiri Olsa wrote: > > Adding support to add special mapping for user space trampoline with > following functions: > > uprobe_trampoline_get - find or add uprobe_trampoline > uprobe_trampoline_put - remove or destroy uprobe_trampoline > > The user space trampoline

Re: [PATCHv2 perf/core 13/22] selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi

2025-05-15 Thread Andrii Nakryiko
On Thu, May 15, 2025 at 5:14 AM Jiri Olsa wrote: > > Renaming uprobe_syscall_executed prog to test_uretprobe_multi > to fit properly in the following changes that add more programs. > > Plus adding pid filter and increasing executed variable. > > Acked-by: Andrii Nakryiko > Signed-off-by: Jiri Ol

Re: [PATCHv2 perf/core 11/22] selftests/bpf: Import usdt.h from libbpf/usdt project

2025-05-15 Thread Andrii Nakryiko
On Thu, May 15, 2025 at 5:14 AM Jiri Olsa wrote: > > Importing usdt.h from libbpf/usdt project. > > Suggested-by: Andrii Nakryiko > Signed-off-by: Jiri Olsa > --- > tools/testing/selftests/bpf/usdt.h | 545 + > 1 file changed, 545 insertions(+) > create mode 100644

Re: [PATCHv2 perf/core 15/22] selftests/bpf: Add hit/attach/detach race optimized uprobe test

2025-05-15 Thread Andrii Nakryiko
On Thu, May 15, 2025 at 5:15 AM Jiri Olsa wrote: > > Adding test that makes sure parallel execution of the uprobe and > attach/detach of optimized uprobe on it works properly. > > Signed-off-by: Jiri Olsa > --- > .../selftests/bpf/prog_tests/uprobe_syscall.c | 94 +++ > 1 file ch

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Jens Axboe
On 5/15/25 12:16 AM, Jason Xing wrote: > From: Jason Xing > > In this version, only support dumping the counter for buffer full and > implement the framework of how it works. > > Users can pass certain flag to fetch what field/statistics they expect > to know. Each time it only returns one resul

Re: [PATCH v2 1/4] relayfs: support a counter tracking if per-cpu buffers is full

2025-05-15 Thread Jens Axboe
Looks fine: Reviewed-by: Jens Axboe -- Jens Axboe

Re: [PATCH v2 3/4] blktrace: use rbuf->stats.full as a drop indicator in relayfs

2025-05-15 Thread Jens Axboe
Looks fine: Reviewed-by: Jens Axboe -- Jens Axboe

Re: [PATCH v2 3/4] blktrace: use rbuf->stats.full as a drop indicator in relayfs

2025-05-15 Thread Jens Axboe
On 5/15/25 12:16 AM, Jason Xing wrote: > From: Jason Xing > > Replace internal subbuf_start in blktrace with the default policy > in relayfs. > > Remove dropped field from struct blktrace. Correspondingly, call the > common helper in relay. Through incrementing full_count to keep track > of how

[PATCH v2] tracing: ring_buffer: Rewind persistent ring buffer when reboot

2025-05-15 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rewind persistent ring buffer pages which have been read in the previous boot. Those pages are highly possible to be lost before writing it to the disk if the previous kernel crashed. In this case, the trace data is kept on the persistent ring buffer, but it can no

[PATCHv2 perf/core 01/22] uprobes: Remove breakpoint in unapply_uprobe under mmap_write_lock

2025-05-15 Thread Jiri Olsa
Currently unapply_uprobe takes mmap_read_lock, but it might call remove_breakpoint which eventually changes user pages. Current code writes either breakpoint or original instruction, so it can probably go away with that, but with the upcoming change that writes multiple instructions on the probed

[PATCHv2 perf/core 03/22] uprobes: Make copy_from_page global

2025-05-15 Thread Jiri Olsa
Making copy_from_page global and adding uprobe prefix. Adding the uprobe prefix to copy_to_page as well for symmetry. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- include/linux/uprobes.h | 1 + kernel/events/uprobes.c | 10 +- 2 files changed, 6 insertions(+), 5 deletions(-)

[PATCHv2 perf/core 02/22] uprobes: Rename arch_uretprobe_trampoline function

2025-05-15 Thread Jiri Olsa
We are about to add uprobe trampoline, so cleaning up the namespace. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- arch/x86/kernel/uprobes.c | 2 +- include/linux/uprobes.h | 2 +- kernel/events/uprobes.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch

[PATCHv2 perf/core 05/22] uprobes: Add nbytes argument to uprobe_write

2025-05-15 Thread Jiri Olsa
Adding nbytes argument to uprobe_write and related functions as preparation for writing whole instructions in following changes. Also renaming opcode arguments to insn, which seems to fit better. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- include/linux/uprobes.h | 4 ++-- kernel/e

[PATCHv2 perf/core 04/22] uprobes: Add uprobe_write function

2025-05-15 Thread Jiri Olsa
Adding uprobe_write function that does what uprobe_write_opcode did so far, but allows to pass verify callback function that checks the memory location before writing the opcode. It will be used in following changes to implement specific checking logic for instruction update. The uprobe_write_opc

[PATCHv2 perf/core 06/22] uprobes: Add is_register argument to uprobe_write and uprobe_write_opcode

2025-05-15 Thread Jiri Olsa
The uprobe_write has special path to restore the original page when we write original instruction back. This happens when uprobe_write detects that we want to write anything else but breakpoint instruction. Moving the detection away and passing it to uprobe_write as argument, so it's possible to w

[PATCHv2 perf/core 07/22] uprobes: Add do_ref_ctr argument to uprobe_write function

2025-05-15 Thread Jiri Olsa
Making update_ref_ctr call in uprobe_write conditional based on do_ref_ctr argument. This way we can use uprobe_write for instruction update without doing ref_ctr_offset update. Signed-off-by: Jiri Olsa --- include/linux/uprobes.h | 2 +- kernel/events/uprobes.c | 8 2 files changed, 5

[PATCHv2 perf/core 09/22] uprobes/x86: Add uprobe syscall to speed up uprobe

2025-05-15 Thread Jiri Olsa
Adding new uprobe syscall that calls uprobe handlers for given 'breakpoint' address. The idea is that the 'breakpoint' address calls the user space trampoline which executes the uprobe syscall. The syscall handler reads the return address of the initial call to retrieve the original 'breakpoint'

[PATCHv2 perf/core 10/22] uprobes/x86: Add support to optimize uprobes

2025-05-15 Thread Jiri Olsa
Putting together all the previously added pieces to support optimized uprobes on top of 5-byte nop instruction. The current uprobe execution goes through following: - installs breakpoint instruction over original instruction - exception handler hit and calls related uprobe consumers - and e

[PATCHv2 perf/core 16/22] selftests/bpf: Add uprobe syscall sigill signal test

2025-05-15 Thread Jiri Olsa
Make sure that calling uprobe syscall from outside uprobe trampoline results in sigill signal. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 36 +++ 1 file changed, 36 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall

[PATCHv2 perf/core 11/22] selftests/bpf: Import usdt.h from libbpf/usdt project

2025-05-15 Thread Jiri Olsa
Importing usdt.h from libbpf/usdt project. Suggested-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/usdt.h | 545 + 1 file changed, 545 insertions(+) create mode 100644 tools/testing/selftests/bpf/usdt.h diff --git a/tools/testing/self

[PATCHv2 perf/core 17/22] selftests/bpf: Add optimized usdt variant for basic usdt test

2025-05-15 Thread Jiri Olsa
Adding optimized usdt variant for basic usdt test to check that usdt arguments are properly passed in optimized code path. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/prog_tests/usdt.c | 38 --- 1 file changed, 25 insertions(+), 13 deletion

[PATCHv2 perf/core 12/22] selftests/bpf: Reorg the uprobe_syscall test function

2025-05-15 Thread Jiri Olsa
Adding __test_uprobe_syscall with non x86_64 stub to execute all the tests, so we don't need to keep adding non x86_64 stub functions for new tests. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 34 +++ 1 file changed, 12

[PATCHv2 perf/core 13/22] selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi

2025-05-15 Thread Jiri Olsa
Renaming uprobe_syscall_executed prog to test_uretprobe_multi to fit properly in the following changes that add more programs. Plus adding pid filter and increasing executed variable. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 1

[PATCHv2 perf/core 18/22] selftests/bpf: Add uprobe_regs_equal test

2025-05-15 Thread Jiri Olsa
Changing uretprobe_regs_trigger to allow the test for both uprobe and uretprobe and renaming it to uprobe_regs_equal. We check that both uprobe and uretprobe probes (bpf programs) see expected registers with few exceptions. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscal

[PATCHv2 perf/core 15/22] selftests/bpf: Add hit/attach/detach race optimized uprobe test

2025-05-15 Thread Jiri Olsa
Adding test that makes sure parallel execution of the uprobe and attach/detach of optimized uprobe on it works properly. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 94 +++ 1 file changed, 94 insertions(+) diff --git a/tools/testing/selftests/bpf

[PATCHv2 perf/core 19/22] selftests/bpf: Change test_uretprobe_regs_change for uprobe and uretprobe

2025-05-15 Thread Jiri Olsa
Changing the test_uretprobe_regs_change test to test both uprobe and uretprobe by adding entry consumer handler to the testmod and making it to change one of the registers. Making sure that changed values both uprobe and uretprobe handlers propagate to the user space. Signed-off-by: Jiri Olsa --

[PATCHv2 22/22] man2: Add uprobe syscall page

2025-05-15 Thread Jiri Olsa
Changing uretprobe syscall man page to be shared with new uprobe syscall man page. Cc: Alejandro Colomar Signed-off-by: Jiri Olsa --- man/man2/uprobe.2| 1 + man/man2/uretprobe.2 | 36 2 files changed, 25 insertions(+), 12 deletions(-) create mode 1006

[PATCHv2 perf/core 08/22] uprobes/x86: Add mapping for optimized uprobe trampolines

2025-05-15 Thread Jiri Olsa
Adding support to add special mapping for user space trampoline with following functions: uprobe_trampoline_get - find or add uprobe_trampoline uprobe_trampoline_put - remove or destroy uprobe_trampoline The user space trampoline is exported as arch specific user space special mapping through

[PATCHv2 perf/core 20/22] seccomp: passthrough uprobe systemcall without filtering

2025-05-15 Thread Jiri Olsa
Adding uprobe as another exception to the seccomp filter alongside with the uretprobe syscall. Same as the uretprobe the uprobe syscall is installed by kernel as replacement for the breakpoint exception and is limited to x86_64 arch and isn't expected to ever be supported in i386. Cc: Kees Cook

[PATCHv2 perf/core 14/22] selftests/bpf: Add uprobe/usdt syscall tests

2025-05-15 Thread Jiri Olsa
Adding tests for optimized uprobe/usdt probes. Checking that we get expected trampoline and attached bpf programs get executed properly. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 289 +- .../bpf/progs/uprobe_syscall_executed.c | 32 ++ 2

[PATCHv2 perf/core 21/22] selftests/seccomp: validate uprobe syscall passes through seccomp

2025-05-15 Thread Jiri Olsa
Adding uprobe checks into the current uretprobe tests. All the related tests are now executed with attached uprobe or uretprobe or without any probe. Renaming the test fixture to uprobe, because it seems better. Cc: Kees Cook Cc: Eyal Birger Reviewed-by: Kees Cook Signed-off-by: Jiri Olsa --

[PATCHv2 perf/core 00/22] uprobes: Add support to optimize usdt probes on x86_64

2025-05-15 Thread Jiri Olsa
hi, this patchset adds support to optimize usdt probes on top of 5-byte nop instruction. The generic approach (optimize all uprobes) is hard due to emulating possible multiple original instructions and its related issues. The usdt case, which stores 5-byte nop seems much easier, so starting with t

Re: [PATCH v2 08/11] x86/mm/pat: remove MEMTYPE_*_MATCH

2025-05-15 Thread David Hildenbrand
On 14.05.25 19:53, David Hildenbrand wrote: On 13.05.25 19:48, Liam R. Howlett wrote: * David Hildenbrand [250512 08:34]: The "memramp() shrinking" scenario no longer applies, so let's remove that now-unnecessary handling. Reviewed-by: Lorenzo Stoakes Acked-by: Ingo Molnar # x86 bits Signed

Re: [PATCHv2 22/22] man2: Add uprobe syscall page

2025-05-15 Thread Alejandro Colomar
Hi Jiri, On Thu, May 15, 2025 at 02:11:19PM +0200, Jiri Olsa wrote: > Changing uretprobe syscall man page to be shared with new > uprobe syscall man page. > > Cc: Alejandro Colomar > Signed-off-by: Jiri Olsa LGTM. Have a lovely night! Alex > --- > man/man2/uprobe.2| 1 + > man/man2/ur

Re: [PATCH v6 1/9] x86/fred, KVM: VMX: Pass event data to the FRED entry point from KVM

2025-05-15 Thread Sean Christopherson
On Wed, May 14, 2025, Sohil Mehta wrote: > On 5/14/2025 7:15 AM, Sean Christopherson wrote: > > Compile tested only... > > > > No worries. I'll test it out. I am assuming you want this patch to go as > part of this series. Yes please. I can also post it separately, but that seems unnecessary.

Re: [PATCH v7 06/12] khugepaged: introduce khugepaged_scan_bitmap for mTHP support

2025-05-15 Thread Baolin Wang
On 2025/5/15 11:22, Nico Pache wrote: khugepaged scans anons PMD ranges for potential collapse to a hugepage. To add mTHP support we use this scan to instead record chunks of utilized sections of the PMD. khugepaged_scan_bitmap uses a stack struct to recursively scan a bitmap that represents

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Christoph Hellwig
On Thu, May 15, 2025 at 02:16:41PM +0800, Jason Xing wrote: > +extern size_t relay_dump(struct rchan *chan, int flags); Please don't add pointless externs for function prototypes. > +EXPORT_SYMBOL_GPL(relay_dump); This export seems unused even with the entire series applied.

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Jason Xing
On Fri, May 16, 2025 at 12:37 PM Christoph Hellwig wrote: > > On Thu, May 15, 2025 at 02:16:41PM +0800, Jason Xing wrote: > > +extern size_t relay_dump(struct rchan *chan, int flags); > > Please don't add pointless externs for function prototypes. Do you mean make it inline in include/linux/relay

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Christoph Hellwig
On Fri, May 16, 2025 at 01:02:59PM +0800, Jason Xing wrote: > Do you mean make it inline in include/linux/relay.h like how > relay_write() works? > > Will do that. Just drop the extern, which is not needed: size_t relay_dump(struct rchan *chan, int flags); > > > > This export seems unused even

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Jason Xing
On Fri, May 16, 2025 at 1:06 PM Christoph Hellwig wrote: > > On Fri, May 16, 2025 at 01:02:59PM +0800, Jason Xing wrote: > > Do you mean make it inline in include/linux/relay.h like how > > relay_write() works? > > > > Will do that. > > Just drop the extern, which is not needed: > > size_t relay_d

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Jason Xing
On Fri, May 16, 2025 at 2:19 AM Jens Axboe wrote: > > On 5/15/25 12:16 AM, Jason Xing wrote: > > From: Jason Xing > > > > In this version, only support dumping the counter for buffer full and > > implement the framework of how it works. > > > > Users can pass certain flag to fetch what field/stat

Re: [PATCH v2 3/4] blktrace: use rbuf->stats.full as a drop indicator in relayfs

2025-05-15 Thread Jason Xing
On Fri, May 16, 2025 at 2:21 AM Jens Axboe wrote: > > On 5/15/25 12:16 AM, Jason Xing wrote: > > From: Jason Xing > > > > Replace internal subbuf_start in blktrace with the default policy > > in relayfs. > > > > Remove dropped field from struct blktrace. Correspondingly, call the > > common helpe

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Google
On Thu, 15 May 2025 14:16:41 +0800 Jason Xing wrote: > From: Jason Xing > > In this version, only support dumping the counter for buffer full and > implement the framework of how it works. > > Users can pass certain flag to fetch what field/statistics they expect > to know. Each time it only r

Re: [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS

2025-05-15 Thread Google
On Mon, 31 Mar 2025 21:23:37 +0900 Masami Hiramatsu (Google) wrote: > On Fri, 28 Mar 2025 14:38:56 -0400 > Brian Masney wrote: > > > Allow the user to override the CFLAGS and LDFLAGS similar to what's > > currently done on other kernel tools. These changes allows bootconfig to > > be compiled w

Re: [PATCH v2 2/4] relayfs: introduce dump of relayfs statistics function

2025-05-15 Thread Jason Xing
On Fri, May 16, 2025 at 10:08 AM Masami Hiramatsu wrote: > > On Thu, 15 May 2025 14:16:41 +0800 > Jason Xing wrote: > > > From: Jason Xing > > > > In this version, only support dumping the counter for buffer full and > > implement the framework of how it works. > > > > Users can pass certain fla