Re: [PATCH v8 00/24] RISC-V SBI v2.0 PMU improvements and Perf sampling in KVM guest

2024-04-29 Thread Anup Patel
Hi Palmer, On Mon, Apr 22, 2024 at 3:29 PM Anup Patel wrote: > > On Sat, Apr 20, 2024 at 5:17 AM Atish Patra wrote: > > > > This series implements SBI PMU improvements done in SBI v2.0[1] i.e. PMU > > snapshot > > and fw_read_hi() functions. > > > > SBI v2.0 introduced PMU snapshot feature whic

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-29 Thread Xu Kuohai
On 4/30/2024 6:18 AM, Eduard Zingerman wrote: On Mon, 2024-04-29 at 13:58 -0700, Andrii Nakryiko wrote: [...] diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 8f0f2e21699e..b69c89bc5cfc 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -13478,6 +13478,28 @@ stat

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-29 Thread Xu Kuohai
On 4/30/2024 4:58 AM, Andrii Nakryiko wrote: On Sun, Apr 28, 2024 at 8:15 AM Xu Kuohai wrote: On 4/27/2024 4:36 AM, Andrii Nakryiko wrote: On Tue, Apr 23, 2024 at 7:26 PM Xu Kuohai wrote: On 4/24/2024 5:55 AM, Yonghong Song wrote: On 4/20/24 1:33 AM, Xu Kuohai wrote: On 4/20/2024 7:00 A

[PATCH v1 4/4] selftests: ifs: verify IFS ARRAY BIST functionality

2024-04-29 Thread Pengfei Xu
There are two selftest scenarios for ARRAY BIST(Board Integrated System Test) tests: 1. Perform IFS ARRAY BIST tests once on each CPU. 2. Perform IFS ARRAY BIST tests on a random CPU with 3 rounds. These are not meant to be exhaustive, but are some minimal tests for for checking IFS ARRAY BIST.

[PATCH v1 3/4] selftests: ifs: verify IFS scan test functionality

2024-04-29 Thread Pengfei Xu
Two selftests are added to verify IFS scan test feature: 1. Perform IFS scan test once on each CPU using all the available image files. 2. Perform IFS scan test with the default image on a random cpu for 3 rounds. Reviewed-by: Jithu Joseph Co-developed-by: Ashok Raj Signed-off-by: Ashok R

[PATCH v1 2/4] selftests: ifs: verify test image loading functionality

2024-04-29 Thread Pengfei Xu
Scan test image files have to be loaded before starting IFS test. Verify that In Field scan driver is able to load valid test image files. Also check if loading an invalid test image file fails. Reviewed-by: Jithu Joseph Co-developed-by: Ashok Raj Signed-off-by: Ashok Raj Signed-off-by: Pengf

[PATCH v1 1/4] selftests: ifs: verify test interfaces are created by the driver

2024-04-29 Thread Pengfei Xu
IFS (In Field Scan) driver exposes its functionality via sysfs interfaces. Applications prepare and exercise the tests by interacting with the aforementioned sysfs files. Verify that the necessary sysfs entries are created after loading the IFS driver. Initialize test variables needed for buildin

[PATCH v1 0/4] add tests to verify IFS (In Field Scan) driver functionality

2024-04-29 Thread Pengfei Xu
To verify IFS (In Field Scan [1]) driver functionality, add the following 6 test cases: 1. Verify that IFS sysfs entries are created after loading the IFS module 2. Check if loading an invalid IFS test image fails and loading a valid one succeeds 3. Perform IFS scan test on each CPU usin

Re: [PATCH v2 12/25] KVM: VMX: Handle FRED event data

2024-04-29 Thread Chao Gao
>index ee61d2c25cb0..f622fb90a098 100644 >--- a/arch/x86/kvm/vmx/vmx.c >+++ b/arch/x86/kvm/vmx/vmx.c >@@ -1871,9 +1871,29 @@ static void vmx_inject_exception(struct kvm_vcpu *vcpu) >vmcs_write32(VM_ENTRY_INSTRUCTION_LEN, > vmx->vcpu.arch.event_exit_inst_l

[linus:master] [selftests/harness] 8092162335: kernel-selftests.sgx.make.fail

2024-04-29 Thread kernel test robot
Hello, kernel test robot noticed "kernel-selftests.sgx.make.fail" on: commit: 8092162335554c8ef5e7f50eff68aa9cfbdbf865 ("selftests/harness: remove use of LINE_MAX") https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master [test failed on linus/master 98369dccd2f8e16bf4c6621053a

[PATCH 6.6.y] kselftest: Add a ksft_perror() helper

2024-04-29 Thread Edward Liaw
From: Mark Brown [ Upstream commit 907f33028871fa7c9a3db1efd467b78ef82cce20 ] The standard library perror() function provides a convenient way to print an error message based on the current errno but this doesn't play nicely with KTAP output. Provide a helper which does an equivalent thing in a

Re: [PATCH] kselftest: Add a ksft_perror() helper

2024-04-29 Thread Edward Liaw
Sorry, will resend this; I forgot to prefix that it was intended for the 6.6.y branch. On Mon, Apr 29, 2024 at 5:49 PM Edward Liaw wrote: > > From: Mark Brown > > [ Upstream commit 907f33028871fa7c9a3db1efd467b78ef82cce20 ] > > The standard library perror() function provides a convenient way to

[PATCH] kselftest: Add a ksft_perror() helper

2024-04-29 Thread Edward Liaw
From: Mark Brown [ Upstream commit 907f33028871fa7c9a3db1efd467b78ef82cce20 ] The standard library perror() function provides a convenient way to print an error message based on the current errno but this doesn't play nicely with KTAP output. Provide a helper which does an equivalent thing in a

Re: [PATCH] selftests/vDSO: Fix assignment in condition without parentheses

2024-04-29 Thread Justin Stitt
On Mon, Apr 29, 2024 at 08:34:36PM +, Edward Liaw wrote: > Fixes clang compiler warnings by adding parentheses: > > parse_vdso.c:65:9: warning: using the result of an assignment as a condition > without parentheses [-Wparentheses] > if (g = h & 0xf000) >

[PATCH] selftests/kcmp: Remove unused open mode

2024-04-29 Thread Edward Liaw
Android bionic warns that open modes are ignored if O_CREAT or O_TMPFILE aren't specified. The permissions for the file are set above: fd1 = open(kpath, O_RDWR | O_CREAT | O_TRUNC, 0644); Fixes: d97b46a64674 ("syscalls, x86: add __NR_kcmp syscall") Signed-off-by: Edward Liaw --- tools/

[PATCH V4] KVM: selftests: Add a new option to rseq_test

2024-04-29 Thread Zide Chen
Currently, the migration worker delays 1-10 us, assuming that one KVM_RUN iteration only takes a few microseconds. But if the CPU low power wakeup latency is large enough, for example, hundreds or even thousands of microseconds deep C-state exit latencies on x86 server CPUs, it may happen that it'

Re: [PATCH bpf-next 0/2] Free strdup memory in selftests

2024-04-29 Thread patchwork-bot+netdevbpf
Hello: This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko : On Mon, 29 Apr 2024 15:07:32 +0800 you wrote: > From: Geliang Tang > > Two fixes to free strdup memory in selftests to avoid memory leaks. > > Geliang Tang (2): > selftests/bpf: Free strdup memory in test_sockma

Re: [PATCH V3] KVM: selftests: Add a new option to rseq_test

2024-04-29 Thread Chen, Zide
On 4/29/2024 12:39 PM, Sean Christopherson wrote: >> Signed-off-by: Zide Chen >> Signed-off-by: donsheng > > Why does this have Donghsheng's SoB? Is this a Co-developed-by situation? Yes, Co-developed-by is more suitable. >> > > Put per-patch notes that aren't intended for the final chang

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-29 Thread Eduard Zingerman
On Mon, 2024-04-29 at 13:58 -0700, Andrii Nakryiko wrote: [...] > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > > index 8f0f2e21699e..b69c89bc5cfc 100644 > > --- a/kernel/bpf/verifier.c > > +++ b/kernel/bpf/verifier.c > > @@ -13478,6 +13478,28 @@ static void scalar32_min_max_and(

Re: [PATCH v4 02/11] riscv: add ISA extensions validation

2024-04-29 Thread Conor Dooley
On Mon, Apr 29, 2024 at 05:04:55PM +0200, Clément Léger wrote: > Since a few extensions (Zicbom/Zicboz) already needs validation and > future ones will need it as well (Zc*) add a validate() callback to > struct riscv_isa_ext_data. This require to rework the way extensions are > parsed and split it

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-29 Thread Eduard Zingerman
On Sun, 2024-04-28 at 23:15 +0800, Xu Kuohai wrote: [...] > diff --git a/kernel/bpf/tnum.c b/kernel/bpf/tnum.c > index 9dbc31b25e3d..9d4480a683ca 100644 > --- a/kernel/bpf/tnum.c > +++ b/kernel/bpf/tnum.c > @@ -150,6 +150,29 @@ struct tnum tnum_intersect(struct tnum a, struct tnum b) > r

Re: [PATCH v2 bpf-next 4/6] selftests/bpf: Add IPv4 and IPv6 sockaddr test cases

2024-04-29 Thread Jordan Rife
> For the tests that moved to sock_addr.c, please also remove them from > test_sock_addr.c. Done in v3 (https://lore.kernel.org/bpf/20240429214529.2644801-1-jr...@google.com/T/#m560606260cda41652a7f305a0acff7fc8975d10a). -Jordan

[PATCH v3 bpf-next 6/6] selftests/bpf: Add kernel socket operation tests

2024-04-29 Thread Jordan Rife
This patch creates two sets of sock_ops that call out to the SYSCALL hooks in the sock_addr_kern BPF program and uses them to construct test cases for the range of supported operations (kernel_connect(), kernel_bind(), kernel_sendms(), sock_sendmsg(), kernel_getsockname(), kenel_getpeername()). Thi

[PATCH v3 bpf-next 5/6] selftests/bpf: Make sock configurable for each test case

2024-04-29 Thread Jordan Rife
In order to reuse the same test code for both socket system calls (e.g. connect(), bind(), etc.) and kernel socket functions (e.g. kernel_connect(), kernel_bind(), etc.), this patch introduces the "ops" field to sock_addr_test. This field allows each test cases to configure the set of functions use

[PATCH v3 bpf-next 4/6] selftests/bpf: Move IPv4 and IPv6 sockaddr test cases

2024-04-29 Thread Jordan Rife
This patch lays the groundwork for testing IPv4 and IPv6 sockaddr hooks and their interaction with both socket syscalls and kernel functions (e.g. kernel_connect, kernel_bind, etc.). It moves some of the test cases from the old-style bpf/test_sock_addr.c self test into the sock_addr prog_test in a

[PATCH v3 bpf-next 3/6] selftests/bpf: Implement BPF programs for kernel socket operations

2024-04-29 Thread Jordan Rife
This patch lays out a set of SYSCALL programs that can be used to invoke the socket operation kfuncs in bpf_testmod, allowing a test program to manipulate kernel socket operations from userspace. Signed-off-by: Jordan Rife --- .../selftests/bpf/progs/sock_addr_kern.c | 65 ++

[PATCH v3 bpf-next 2/6] selftests/bpf: Implement socket kfuncs for bpf_testmod

2024-04-29 Thread Jordan Rife
This patch adds a set of kfuncs to bpf_testmod that can be used to manipulate a socket from kernel space. Signed-off-by: Jordan Rife --- .../selftests/bpf/bpf_testmod/bpf_testmod.c | 255 ++ .../bpf/bpf_testmod/bpf_testmod_kfunc.h | 27 ++ 2 files changed, 282 insertions

[PATCH v3 bpf-next 1/6] selftests/bpf: Fix bind program for big endian systems

2024-04-29 Thread Jordan Rife
Without this fix, the bind4 and bind6 programs will reject bind attempts on big endian systems. This patch ensures that CI tests pass for the s390x architecture. Signed-off-by: Jordan Rife --- .../testing/selftests/bpf/progs/bind4_prog.c | 18 ++ .../testing/selftests/bpf/progs/

[PATCH v3 bpf-next 0/6] selftests/bpf: Add sockaddr tests for kernel networking

2024-04-29 Thread Jordan Rife
This patch series adds test coverage for BPF sockaddr hooks and their interactions with kernel socket functions (i.e. kernel_bind(), kernel_connect(), kernel_sendmsg(), sock_sendmsg(), kernel_getpeername(), and kernel_getsockname()) while also rounding out IPv4 and IPv6 sockaddr hook coverage in pr

Re: [PATCH] kunit: Cover 'assert.c' with tests

2024-04-29 Thread Rae Moar
On Sat, Apr 27, 2024 at 6:04 PM Ivan Orlov wrote: > > There are multiple assertion formatting functions in the `assert.c` > file, which are not covered with tests yet. Implement the KUnit test > for these functions. > > The test consists of 11 test cases for the following functions: > > 1) 'is_lit

[PATCH v2] selftests/vDSO: Explicit unsigned char conversion for elf_hash

2024-04-29 Thread Edward Liaw
Fixes clang compilation warnings by adding explicit unsigned conversion: parse_vdso.c:206:22: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]

Re: [PATCH] KVM: selftests: Make monitor_mwait require MONITOR/MWAIT feature

2024-04-29 Thread Sean Christopherson
On Thu, 11 Apr 2024 14:02:37 -0700, Zide Chen wrote: > If this feature is not supported or is disabled by IA32_MISC_ENABLE on > the host, executing MONITOR or MWAIT instruction from the guest doesn't > cause monitor/mwait VM exits, but a #UD. > > So, we need to skip this test if CPUID.01H:ECX[3] i

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-29 Thread Andrii Nakryiko
On Sun, Apr 28, 2024 at 8:15 AM Xu Kuohai wrote: > > On 4/27/2024 4:36 AM, Andrii Nakryiko wrote: > > On Tue, Apr 23, 2024 at 7:26 PM Xu Kuohai wrote: > >> > >> On 4/24/2024 5:55 AM, Yonghong Song wrote: > >>> > >>> On 4/20/24 1:33 AM, Xu Kuohai wrote: > On 4/20/2024 7:00 AM, Eduard Zingerma

Re: [PATCH] KVM: selftests: Avoid assuming "sudo" exists

2024-04-29 Thread Sean Christopherson
On Mon, 15 Apr 2024 14:43:54 +, Brendan Jackman wrote: > I ran into a failure running this test on a minimal rootfs. > > Can be fixed by just skipping the "sudo" in case we are already root. Applied to kvm-x86 selftests, thanks! [1/1] KVM: selftests: Avoid assuming "sudo" exists https:

Re: [PATCH][next] KVM: selftests: Remove second semicolon

2024-04-29 Thread Sean Christopherson
On Fri, 15 Mar 2024 09:36:29 +, Colin Ian King wrote: > There is a statement with two semicolons. Remove the second one, it > is redundant. Applied to kvm-x86 selftests, thanks! [1/1] KVM: selftests: Remove second semicolon https://github.com/kvm-x86/linux/commit/d85465f2773d -- https:

[PATCH] selftests/vDSO: Explicit unsigned char conversion for elf_hash

2024-04-29 Thread Edward Liaw
Fixes clang compilation warnings by adding explicit unsigned conversion: parse_vdso.c:206:22: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]

[PATCH] selftests/vDSO: Fix assignment in condition without parentheses

2024-04-29 Thread Edward Liaw
Fixes clang compiler warnings by adding parentheses: parse_vdso.c:65:9: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] if (g = h & 0xf000) ~~^~~~ parse_vdso.c:65:9: note: place parentheses around th

Re: [PATCH bpf-next v5 1/2] selftests/bpf: Check recv lengths in test_sockmap

2024-04-29 Thread Jakub Sitnicki
On Tue, Apr 23, 2024 at 06:26 PM +08, Geliang Tang wrote: > From: Geliang Tang > > The values of recv and recvp in msg_loop may be negative, so it's necessary > to check if they are positive before using them. > > Fixes: 16962b2404ac ("bpf: sockmap, add selftests") > Fixes: 753fb2ee0934 ("bpf: soc

RE: [PATCH bpf-next 2/2] selftests/bpf: Free strdup memory in veristat

2024-04-29 Thread John Fastabend
Geliang Tang wrote: > From: Geliang Tang > > The strdup() function returns a pointer to a new string which is a > duplicate of the string "input". Memory for the new string is obtained > with malloc(), and need to be freed with free(). > > This patch adds these missing "free(input)" in parse_sta

RE: [PATCH bpf-next 1/2] selftests/bpf: Free strdup memory in test_sockmap

2024-04-29 Thread John Fastabend
Geliang Tang wrote: > From: Geliang Tang > > The strdup() function returns a pointer to a new string which is a > duplicate of the string "ptr". Memory for the new string is obtained > with malloc(), and need to be freed with free(). > > This patch adds these missing "free(ptr)" in check_whiteli

Re: [PATCH V3] KVM: selftests: Add a new option to rseq_test

2024-04-29 Thread Sean Christopherson
On Tue, Apr 16, 2024, Zide Chen wrote: > Currently, the migration worker delays 1-10 us, assuming that one > KVM_RUN iteration only takes a few microseconds. But if the CPU low > power wakeup latency is large enough, for example, hundreds or even > thousands of microseconds deep C-state exit laten

[PATCH v3 2/9] selftests/landlock: Fix FS tests when run on a private mount point

2024-04-29 Thread Mickaël Salaün
According to the test environment, the mount point of the test's working directory may be shared or not, which changes the visibility of the nested "tmp" mount point for the test's parent process calling umount("tmp"). This was spotted while running tests in containers [1], where mount points are

[PATCH v3 5/9] selftests/landlock: Do not allocate memory in fixture data

2024-04-29 Thread Mickaël Salaün
Do not allocate self->dir_path in the test process because this would not be visible in the FIXTURE_TEARDOWN() process when relying on fork()/clone3() instead of vfork(). This change is required for a following commit removing vfork() call to not break the layout3_fs.* test cases. Cc: Günther Noa

[PATCH v3 9/9] selftests/harness: Fix vfork() side effects

2024-04-29 Thread Mickaël Salaün
Setting the time namespace with CLONE_NEWTIME returns -EUSERS if the calling thread shares memory with another thread (because of the shared vDSO), which is the case when it is created with vfork(). Fix pidfd_setns_test by replacing test harness's vfork() call with a clone3() call with CLONE_VFORK

[PATCH v3 3/9] selftests/harness: Fix fixture teardown

2024-04-29 Thread Mickaël Salaün
Make sure fixture teardowns are run when test cases failed, including when _metadata->teardown_parent is set to true. Make sure only one fixture teardown is run per test case, handling the case where the test child forks. Cc: Jakub Kicinski Cc: Shengyu Li Cc: Shuah Khan Fixes: 72d7cb5c190b ("s

[PATCH v3 8/9] selftests/harness: Share _metadata between forked processes

2024-04-29 Thread Mickaël Salaün
Unconditionally share _metadata between all forked processes, which enables to actually catch errors which were previously ignored. This is required for a following commit replacing vfork() with clone3() and CLONE_VFORK (i.e. not sharing the full memory) . It should also be useful to share _metad

[PATCH v3 7/9] selftests/pidfd: Fix wrong expectation

2024-04-29 Thread Mickaël Salaün
Replace a wrong EXPECT_GT(self->child_pid_exited, 0) with EXPECT_GE(), which will be actually tested on the parent and child sides with a following commit. Cc: Christian Brauner Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240429191911.2

[PATCH v3 6/9] selftests/harness: Constify fixture variants

2024-04-29 Thread Mickaël Salaün
FIXTURE_VARIANT_ADD() types are passed as const pointers to FIXTURE_TEARDOWN(). Make that explicit by constifying the variants declarations. Cc: Shuah Khan Cc: Will Drewry Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240429191911.2552580-7-...@digikod

[PATCH v3 1/9] selftests/pidfd: Fix config for pidfd_setns_test

2024-04-29 Thread Mickaël Salaün
Required by switch_timens() to open /proc/self/ns/time_for_children. CONFIG_GENERIC_VDSO_TIME_NS is not available on UML, so pidfd_setns_test cannot be run successfully on this architecture. Cc: Christian Brauner Cc: Shuah Khan Fixes: 2b40c5db73e2 ("selftests/pidfd: add pidfd setns tests") Revi

[PATCH v3 4/9] selftests/harness: Fix interleaved scheduling leading to race conditions

2024-04-29 Thread Mickaël Salaün
Fix a race condition when running several FIXTURE_TEARDOWN() managing the same resource. This fixes a race condition in the Landlock file system tests when creating or unmounting the same directory. Using clone3() with CLONE_VFORK guarantees that the child and grandchild test processes are sequen

[PATCH v3 0/9] Fix Kselftest's vfork() side effects

2024-04-29 Thread Mickaël Salaün
Hi, As reported by Kernel Test Robot [1], some pidfd tests fail. This is due to the use of vfork() which introduced some side effects. Similarly, while making it more generic, a previous commit made some Landlock file system tests flaky, and subject to the host's file system mount configuration.

Re: [PATCH v2 4/9] selftests/harness: Fix interleaved scheduling leading to race conditions

2024-04-29 Thread Mickaël Salaün
On Mon, Apr 29, 2024 at 10:16:47AM -0700, Jakub Kicinski wrote: > On Mon, 29 Apr 2024 08:52:36 -0700 Kees Cook wrote: > > > +/* Wait for the child process to end but without sharing memory mapping. > > > */ > > > +static pid_t __attribute__((__unused__)) clone3_vfork(void) > > > > Why "unused"?

Re: [PATCH v2 bpf-next 4/6] selftests/bpf: Add IPv4 and IPv6 sockaddr test cases

2024-04-29 Thread Martin KaFai Lau
On 4/28/24 10:47 AM, Jordan Rife wrote: Also, all this setup (and test) has to be done in a new netns. Anything blocking the kfunc in patch 2 using the current task netns instead of the init_net? Add nodad to the "ip -6 addr add...". just in case it may add unnecessary delay. This interface/addre

Re: [PATCH v2 4/9] selftests/harness: Fix interleaved scheduling leading to race conditions

2024-04-29 Thread Jakub Kicinski
On Mon, 29 Apr 2024 08:52:36 -0700 Kees Cook wrote: > > +/* Wait for the child process to end but without sharing memory mapping. */ > > +static pid_t __attribute__((__unused__)) clone3_vfork(void) > > Why "unused"? Right, static inline is enough

[PATCH] Documentation: kselftest: fix codeblock

2024-04-29 Thread Yo-Jung (Leo) Lin
Add extra colon to mark command in the next paragraph as codeblock Signed-off-by: Yo-Jung (Leo) Lin <0xf...@gmail.com> --- Documentation/dev-tools/kselftest.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kse

Re: [PATCH net-next 6/6] selftests: drv-net-hw: add test for memory allocation failures with page pool

2024-04-29 Thread Jakub Kicinski
On Mon, 29 Apr 2024 11:02:51 -0400 Willem de Bruijn wrote: > The only interesting points so far are the use of deploy (which I > assume you have on some internal patch already) Yup, they need a touch more cleaning up but the PSP tests use it. > and that with bkg would not fail the test if the bac

Re: [PATCH net-next 0/6] selftests: net: page_poll allocation error injection

2024-04-29 Thread Jakub Kicinski
On Mon, 29 Apr 2024 17:01:55 +0200 Andrew Lunn wrote: > > I'm not super happy with the traffic generation using iperf3, > > my initial approach was to use mausezahn. But it turned out to be > > 5x slower in terms of PPS. Hopefully this is good enough for now. > > How important is PPS? In order t

Re: [PATCH net-next 6/6] selftests: drv-net-hw: add test for memory allocation failures with page pool

2024-04-29 Thread Jakub Kicinski
On Mon, 29 Apr 2024 17:12:29 +0200 Andrew Lunn wrote: > > # ./drivers/net/hw/pp_alloc_fail.py > > KTAP version 1 > > 1..1 > > # ethtool -G change retval: success > > ok 1 pp_alloc_fail.test_pp_alloc > > # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 > > If i'm reading the tra

Re: [PATCH v2 9/9] selftests/harness: Fix vfork() side effects

2024-04-29 Thread Kees Cook
On Mon, Apr 29, 2024 at 03:09:31PM +0200, Mickaël Salaün wrote: > Setting the time namespace with CLONE_NEWTIME returns -EUSERS if the > calling thread shares memory with another thread (because of the shared > vDSO), which is the case when it is created with vfork(). > > Fix pidfd_setns_test by r

Re: [PATCH v2 8/9] selftests/harness: Share _metadata between forked processes

2024-04-29 Thread Kees Cook
On Mon, Apr 29, 2024 at 03:09:30PM +0200, Mickaël Salaün wrote: > Unconditionally share _metadata between all forked processes, which > enables to actually catch errors which were previously ignored. > > This is required for a following commit replacing vfork() with clone3() > and CLONE_VFORK (i.e

Re: [PATCH v2 7/9] selftests/pidfd: Fix wrong expectation

2024-04-29 Thread Kees Cook
On Mon, Apr 29, 2024 at 03:09:29PM +0200, Mickaël Salaün wrote: > Replace a wrong EXPECT_GT(self->child_pid_exited, 0) with EXPECT_GE(), > which will be actually tested on the parent and child sides with a > following commit. > > Cc: Christian Brauner > Cc: Kees Cook > Cc: Shuah Khan > Signed-o

Re: [PATCH bpf-next 2/2] selftests/bpf: Free strdup memory in veristat

2024-04-29 Thread Yonghong Song
On 4/29/24 12:07 AM, Geliang Tang wrote: From: Geliang Tang The strdup() function returns a pointer to a new string which is a duplicate of the string "input". Memory for the new string is obtained with malloc(), and need to be freed with free(). This patch adds these missing "free(input)" i

Re: [PATCH bpf-next 1/2] selftests/bpf: Free strdup memory in test_sockmap

2024-04-29 Thread Yonghong Song
On 4/29/24 12:07 AM, Geliang Tang wrote: From: Geliang Tang The strdup() function returns a pointer to a new string which is a duplicate of the string "ptr". Memory for the new string is obtained with malloc(), and need to be freed with free(). This patch adds these missing "free(ptr)" in ch

Re: [PATCH v2 6/9] selftests/harness: Constify fixture variants

2024-04-29 Thread Kees Cook
On Mon, Apr 29, 2024 at 03:09:28PM +0200, Mickaël Salaün wrote: > FIXTURE_VARIANT_ADD() types are passed as const pointers to > FIXTURE_TEARDOWN(). Make that explicit by constifying the variants > declarations. > > Cc: Kees Cook > Cc: Shuah Khan > Cc: Will Drewry > Signed-off-by: Mickaël Salaü

Re: [PATCH v2 5/9] selftests/landlock: Do not allocate memory in fixture data

2024-04-29 Thread Kees Cook
On Mon, Apr 29, 2024 at 03:09:27PM +0200, Mickaël Salaün wrote: > Do not allocate self->dir_path in the test process because this would > not be visible in the FIXTURE_TEARDOWN() process when relying on > fork()/clone3() instead of vfork(). > > This change is required for a following commit removi

Re: [PATCH v2 4/9] selftests/harness: Fix interleaved scheduling leading to race conditions

2024-04-29 Thread Kees Cook
On Mon, Apr 29, 2024 at 03:09:26PM +0200, Mickaël Salaün wrote: > Fix a race condition when running several FIXTURE_TEARDOWN() managing > the same resource. This fixes a race condition in the Landlock file > system tests when creating or unmounting the same directory. > > Using clone3() with CLON

Re: [PATCH net-next 6/6] selftests: drv-net-hw: add test for memory allocation failures with page pool

2024-04-29 Thread Andrew Lunn
On Fri, Apr 26, 2024 at 04:23:59PM -0700, Jakub Kicinski wrote: > Bugs in memory allocation failure paths are quite common. > Add a test exercising those paths based on qstat and page pool > failure hook. > > Running on bnxt: > > # ./drivers/net/hw/pp_alloc_fail.py > KTAP version 1 > 1..1 >

[PATCH v4 09/11] riscv: hwprobe: export Zcmop ISA extension

2024-04-29 Thread Clément Léger
Export Zcmop ISA extension through hwprobe. Signed-off-by: Clément Léger --- Documentation/arch/riscv/hwprobe.rst | 4 arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.r

[PATCH v4 11/11] KVM: riscv: selftests: Add Zcmop extension to get-reg-list test

2024-04-29 Thread Clément Léger
The KVM RISC-V allows Zcmop extension for Guest/VM so add this extension to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/se

[PATCH v4 10/11] RISC-V: KVM: Allow Zcmop extension for Guest/VM

2024-04-29 Thread Clément Léger
Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zcmop extension for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files cha

[PATCH v4 08/11] riscv: add ISA extension parsing for Zcmop

2024-04-29 Thread Clément Léger
Add parsing for Zcmop ISA extension which was ratified in commit b854a709c00 ("Zcmop is ratified/1.0") of the riscv-isa-manual. Signed-off-by: Clément Léger --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/i

[PATCH v4 07/11] dt-bindings: riscv: add Zcmop ISA extension description

2024-04-29 Thread Clément Léger
Add description for the Zcmop (Compressed May-Be-Operations) ISA extension which was ratified in commit c732a4f39a4 ("Zcmop is ratified/1.0") of the riscv-isa-manual. Signed-off-by: Clément Léger Acked-by: Conor Dooley --- .../devicetree/bindings/riscv/extensions.yaml| 12

[PATCH v4 06/11] KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test

2024-04-29 Thread Clément Léger
The KVM RISC-V allows Zca, Zcf, Zcd and Zcb extensions for Guest/VM so add these extensions to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 16 1 file changed, 16 insertions(

[PATCH v4 05/11] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM

2024-04-29 Thread Clément Léger
Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zca, Zcf, Zcd and Zcb extensions for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 4 arch/riscv/kvm/vcpu_onereg.c

[PATCH v4 04/11] riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions

2024-04-29 Thread Clément Léger
Export Zca, Zcf, Zcd and Zcb ISA extension through hwprobe. Signed-off-by: Clément Léger --- Documentation/arch/riscv/hwprobe.rst | 20 arch/riscv/include/uapi/asm/hwprobe.h | 4 arch/riscv/kernel/sys_hwprobe.c | 4 3 files changed, 28 insertions(+) diff

[PATCH v4 03/11] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb

2024-04-29 Thread Clément Léger
The Zc* standard extension for code reduction introduces new extensions. This patch adds support for Zca, Zcf, Zcd and Zcb. Zce, Zcmt and Zcmp are left out of this patch since they are targeting microcontrollers/ embedded CPUs instead of application processors. Signed-off-by: Clément Léger --- a

[PATCH v4 02/11] riscv: add ISA extensions validation

2024-04-29 Thread Clément Léger
Since a few extensions (Zicbom/Zicboz) already needs validation and future ones will need it as well (Zc*) add a validate() callback to struct riscv_isa_ext_data. This require to rework the way extensions are parsed and split it in two phases. First phase is isa string or isa extension list parsing

[PATCH v4 01/11] dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description

2024-04-29 Thread Clément Léger
Add description for Zca, Zcf, Zcd and Zcb extensions which are part the Zc* standard extensions for code size reduction. Additional validation rules are added since Zcb depends on Zca, Zcf, depends on Zca and F, Zcd depends on Zca and D and finally, Zcf can not be present on rv64. Signed-off-by: C

[PATCH v4 00/11] Add support for a few Zc* extensions as well as Zcmop

2024-04-29 Thread Clément Léger
Add support for (yet again) more RVA23U64 missing extensions. Add support for Zcmop, Zca, Zcf, Zcd and Zcb extensions isa string parsing, hwprobe and kvm support. Zce, Zcmt and Zcmp extensions have been left out since they target microcontrollers/embedded CPUs and are not needed by RVA23U64. Since

Re: [PATCH net-next 6/6] selftests: drv-net-hw: add test for memory allocation failures with page pool

2024-04-29 Thread Willem de Bruijn
Jakub Kicinski wrote: > On Sat, 27 Apr 2024 09:49:28 -0400 Willem de Bruijn wrote: > > Eventually probably want a more generic fault injection class. > > > > And for both fault injection and background traffic the with object > > construct to ensure cleanup in all cases. > > > > Maybe even the sa

Re: [PATCH net-next 0/6] selftests: net: page_poll allocation error injection

2024-04-29 Thread Andrew Lunn
> I'm not super happy with the traffic generation using iperf3, > my initial approach was to use mausezahn. But it turned out to be > 5x slower in terms of PPS. Hopefully this is good enough for now. How important is PPS? In order to get 'Maintained' status, automotive vendors are going to want to

Re: [PATCH net-next 6/6] selftests: drv-net-hw: add test for memory allocation failures with page pool

2024-04-29 Thread Jakub Kicinski
On Sat, 27 Apr 2024 09:49:28 -0400 Willem de Bruijn wrote: > Eventually probably want a more generic fault injection class. > > And for both fault injection and background traffic the with object > construct to ensure cleanup in all cases. > > Maybe even the same for ethtool, as ip and ethtool co

[PATCH net-next v2 6/6] selftests: drv-net-hw: add test for memory allocation failures with page pool

2024-04-29 Thread Jakub Kicinski
Bugs in memory allocation failure paths are quite common. Add a test exercising those paths based on qstat and page pool failure hook. Running on bnxt: # ./drivers/net/hw/pp_alloc_fail.py KTAP version 1 1..1 # ethtool -G change retval: success ok 1 pp_alloc_fail.test_pp_alloc # Totals

[PATCH net-next v2 5/6] selftests: drv-net: support generating iperf3 load

2024-04-29 Thread Jakub Kicinski
While we are not very interested in testing performance it's useful to be able to generate a lot of traffic. iperf is the simplest way of getting relatively high PPS. Reviewed-by: Willem de Bruijn Signed-off-by: Jakub Kicinski --- v2: - fix import order in __init__.py --- .../selftests/drivers

[PATCH net-next v2 4/6] selftests: net: py: avoid all ports < 10k

2024-04-29 Thread Jakub Kicinski
When picking TCP ports to use, avoid all below 10k. This should lower the chance of collision or running afoul whatever random policies may be on the host. Reviewed-by: Willem de Bruijn Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/lib/py/utils.py | 2 +- 1 file changed, 1 inser

[PATCH net-next v2 3/6] selftests: net: py: extract tool logic

2024-04-29 Thread Jakub Kicinski
The main use of the ip() wrapper over cmd() is that it can parse JSON. cmd("ip -j link show") will return stdout as a string, and test has to call json.loads(). With ip("link show", json=True) the return value will be already parsed. More tools (ethtool, bpftool etc.) support the --json switch. To

[PATCH net-next v2 2/6] selftests: drv-net-hw: support using Python from net hw tests

2024-04-29 Thread Jakub Kicinski
We created a separate directory for HW-only tests, recently. Glue in the Python test library there, Python is a bit annoying when it comes to using library code located "lower" in the directory structure. Reuse the Env class, but let tests require non-nsim setup. Reviewed-by: Willem de Bruijn Si

[PATCH net-next v2 1/6] net: page_pool: support error injection

2024-04-29 Thread Jakub Kicinski
Because of caching / recycling using the general page allocation failures to induce errors in page pool allocation is very hard. Add direct error injection support to page_pool_alloc_pages(). Reviewed-by: Willem de Bruijn Signed-off-by: Jakub Kicinski --- CC: h...@kernel.org CC: ilias.apalodi...

[PATCH net-next v2 0/6] selftests: net: page_poll allocation error injection

2024-04-29 Thread Jakub Kicinski
Add a test for exercising driver memory allocation failure paths. page pool is a bit tricky to inject errors into at the page allocator level because of the bulk alloc and recycling, so add explicit error injection support "in front" of the caches. Add a test to exercise that using only the standa

Re: [PATCH net-next 3/6] selftests: net: py: extract tool logic

2024-04-29 Thread Jakub Kicinski
On Sat, 27 Apr 2024 09:51:01 -0400 Willem de Bruijn wrote: > > +def ip(args, json=None, ns=None, host=None): > > +if ns: > > +args = '-netns ' + ns + " " + args > > Minor: inconsistent use of single and double comma strings. Maybe > there's a reasoning that I'm just missing. I also

Re: [PATCH 2/3] selftest/powerpc: Add flags.mk to support pmu buildable

2024-04-29 Thread Michael Ellerman
Madhavan Srinivasan writes: > When running `make -C powerpc/pmu run_tests` from top level selftests > directory, currently this error is being reported > > make: Entering directory > '/home/maddy/linux/tools/testing/selftests/powerpc/pmu' > Makefile:40: warning: overriding recipe for target 'emit

[PATCH v2 1/9] selftests/pidfd: Fix config for pidfd_setns_test

2024-04-29 Thread Mickaël Salaün
Required by switch_timens() to open /proc/self/ns/time_for_children. CONFIG_GENERIC_VDSO_TIME_NS is not available on UML, so pidfd_setns_test cannot be run successfully on this architecture. Cc: Christian Brauner Cc: Shuah Khan Fixes: 2b40c5db73e2 ("selftests/pidfd: add pidfd setns tests") Revi

[PATCH v2 9/9] selftests/harness: Fix vfork() side effects

2024-04-29 Thread Mickaël Salaün
Setting the time namespace with CLONE_NEWTIME returns -EUSERS if the calling thread shares memory with another thread (because of the shared vDSO), which is the case when it is created with vfork(). Fix pidfd_setns_test by replacing test harness's vfork() call with a clone3() call with CLONE_VFORK

[PATCH v2 6/9] selftests/harness: Constify fixture variants

2024-04-29 Thread Mickaël Salaün
FIXTURE_VARIANT_ADD() types are passed as const pointers to FIXTURE_TEARDOWN(). Make that explicit by constifying the variants declarations. Cc: Kees Cook Cc: Shuah Khan Cc: Will Drewry Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240429130931.2394118-7-...@digikod.net ---

[PATCH v2 4/9] selftests/harness: Fix interleaved scheduling leading to race conditions

2024-04-29 Thread Mickaël Salaün
Fix a race condition when running several FIXTURE_TEARDOWN() managing the same resource. This fixes a race condition in the Landlock file system tests when creating or unmounting the same directory. Using clone3() with CLONE_VFORK guarantees that the child and grandchild test processes are sequen

[PATCH v2 7/9] selftests/pidfd: Fix wrong expectation

2024-04-29 Thread Mickaël Salaün
Replace a wrong EXPECT_GT(self->child_pid_exited, 0) with EXPECT_GE(), which will be actually tested on the parent and child sides with a following commit. Cc: Christian Brauner Cc: Kees Cook Cc: Shuah Khan Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240429130931.2394118-8-

[PATCH v2 5/9] selftests/landlock: Do not allocate memory in fixture data

2024-04-29 Thread Mickaël Salaün
Do not allocate self->dir_path in the test process because this would not be visible in the FIXTURE_TEARDOWN() process when relying on fork()/clone3() instead of vfork(). This change is required for a following commit removing vfork() call to not break the layout3_fs.* test cases. Cc: Günther Noa

[PATCH v2 8/9] selftests/harness: Share _metadata between forked processes

2024-04-29 Thread Mickaël Salaün
Unconditionally share _metadata between all forked processes, which enables to actually catch errors which were previously ignored. This is required for a following commit replacing vfork() with clone3() and CLONE_VFORK (i.e. not sharing the full memory) . It should also be useful to share _metad

[PATCH v2 3/9] selftests/harness: Fix fixture teardown

2024-04-29 Thread Mickaël Salaün
Make sure fixture teardowns are run when test cases failed, including when _metadata->teardown_parent is set to true. Make sure only one fixture teardown is run per test case, handling the case where the test child forks. Cc: Jakub Kicinski Cc: Shengyu Li Cc: Shuah Khan Fixes: 72d7cb5c190b ("s

[PATCH v2 2/9] selftests/landlock: Fix FS tests when run on a private mount point

2024-04-29 Thread Mickaël Salaün
According to the test environment, the mount point of the test's working directory may be shared or not, which changes the visibility of the nested "tmp" mount point for the test's parent process calling umount("tmp"). This was spotted while running tests in containers [1], where mount points are

  1   2   >