[PATCH v5 17/17] selftests: riscv: Support xtheadvector in vector tests

2024-05-02 Thread Charlie Jenkins
Extend existing vector tests to be compatible with the xtheadvector instruction set. Signed-off-by: Charlie Jenkins --- .../selftests/riscv/vector/v_exec_initval_nolibc.c | 23 -- tools/testing/selftests/riscv/vector/v_helpers.c | 17 +++- tools/testing/selftests/riscv/vector/v_helpers.h

[PATCH v5 16/17] selftests: riscv: Fix vector tests

2024-05-02 Thread Charlie Jenkins
Overhaul the riscv vector tests to use kselftest_harness to help the test cases correctly report the results and decouple the individual test cases from each other. With this refactoring, only run the test cases is vector is reported and properly report the test case as skipped otherwise. The

[PATCH v5 15/17] riscv: hwprobe: Document thead vendor extensions and xtheadvector extension

2024-05-02 Thread Charlie Jenkins
Document support for thead vendor extensions using the key RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0 and xtheadvector extension using the key RISCV_HWPROBE_VENDOR_EXT_XTHEADVECTOR. Signed-off-by: Charlie Jenkins --- Documentation/arch/riscv/hwprobe.rst | 10 ++ 1 file changed, 10

[PATCH v5 14/17] riscv: hwprobe: Add thead vendor extension probing

2024-05-02 Thread Charlie Jenkins
Add a new hwprobe key "RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0" which allows userspace to probe for the new RISCV_ISA_VENDOR_EXT_XTHEADVECTOR vendor extension. This new key will allow userspace code to probe for which thead vendor extensions are supported. This API is modeled to be consistent with

[PATCH v5 13/17] riscv: vector: Support xtheadvector save/restore

2024-05-02 Thread Charlie Jenkins
Use alternatives to add support for xtheadvector vector save/restore routines. Signed-off-by: Charlie Jenkins --- arch/riscv/Kconfig.vendor | 13 ++ arch/riscv/include/asm/csr.h | 6 + arch/riscv/include/asm/switch_to.h | 2 +- arch/riscv/include/asm/vector.h

[PATCH v5 11/17] riscv: csr: Add CSR encodings for VCSR_VXRM/VCSR_VXSAT

2024-05-02 Thread Charlie Jenkins
The VXRM vector csr for xtheadvector has an encoding of 0xa and VXSAT has an encoding of 0x9. Co-developed-by: Heiko Stuebner Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/csr.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/csr.h

[PATCH v5 10/17] RISC-V: define the elements of the VCSR vector CSR

2024-05-02 Thread Charlie Jenkins
From: Heiko Stuebner The VCSR CSR contains two elements VXRM[2:1] and VXSAT[0]. Define constants for those to access the elements in a readable way. Acked-by: Guo Ren Reviewed-by: Conor Dooley Signed-off-by: Heiko Stuebner Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/csr.h |

[PATCH v5 09/17] riscv: Convert xandespmu to use the vendor extension framework

2024-05-02 Thread Charlie Jenkins
Migrate xandespmu out of riscv_isa_ext and into a new Andes-specific vendor namespace. Signed-off-by: Charlie Jenkins Reviewed-by: Conor Dooley --- arch/riscv/Kconfig.vendor| 12 arch/riscv/errata/andes/errata.c | 2 ++

[PATCH v5 08/17] riscv: cpufeature: Extract common elements from extension checking

2024-05-02 Thread Charlie Jenkins
The __riscv_has_extension_likely() and __riscv_has_extension_unlikely() functions from the vendor_extensions.h can be used to simplify the standard extension checking code as well. Migrate those functions to cpufeature.h and reorganize the code in the file to use the functions. Signed-off-by:

[PATCH v5 07/17] riscv: Introduce vendor variants of extension helpers

2024-05-02 Thread Charlie Jenkins
Vendor extensions are maintained in per-vendor structs (separate from standard extensions which live in riscv_isa). Create vendor variants for the existing extension helpers to interface with the riscv_isa_vendor bitmaps. Signed-off-by: Charlie Jenkins Reviewed-by: Conor Dooley ---

[PATCH v5 06/17] riscv: Add vendor extensions to /proc/cpuinfo

2024-05-02 Thread Charlie Jenkins
All of the supported vendor extensions that have been listed in riscv_isa_vendor_ext_list can be exported through /proc/cpuinfo. Signed-off-by: Charlie Jenkins --- arch/riscv/kernel/cpu.c | 35 --- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git

[PATCH v5 05/17] riscv: Extend cpufeature.c to detect vendor extensions

2024-05-02 Thread Charlie Jenkins
Separate vendor extensions out into one struct per vendor instead of adding vendor extensions onto riscv_isa_ext. Add a hidden config RISCV_ISA_VENDOR_EXT to conditionally include this code. The xtheadvector vendor extension is added using these changes. Signed-off-by: Charlie Jenkins ---

[PATCH v5 04/17] riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree

2024-05-02 Thread Charlie Jenkins
The D1/D1s SoCs support xtheadvector so it can be included in the devicetree. Also include vlenb for the cpu. Signed-off-by: Charlie Jenkins --- arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v5 03/17] riscv: vector: Use vlenb from DT

2024-05-02 Thread Charlie Jenkins
If vlenb is provided in the device tree, prefer that over reading the vlenb csr. Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/cpufeature.h | 2 ++ arch/riscv/kernel/cpufeature.c | 43 + arch/riscv/kernel/vector.c | 12 ++-

[PATCH v5 02/17] dt-bindings: riscv: cpus: add a vlen register length property

2024-05-02 Thread Charlie Jenkins
From: Conor Dooley Add a property analogous to the vlenb CSR so that software can detect the vector length of each CPU prior to it being brought online. Currently software has to assume that the vector length read from the boot CPU applies to all possible CPUs. On T-Head CPUs implementing

[PATCH v5 01/17] dt-bindings: riscv: Add xtheadvector ISA extension description

2024-05-02 Thread Charlie Jenkins
The xtheadvector ISA extension is described on the T-Head extension spec Github page [1] at commit 95358cb2cca9. Link: https://github.com/T-head-Semi/thead-extension-spec/blob/95358cb2cca9489361c61d335e03d3134b14133f/xtheadvector.adoc [1] Signed-off-by: Charlie Jenkins Reviewed-by: Conor

[PATCH v5 00/17] riscv: Support vendor extensions and xtheadvector

2024-05-02 Thread Charlie Jenkins
This patch series ended up much larger than expected, please bear with me! The goal here is to support vendor extensions, starting at probing the device tree and ending with reporting to userspace. The main design objective was to allow vendors to operate independently of each other. This has

[PATCH] selftests/vDSO: fix clang build errors and warnings

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...there are several warnings, and an error. This fixes all of those and allows these

[PATCH 3/3] selftests/futex: pass _GNU_SOURCE without a value to the compiler

2024-05-02 Thread John Hubbard
It's slightly better to set _GNU_SOURCE in the source code, but if one must do it via the compiler invocation, then the best way to do so is this: $(CC) -D_GNU_SOURCE= ...because otherwise, if this form is used: $(CC) -D_GNU_SOURCE ...then that leads the compiler to set a value, as if

[PATCH 2/3] selftests/futex: don't pass a const char* to asprintf(3)

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang issues a warning, because test_name is passed into asprintf(3), which then

[PATCH 0/3] selftests/futex: clang-inspired fixes

2024-05-02 Thread John Hubbard
Hi, Here's a few fixes that are part of my effort to get all selftests building cleanly under clang. Plus one that I noticed by inspection. Enjoy! thanks, John Hubbard John Hubbard (3): selftests/futex: don't redefine .PHONY targets (all, clean) selftests/futex: don't pass a const char* to

[PATCH 1/3] selftests/futex: don't redefine .PHONY targets (all, clean)

2024-05-02 Thread John Hubbard
The .PHONY targets "all" and "clean" are both defined in the file that is included in the very next line: ../lib.mk. Signed-off-by: John Hubbard --- tools/testing/selftests/futex/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/futex/Makefile

[PATCH 4/4] selftests/cgroup: fix uninitialized variables in test_zswap.c

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang finds and warning about some uninitialized variables. Fix these by

[PATCH 3/4] selftests/cgroup: cpu_hogger init: use {} instead of {NULL}

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang generates warning here, because struct cpu_hogger has multiple fields, and

[PATCH 2/4] selftests/cgroup: fix clang warnings: uninitialized fd variable

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang warns about fd being used uninitialized, in test_memcg_reclaim()'s error

[PATCH 1/4] selftests/cgroup: fix clang build failures for abs() calls

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang is pickier than gcc, about which version of abs(3) to call, depending on the

[PATCH 0/4] selftests/cgroups: fix clang build failures, warnings

2024-05-02 Thread John Hubbard
Hi, Just a bunch of fixes as part of my work to make selftests build cleanly with clang. Enjoy! thanks, John Hubbard John Hubbard (4): selftests/cgroup: fix clang build failures for abs() calls selftests/cgroup: fix clang warnings: uninitialized fd variable selftests/cgroup: cpu_hogger

[PATCH] selftest/timerns: fix clang build failures for abs() calls

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...then clang warns about mismatches between the expected and required integer length

[PATCH 7/7] selftests/x86: fix printk() format warnings

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang finds and warns about several cases of using the wrong integer size in

[PATCH 6/7] selftests/x86: remove (or use) unused variables and functions

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...quite a few functions are variables are generating "unused" warnings. Fix the

[PATCH 5/7] selftests/x86: avoid -no-pie warnings from clang during compilation

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang warns that -no-pie is "unused during compilation". This occurs because clang

[PATCH 3/7] selftests/x86: build fsgsbase_restore.c with clang

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests Fix this by moving the inline asm to "pure" assembly, in two new files:

[PATCH 4/7] selftests/x86: build sysret_rip.c with clang

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the build fails because clang's inline asm doesn't support all of the features that

[PATCH 2/7] selftests/x86: build test_FISTTP.c with clang

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the build fails because clang inline asm requires size suffixes for instructions,

[PATCH 1/7] selftests/x86: fix Makefile dependencies to work with clang

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the following build failure occurs in selftests/x86: clang: error: cannot

[PATCH 0/7] selftests/x86: fix build errors and warnings found via clang

2024-05-02 Thread John Hubbard
Hi, Just a bunch of build and warnings fixes that show up when building with clang. Some of these depend on each other, so I'm sending them as a series. Enjoy! thanks, John Hubbard John Hubbard (7): selftests/x86: fix Makefile dependencies to work with clang selftests/x86: build

[PATCH] selftests/resctrl: fix clang build warnings related to abs(), labs() calls

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Furthermore, for this particular resctrl directory, my pending fix [2] must also be applied. Once those fixes are in place, then when building with clang, via: make LLVM=1 -C

[PATCH] selftests/resctrl: fix clang build failure: use LOCAL_HDRS

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the following error occurs: clang: error: cannot specify -o when generating

[PATCH] selftests/binderfs: use the Makefile's rules, not Make's implicit rules

2024-05-02 Thread John Hubbard
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the following error occurs: clang: error: cannot specify -o when generating

Re: [PATCH v1 01/10] selftests/sgx: Compile with -D_GNU_SOURCE

2024-05-02 Thread Jarkko Sakkinen
On Wed May 1, 2024 at 2:50 AM EEST, Edward Liaw wrote: > 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced > asprintf into kselftest_harness.h, which is a GNU extension and needs > _GNU_SOURCE to either be defined prior to including headers or with the > -D_GNU_SOURCE flag

[PATCH 0/1] selftest: rtc: Add support rtc alarm content check

2024-05-02 Thread Joseph Jang
In order to make sure SET/GET WAKEUP services as optional patch has been integrated correctly, we have created a shell script to validate /proc/driver/rtc when it is not empty and then check the absence of alarm content in RTC metadata according to the rtc wakealarm is supported or not. Joseph

[PATCH 1/1] selftest: rtc: Add support rtc alarm content check

2024-05-02 Thread Joseph Jang
Some platforms do not support WAKEUP service by default, we use a shell script to check the absence of alarm content in /proc/driver/rtc. The script will validate /proc/driver/rtc when it is not empty and then check if could find alarm content in it according to the rtc wakealarm is supported or

Re: [PATCH net-next] selftests/net: skip partial checksum packets in csum test

2024-05-02 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Wed, 1 May 2024 15:30:22 -0400 you wrote: > From: Willem de Bruijn > > Detect packets with ip_summed CHECKSUM_PARTIAL and skip these. These > should not exist, as the test sends individual packets between two >

Re: [PATCH v4 00/10] clk: Add kunit tests for fixed rate and parent data

2024-05-02 Thread Stephen Boyd
Quoting David Gow (2024-05-01 01:08:11) > > Thanks very much. I'm about halfway through reviewing these, and I > like them a lot so far. > > Most of my thoughts are just naming ideas. I fear some of them may be > the reverse of previous suggestions, as we've since landed the KUnit > device

Re: [PATCH v4 05/10] platform: Add test managed platform_device/driver APIs

2024-05-02 Thread Stephen Boyd
Quoting David Gow (2024-05-01 00:55:46) > On Tue, 23 Apr 2024 at 07:24, Stephen Boyd wrote: > > diff --git a/Documentation/dev-tools/kunit/api/platformdevice.rst > > b/Documentation/dev-tools/kunit/api/platformdevice.rst > > new file mode 100644 > > index ..b228fb6558c2 > > ---

Re: [PATCH v4 01/10] of: Add test managed wrappers for of_overlay_apply()/of_node_put()

2024-05-02 Thread Stephen Boyd
Quoting David Gow (2024-05-01 00:55:10) > On Tue, 23 Apr 2024 at 07:24, Stephen Boyd wrote: > > diff --git a/Documentation/dev-tools/kunit/api/index.rst > > b/Documentation/dev-tools/kunit/api/index.rst > > index 2d8f756aab56..282befa17edf 100644 > > ---

[PATCH v1 1/1] selftest mm/mseal: fix arm build

2024-05-02 Thread jeffxu
From: Jeff Xu add include linux/mman.h to fix arm build fix a typo Signed-off-by: Jeff Xu Suggested-by: Ryan Roberts --- tools/testing/selftests/mm/mseal_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/mseal_test.c

[PATCH v1 0/1] selftest/mseal fix arm build

2024-05-02 Thread jeffxu
From: Jeff Xu This is followup on arm build failure reported by Ryan Roberts [1] I don't have right setup to repro the issue, so would need some help to verify this in arm build. [1] https://lore.kernel.org/lkml/f797fbde-ffb7-44b0-8af6-4ed2ec47e...@arm.com/ Jeff Xu (1): selftest mm/mseal:

Re: [PATCH v4 10/10] selftests/harness: Fix TEST_F()'s exit codes

2024-05-02 Thread Sean Christopherson
On Thu, May 02, 2024, Mickaël Salaün wrote: > @@ -462,8 +462,10 @@ static inline pid_t clone3_vfork(void) > munmap(teardown, sizeof(*teardown)); \ > if (self && fixture_name##_teardown_parent) \ > munmap(self, sizeof(*self)); \ > - if

Re: [PATCH v1 00/10] Define _GNU_SOURCE for sources using

2024-05-02 Thread Kees Cook
On Wed, May 01, 2024 at 06:24:36AM -0700, Sean Christopherson wrote: > On Wed, May 01, 2024, Mark Brown wrote: > > On Tue, Apr 30, 2024 at 11:50:09PM +, Edward Liaw wrote: > > > 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced > > > asprintf into kselftest_harness.h, which

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

2024-05-02 Thread Kees Cook
On Thu, May 02, 2024 at 11:33:17AM +0500, Muhammad Usama Anjum wrote: > On 5/2/24 1:32 AM, Kees Cook wrote: > > On Tue, Apr 30, 2024 at 11:02:36AM +0800, kernel test robot wrote: > >> version: kernel-selftests-x86_64-c7864053-1_20240419 > >> [...] > >> compiler: gcc-13 > >> 2024-04-29 15:02:59

Re: [PATCH v10 3/5] selftest mm/mseal memory sealing

2024-05-02 Thread Jeff Xu
On Thu, May 2, 2024 at 4:24 AM Ryan Roberts wrote: > > On 15/04/2024 17:35, jef...@chromium.org wrote: > > From: Jeff Xu > > > > selftest for memory sealing change in mmap() and mseal(). > > > > Signed-off-by: Jeff Xu > > --- > > tools/testing/selftests/mm/.gitignore |1 + > >

Re: [PATCH v4 05/16] riscv: Extend cpufeature.c to detect vendor extensions

2024-05-02 Thread Charlie Jenkins
On Wed, May 01, 2024 at 09:44:15AM -0700, Evan Green wrote: > On Fri, Apr 26, 2024 at 2:29 PM Charlie Jenkins wrote: > > > > Separate vendor extensions out into one struct per vendor > > instead of adding vendor extensions onto riscv_isa_ext. > > > > Add a hidden config RISCV_ISA_VENDOR_EXT to

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

2024-05-02 Thread patchwork-bot+netdevbpf
Hello: This series was applied to bpf/bpf-next.git (master) by Martin KaFai Lau : On Mon, 29 Apr 2024 16:45:17 -0500 you wrote: > This patch series adds test coverage for BPF sockaddr hooks and their > interactions with kernel socket functions (i.e. kernel_bind(), > kernel_connect(),

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

2024-05-02 Thread Chen, Zide
On 5/2/2024 10:40 AM, Sean Christopherson wrote: > On Mon, Apr 29, 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

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

2024-05-02 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

Re: [PATCH v4 03/10] dt-bindings: test: Add KUnit empty node binding

2024-05-02 Thread Brendan Higgins
On Wed, May 1, 2024 at 3:55 AM 'David Gow' via KUnit Development wrote: > > On Tue, 23 Apr 2024 at 07:24, Stephen Boyd wrote: > > > > Describe a binding for an empty device node used by KUnit tests to > > confirm overlays load properly. > > > > Reviewed-by: Rob Herring > > Cc: Krzysztof

[PATCH net-next] selftest: epoll_busy_poll: epoll busy poll tests

2024-05-02 Thread Joe Damato
Add a simple test for the epoll busy poll ioctls. This test ensures that the ioctls have the expected return codes and that the kernel properly gets and sets epoll busy poll parameters. The test can be expanded in the future to do real busy polling (provided another machine to act as the client

[PATCH v4 01/10] selftests/pidfd: Fix config for pidfd_setns_test

2024-05-02 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: Shuah Khan Fixes: 2b40c5db73e2 ("selftests/pidfd: add pidfd setns tests") Reviewed-by: Kees Cook

[PATCH v4 10/10] selftests/harness: Fix TEST_F()'s exit codes

2024-05-02 Thread Mickaël Salaün
Always forward grandchild's exit codes to its parent. This fixes KVM_ONE_VCPU_TEST(). Initial patch written by Sean Christopherson [1]. Cc: Jakub Kicinski Cc: Kees Cook Cc: Mark Brown Cc: Sean Christopherson Cc: Shuah Khan Cc: Will Drewry Link:

[PATCH v4 09/10] selftests/harness: Fix vfork() side effects

2024-05-02 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

[PATCH v4 08/10] selftests/harness: Share _metadata between forked processes

2024-05-02 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

[PATCH v4 05/10] selftests/landlock: Do not allocate memory in fixture data

2024-05-02 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

[PATCH v4 07/10] selftests/pidfd: Fix wrong expectation

2024-05-02 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: Shuah Khan Reviewed-by: Kees Cook Reviewed-by: Christian Brauner Signed-off-by: Mickaël Salaün Link:

[PATCH v4 06/10] selftests/harness: Constify fixture variants

2024-05-02 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:

[PATCH v4 03/10] selftests/harness: Fix fixture teardown

2024-05-02 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

[PATCH v4 02/10] selftests/landlock: Fix FS tests when run on a private mount point

2024-05-02 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 v4 04/10] selftests/harness: Fix interleaved scheduling leading to race conditions

2024-05-02 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

[PATCH v4 00/10] Fix Kselftest's vfork() side effects

2024-05-02 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 v4 00/12] selftests: kselftest_harness: support using xfail

2024-05-02 Thread Mickaël Salaün
On Thu, May 02, 2024 at 11:42:29AM GMT, Sean Christopherson wrote: > +kvm > > On Tue, Mar 05, 2024, Mickaël Salaün wrote: > > On Tue, Mar 05, 2024 at 01:43:14AM -0800, Kees Cook wrote: > > > On Mon, Mar 04, 2024 at 03:39:02PM -0800, Jakub Kicinski wrote: > > > > On Mon, 4 Mar 2024 15:14:04 -0800

Re: [PATCH v2] KVM: selftests: Use TAP interface in the set_memory_region test

2024-05-02 Thread Sean Christopherson
On Fri, Apr 26, 2024, Thomas Huth wrote: > Use the kselftest_harness.h interface in this test to get TAP > output, so that it is easier for the user to see what the test > is doing. (Note: We are not using the KVM_ONE_VCPU_TEST_SUITE() > macro here since these tests are creating their VMs with the

Re: [PATCH v4 00/12] selftests: kselftest_harness: support using xfail

2024-05-02 Thread Sean Christopherson
+kvm On Tue, Mar 05, 2024, Mickaël Salaün wrote: > On Tue, Mar 05, 2024 at 01:43:14AM -0800, Kees Cook wrote: > > On Mon, Mar 04, 2024 at 03:39:02PM -0800, Jakub Kicinski wrote: > > > On Mon, 4 Mar 2024 15:14:04 -0800 Kees Cook wrote: > > > > > Ugh, I'm guessing vfork() "eats" the signal, IOW

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

2024-05-02 Thread Sean Christopherson
On Mon, Apr 29, 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

[PATCH 2/2] selftests/damon: add a test for DAMOS quota goal

2024-05-02 Thread SeongJae Park
Add a selftest for DAMOS quota goal. It tests the feature by setting a user_input metric based goal, change the current feedback, and check if the effective quota size is increased and decreased as expected. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/Makefile| 2 +-

[PATCH 1/2] selftests/damon/_damon_sysfs: support quota goals

2024-05-02 Thread SeongJae Park
The DAMON sysfs test purpose wrapper, _damon_sysfs.py, is not supporting quota goals. Implement the support for testing the feature. The test will be implemented and added by the following commit. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 84

[PATCH 0/2] selftests/damon: add DAMOS quota goal test

2024-05-02 Thread SeongJae Park
Extend DAMON selftest-purpose sysfs wrapper to support DAMOS quota goal, and implement a simple selftest for the feature using it. SeongJae Park (2): selftests/damon/_damon_sysfs: support quota goals selftests/damon: add a test for DAMOS quota goal tools/testing/selftests/damon/Makefile

Re: [PATCH 0/3] tools/nolibc: implement strerror()

2024-05-02 Thread Thomas Weißschuh
Hi Shuah, On 2024-04-26 13:08:55+, Thomas Weißschuh wrote: > Adds a simple implementation of strerror() and makes use of it in > kselftests. > > Shuah, could you Ack patch 3? Friendly ping for an Ack of patch 3 of this series. After that I'd like to submit an updated nolibc pull request to

Re: [PATCH v10 3/5] selftest mm/mseal memory sealing

2024-05-02 Thread Jeff Xu
On Thu, May 2, 2024 at 4:24 AM Ryan Roberts wrote: > > On 15/04/2024 17:35, jef...@chromium.org wrote: > > From: Jeff Xu > > > > selftest for memory sealing change in mmap() and mseal(). > > > > Signed-off-by: Jeff Xu > > --- > > tools/testing/selftests/mm/.gitignore |1 + > >

Re: [PATCH v1 2/2] mm/hugetlb: document why hugetlb uses folio_mapcount() for COW reuse decisions

2024-05-02 Thread David Hildenbrand
On 02.05.24 16:28, Peter Xu wrote: On Thu, May 02, 2024 at 10:52:59AM +0200, David Hildenbrand wrote: Let's document why hugetlb still uses folio_mapcount() and is prone to leaking memory between processes, for example using vmsplice() that still uses FOLL_GET. More details can be found in

Re: [PATCH v1 2/2] mm/hugetlb: document why hugetlb uses folio_mapcount() for COW reuse decisions

2024-05-02 Thread Peter Xu
On Thu, May 02, 2024 at 10:52:59AM +0200, David Hildenbrand wrote: > Let's document why hugetlb still uses folio_mapcount() and is prone to > leaking memory between processes, for example using vmsplice() that > still uses FOLL_GET. > > More details can be found in [1], especially around how

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

2024-05-02 Thread Christian Brauner
On Mon, Apr 29, 2024 at 09:19:09PM +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: Shuah Khan > Reviewed-by: Kees Cook

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

2024-05-02 Thread Christian Brauner
On Mon, Apr 29, 2024 at 09:19:03PM +0200, Mickaël Salaün wrote: > 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:

Re: [PATCH v2 4/5] KVM: selftests: Add an interface to read the data of named vcpu stat

2024-05-02 Thread Andrew Jones
On Wed, May 01, 2024 at 02:54:32PM GMT, Manali Shukla wrote: > From: Manali Shukla > > The interface is used to read the data values of a specified vcpu stat > from the currenly available binary stats interface. > > Signed-off-by: Manali Shukla > --- >

Re: [PATCH v10 3/5] selftest mm/mseal memory sealing

2024-05-02 Thread Ryan Roberts
On 15/04/2024 17:35, jef...@chromium.org wrote: > From: Jeff Xu > > selftest for memory sealing change in mmap() and mseal(). > > Signed-off-by: Jeff Xu > --- > tools/testing/selftests/mm/.gitignore |1 + > tools/testing/selftests/mm/Makefile |1 + >

[PATCH v1 2/2] mm/hugetlb: document why hugetlb uses folio_mapcount() for COW reuse decisions

2024-05-02 Thread David Hildenbrand
Let's document why hugetlb still uses folio_mapcount() and is prone to leaking memory between processes, for example using vmsplice() that still uses FOLL_GET. More details can be found in [1], especially around how hugetlb pages cannot really be overcommitted, and why we don't particularly care

[PATCH v1 1/2] selftests: mm: cow: flag vmsplice() hugetlb tests as XFAIL

2024-05-02 Thread David Hildenbrand
The vmsplice() hugetlb tests have been failing right from the start, and we documented that in the introducing commit 7dad331be781 ("selftests/vm: anon_cow: hugetlb tests"): Note that some tests cases still fail. This will, for example, be fixed once vmsplice properly uses

[PATCH v1 0/2] selftests: mm: cow: flag vmsplice() hugetlb tests as XFAIL

2024-05-02 Thread David Hildenbrand
The failing hugetlb vmsplice() COW tests keep confusing people, and having tests that have been failing for years and likely will keep failing for years to come because nobody cares enough is rather suboptimal. Let's mark them as XFAIL and document why fixing them is not that easy as it would

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

2024-05-02 Thread Madhavan Srinivasan
On 4/29/24 7:39 PM, Michael Ellerman wrote: 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:

Re: [PATCH v2 1/2] selftests/powerpc: Convert pmu Makefile to for loop style

2024-05-02 Thread Madhavan Srinivasan
On 4/22/24 7:04 PM, Michael Ellerman wrote: The pmu Makefile has grown more sub directories over the years. Rather than open coding the rules for each subdir, use for loops. Nice cleanup. Thanks. Tested-by: Madhavan Srinivasan Signed-off-by: Michael Ellerman ---

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

2024-05-02 Thread Muhammad Usama Anjum
On 5/2/24 1:32 AM, Kees Cook wrote: > On Tue, Apr 30, 2024 at 11:02:36AM +0800, kernel test robot wrote: >> version: kernel-selftests-x86_64-c7864053-1_20240419 >> [...] >> compiler: gcc-13 >> 2024-04-29 15:02:59 make -j16 -C sgx >> [...] >> gcc -Wall -Werror -static-pie -nostdlib -ffreestanding