[PATCH net-next v5 7/7] selftests: drv-net: add require_XYZ() helpers for validating env

2024-04-19 Thread Jakub Kicinski
Wrap typical checks like whether given command used by the test is available in helpers. Signed-off-by: Jakub Kicinski --- .../selftests/drivers/net/lib/py/env.py | 29 ++- tools/testing/selftests/drivers/net/ping.py | 6 2 files changed, 34 insertions(+), 1

[PATCH net-next v5 6/7] selftests: drv-net: add a TCP ping test case (and useful helpers)

2024-04-19 Thread Jakub Kicinski
More complex tests often have to spawn a background process, like a server which will respond to requests or tcpdump. Add support for creating such processes using the with keyword: with bkg("my-daemon", ..): # my-daemon is alive in this block My initial thought was to add this support

[PATCH net-next v5 5/7] selftests: net: support matching cases by name prefix

2024-04-19 Thread Jakub Kicinski
While writing tests with a lot more cases I got tired of having to jump back and forth to add the name of the test to the ksft_run() list. Most unittest frameworks do some name matching, e.g. assume that functions with names starting with test_ are test cases. Support similar flow in ksft_run().

[PATCH net-next v5 4/7] selftests: drv-net: add a trivial ping test

2024-04-19 Thread Jakub Kicinski
Add a very simple test for testing with a remote system. Both IPv4 and IPv6 connectivity is optional, later change will add checks to skip tests based on available addresses. Using netdevsim: $ ./run_kselftest.sh -t drivers/net:ping.py TAP version 13 1..1 # timeout set to 45 # selftests:

[PATCH net-next v5 3/7] selftests: drv-net: construct environment for running tests which require an endpoint

2024-04-19 Thread Jakub Kicinski
Nothing surprising here, hopefully. Wrap the variables from the environment into a class or spawn a netdevsim based env and pass it to the tests. Signed-off-by: Jakub Kicinski --- .../testing/selftests/drivers/net/README.rst | 33 +++ .../selftests/drivers/net/lib/py/env.py | 98

[PATCH net-next v5 2/7] selftests: drv-net: factor out parsing of the env

2024-04-19 Thread Jakub Kicinski
The tests with a remote end will use a different class, for clarity, but will also need to parse the env. So factor parsing the env out to a function. Signed-off-by: Jakub Kicinski --- .../selftests/drivers/net/lib/py/env.py | 43 +++ 1 file changed, 26 insertions(+), 17

[PATCH net-next v5 1/7] selftests: drv-net: define endpoint structures

2024-04-19 Thread Jakub Kicinski
Define the remote endpoint "model". To execute most meaningful device driver tests we need to be able to communicate with a remote system, and have it send traffic to the device under test. Various test environments will have different requirements. 0) "Local" netdevsim-based testing can simply

[PATCH net-next v5 0/7] selftests: drv-net: support testing with a remote system

2024-04-19 Thread Jakub Kicinski
Hi! Implement support for tests which require access to a remote system / endpoint which can generate traffic. This series concludes the "groundwork" for upstream driver tests. I wanted to support the three models which came up in discussions: - SW testing with netdevsim - "local" testing with

[PATCH net-next 4/4] selftests: drv-net: test dumping qstats per device

2024-04-19 Thread Jakub Kicinski
Add a test for dumping qstats device by device. ksft framework grows a ksft_raises() helper, to be used under with, which should be familiar to unittest users. Signed-off-by: Jakub Kicinski --- tools/testing/selftests/drivers/net/stats.py | 62 +++-

[PATCH net-next 3/4] netlink: support all extack types in dumps

2024-04-19 Thread Jakub Kicinski
Note that when this commit message refers to netlink dump it only means the actual dumping part, the parsing / dump start is handled by the same code as "doit". Commit 4a19edb60d02 ("netlink: Pass extack to dump handlers") added support for returning extack messages from dump handlers, but left

[PATCH net-next 2/4] netlink: move extack writing helpers

2024-04-19 Thread Jakub Kicinski
Next change will need them in netlink_dump_done(), pure move. Signed-off-by: Jakub Kicinski --- net/netlink/af_netlink.c | 126 +++ 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index

[PATCH net-next 1/4] netdev: support dumping a single netdev in qstats

2024-04-19 Thread Jakub Kicinski
Having to filter the right ifindex in the tests is a bit tedious. Add support for dumping qstats for a single ifindex. Signed-off-by: Jakub Kicinski --- Documentation/netlink/specs/netdev.yaml | 1 + net/core/netdev-genl-gen.c | 1 + net/core/netdev-genl.c | 52

[PATCH net-next 0/4] netdev: support dumping a single netdev in qstats

2024-04-19 Thread Jakub Kicinski
I was writing a test for page pool which depended on qstats, and got tired of having to filter dumps in user space. Add support for dumping stats for a single netdev. To get there we first need to add full support for extack in dumps (and fix a dump error handling bug in YNL, sent separately to

Re: [PATCH v10 0/5] Introduce mseal

2024-04-19 Thread Jeff Xu
On Fri, Apr 19, 2024 at 10:59 AM Pedro Falcato wrote: > > On Fri, Apr 19, 2024 at 2:22 AM Jeff Xu wrote: > > The overhead is likely to grow linearly with the number of VMA, since > > it takes time to retrieve VMA's metadata. > > > > Let's use one data sample to look at impact: > > > > Test:

Re: [PATCH bpf-next v5 0/6] use network helpers, part 1

2024-04-19 Thread patchwork-bot+netdevbpf
Hello: This series was applied to bpf/bpf-next.git (master) by Martin KaFai Lau : On Thu, 18 Apr 2024 16:09:06 +0800 you wrote: > From: Geliang Tang > > v5: > - address Martin's comments for v4. (thanks) > - drop start_server_addr_opts, add opts as a argument of >start_server_addr. > -

Re: [PATCH v8 08/24] drivers/perf: riscv: Fix counter mask iteration for RV32

2024-04-19 Thread Atish Kumar Patra
On Fri, Apr 19, 2024 at 5:37 PM Samuel Holland wrote: > > Hi Atish, > > On 2024-04-20 10:17 AM, Atish Patra wrote: > > For RV32, used_hw_ctrs can have more than 1 word if the firmware chooses > > to interleave firmware/hardware counters indicies. Even though it's a > > unlikely scenario, handle

Re: [PATCH v8 08/24] drivers/perf: riscv: Fix counter mask iteration for RV32

2024-04-19 Thread Samuel Holland
Hi Atish, On 2024-04-20 10:17 AM, Atish Patra wrote: > For RV32, used_hw_ctrs can have more than 1 word if the firmware chooses > to interleave firmware/hardware counters indicies. Even though it's a > unlikely scenario, handle that case by iterating over all the words > instead of just using the

[PATCH v2 1/1] selftest mm/mseal: fix compile warning

2024-04-19 Thread jeffxu
From: Jeff Xu fix compile warning reported by test robot Signed-off-by: Jeff Xu Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202404190226.ofjoewv8-...@intel.com/ Suggested-by: Pedro Falcato --- tools/testing/selftests/mm/mseal_test.c | 3 +--

[PATCH v2 0/1] selftest mm/mseal compile warning

2024-04-19 Thread jeffxu
From: Jeff Xu fix compile warning reported by test robot [1] Please apply on top of patch titled: "selftest mm/mseal: style change" (which already in mm-unstable) [1] https://lore.kernel.org/all/202404190226.ofjoewv8-...@intel.com/ History: V2: fix as suggested by Pedro Falcato v1:

Re: [PATCH 1/1] selftest mm/mseal: fix compile warning

2024-04-19 Thread Jeff Xu
On Fri, Apr 19, 2024 at 9:43 AM Pedro Falcato wrote: > > On Fri, Apr 19, 2024 at 4:44 AM wrote: > > > > From: Jeff Xu > > > > fix compile warning reported by test robot > > > > Signed-off-by: Jeff Xu > > Reported-by: kernel test robot > > Closes:

Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction

2024-04-19 Thread Chen, Zide
On 4/19/2024 11:43 AM, David Woodhouse wrote: > On 19 April 2024 19:40:06 BST, David Woodhouse wrote: >> On 19 April 2024 18:13:16 BST, "Chen, Zide" wrote: >>> I'm wondering what's the underling theory that we definitely can achieve >>> ±1ns accuracy? I tested it on a Sapphire Rapids @2100MHz

Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction

2024-04-19 Thread Chen, Zide
On 4/19/2024 12:34 PM, David Woodhouse wrote: > On 19 April 2024 18:13:16 BST, "Chen, Zide" wrote: >> I'm wondering what's the underling theory that we definitely can achieve >> ±1ns accuracy? I tested it on a Sapphire Rapids @2100MHz TSC frequency, >> and I can see delta_corrected=2 in ~2%

[PATCH v8 24/24] KVM: riscv: selftests: Add commandline option for SBI PMU test

2024-04-19 Thread Atish Patra
SBI PMU test comprises of multiple tests and user may want to run only a subset depending on the platform. The most common case would be to run all to validate all the tests. However, some platform may not support all events or all ISA extensions. The commandline option allows user to disable any

[PATCH v8 23/24] KVM: riscv: selftests: Add a test for counter overflow

2024-04-19 Thread Atish Patra
Add a test for verifying overflow interrupt. Currently, it relies on overflow support on cycle/instret events. This test works for cycle/ instret events which support sampling via hpmcounters on the platform. There are no ISA extensions to detect if a platform supports that. Thus, this test will

[PATCH v8 22/24] KVM: riscv: selftests: Add a test for PMU snapshot functionality

2024-04-19 Thread Atish Patra
Verify PMU snapshot functionality by setting up the shared memory correctly and reading the counter values from the shared memory instead of the CSR. Reviewed-by: Andrew Jones Reviewed-by: Anup Patel Signed-off-by: Atish Patra --- .../testing/selftests/kvm/include/riscv/sbi.h | 25 +++

[PATCH v8 21/24] KVM: riscv: selftests: Add SBI PMU selftest

2024-04-19 Thread Atish Patra
This test implements basic sanity test and cycle/instret event counting tests. Reviewed-by: Anup Patel Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/riscv/sbi_pmu_test.c| 369 ++ 2

[PATCH v8 20/24] KVM: riscv: selftests: Add SBI PMU extension definitions

2024-04-19 Thread Atish Patra
The SBI PMU extension definition is required for upcoming SBI PMU selftests. Reviewed-by: Andrew Jones Reviewed-by: Anup Patel Signed-off-by: Atish Patra --- .../testing/selftests/kvm/include/riscv/sbi.h | 66 +++ 1 file changed, 66 insertions(+) diff --git

[PATCH v8 19/24] KVM: riscv: selftests: Add Sscofpmf to get-reg-list test

2024-04-19 Thread Atish Patra
The KVM RISC-V allows Sscofpmf extension for Guest/VM so let us add this extension to get-reg-list test. Reviewed-by: Anup Patel Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 1 file changed, 4 insertions(+) diff --git

[PATCH v8 18/24] KVM: riscv: selftests: Add helper functions for extension checks

2024-04-19 Thread Atish Patra
__vcpu_has_ext can check both SBI and ISA extensions when the first argument is properly converted to SBI/ISA extension IDs. Introduce two helper functions to make life easier for developers so they don't have to worry about the conversions. Replace the current usages as well with new helpers.

[PATCH v8 17/24] KVM: riscv: selftests: Move sbi definitions to its own header file

2024-04-19 Thread Atish Patra
The SBI definitions will continue to grow. Move the sbi related definitions to its own header file from processor.h Suggested-by: Andrew Jones Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- .../selftests/kvm/include/riscv/processor.h | 39 ---

[PATCH v8 16/24] RISC-V: KVM: Improve firmware counter read function

2024-04-19 Thread Atish Patra
Rename the function to indicate that it is meant for firmware counter read. While at it, add a range sanity check for it as well. Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- arch/riscv/include/asm/kvm_vcpu_pmu.h | 2 +- arch/riscv/kvm/vcpu_pmu.c | 7 ++-

[PATCH v8 15/24] RISC-V: KVM: Support 64 bit firmware counters on RV32

2024-04-19 Thread Atish Patra
The SBI v2.0 introduced a fw_read_hi function to read 64 bit firmware counters for RV32 based systems. Add infrastructure to support that. Reviewed-by: Andrew Jones Reviewed-by: Anup Patel Signed-off-by: Atish Patra --- arch/riscv/include/asm/kvm_vcpu_pmu.h | 4 ++-

[PATCH v8 14/24] RISC-V: KVM: Add perf sampling support for guests

2024-04-19 Thread Atish Patra
KVM enables perf for guest via counter virtualization. However, the sampling can not be supported as there is no mechanism to enabled trap/emulate scountovf in ISA yet. Rely on the SBI PMU snapshot to provide the counter overflow data via the shared memory. In case of sampling event, the host

[PATCH v8 13/24] RISC-V: KVM: Implement SBI PMU Snapshot feature

2024-04-19 Thread Atish Patra
PMU Snapshot function allows to minimize the number of traps when the guest access configures/access the hpmcounters. If the snapshot feature is enabled, the hypervisor updates the shared memory with counter data and state of overflown counters. The guest can just read the shared memory instead of

[PATCH v8 12/24] RISC-V: KVM: No need to exit to the user space if perf event failed

2024-04-19 Thread Atish Patra
Currently, we return a linux error code if creating a perf event failed in kvm. That shouldn't be necessary as guest can continue to operate without perf profiling or profiling with firmware counters. Return appropriate SBI error code to indicate that PMU configuration failed. An error message in

[PATCH v8 11/24] RISC-V: KVM: No need to update the counter value during reset

2024-04-19 Thread Atish Patra
The virtual counter value is updated during pmu_ctr_read. There is no need to update it in reset case. Otherwise, it will be counted twice which is incorrect. Fixes: 0cb74b65d2e5 ("RISC-V: KVM: Implement perf support without sampling") Reviewed-by: Anup Patel Reviewed-by: Andrew Jones

[PATCH v8 10/24] RISC-V: KVM: Fix the initial sample period value

2024-04-19 Thread Atish Patra
The initial sample period value when counter value is not assigned should be set to maximum value supported by the counter width. Otherwise, it may result in spurious interrupts. Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- arch/riscv/kvm/vcpu_pmu.c | 2 +- 1 file changed, 1

[PATCH v8 09/24] drivers/perf: riscv: Implement SBI PMU snapshot function

2024-04-19 Thread Atish Patra
SBI v2.0 SBI introduced PMU snapshot feature which adds the following features. 1. Read counter values directly from the shared memory instead of csr read. 2. Start multiple counters with initial values with one SBI call. These functionalities optimizes the number of traps to the higher

[PATCH v8 08/24] drivers/perf: riscv: Fix counter mask iteration for RV32

2024-04-19 Thread Atish Patra
For RV32, used_hw_ctrs can have more than 1 word if the firmware chooses to interleave firmware/hardware counters indicies. Even though it's a unlikely scenario, handle that case by iterating over all the words instead of just using the first word. Reviewed-by: Andrew Jones Signed-off-by: Atish

[PATCH v8 07/24] RISC-V: Use the minor version mask while computing sbi version

2024-04-19 Thread Atish Patra
As per the SBI specification, minor version is encoded in the lower 24 bits only. Make sure that the SBI version is computed with the appropriate mask. Currently, there is no minor version in use. Thus, it doesn't change anything functionality but it is good to be compliant with the

[PATCH v8 06/24] RISC-V: KVM: Rename the SBI_STA_SHMEM_DISABLE to a generic name

2024-04-19 Thread Atish Patra
SBI_STA_SHMEM_DISABLE is a macro to invoke disable shared memory commands. As this can be invoked from other SBI extension context as well, rename it to more generic name as SBI_SHMEM_DISABLE. Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- arch/riscv/include/asm/sbi.h | 2 +-

[PATCH v8 05/24] RISC-V: Add SBI PMU snapshot definitions

2024-04-19 Thread Atish Patra
SBI PMU Snapshot function optimizes the number of traps to higher privilege mode by leveraging a shared memory between the S/VS-mode and the M/HS mode. Add the definitions for that extension and new error codes. Reviewed-by: Andrew Jones Reviewed-by: Anup Patel Acked-by: Palmer Dabbelt

[PATCH v8 04/24] drivers/perf: riscv: Use BIT macro for shifting operations

2024-04-19 Thread Atish Patra
It is a good practice to use BIT() instead of (1 << x). Replace the current usages with BIT(). Take this opportunity to replace few (1UL << x) with BIT() as well for consistency. Reviewed-by: Andrew Jones Signed-off-by: Atish Patra --- arch/riscv/include/asm/sbi.h | 20 ++--

[PATCH v8 03/24] drivers/perf: riscv: Read upper bits of a firmware counter

2024-04-19 Thread Atish Patra
SBI v2.0 introduced a explicit function to read the upper 32 bits for any firmware counter width that is longer than 32bits. This is only applicable for RV32 where firmware counter can be 64 bit. Reviewed-by: Andrew Jones Acked-by: Palmer Dabbelt Reviewed-by: Conor Dooley Reviewed-by: Anup

[PATCH v8 02/24] RISC-V: Add FIRMWARE_READ_HI definition

2024-04-19 Thread Atish Patra
SBI v2.0 added another function to SBI PMU extension to read the upper bits of a counter with width larger than XLEN. Add the definition for that function. Reviewed-by: Andrew Jones Reviewed-by: Clément Léger Acked-by: Conor Dooley Reviewed-by: Anup Patel Signed-off-by: Atish Patra ---

[PATCH v8 01/24] RISC-V: Fix the typo in Scountovf CSR name

2024-04-19 Thread Atish Patra
The counter overflow CSR name is "scountovf" not "sscountovf". Fix the csr name. Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support") Reviewed-by: Clément Léger Reviewed-by: Conor Dooley Reviewed-by: Anup Patel Reviewed-by: Andrew Jones Signed-off-by: Atish Patra ---

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

2024-04-19 Thread Atish Patra
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 which allows the SBI implementation to provide counter information (i.e. values/overflow status) via a shared memory between the SBI

Re: [PATCH v7 08/24] drivers/perf: riscv: Implement SBI PMU snapshot function

2024-04-19 Thread Atish Kumar Patra
On Thu, Apr 18, 2024 at 1:01 PM Samuel Holland wrote: > > Hi Atish, > > On 2024-04-18 2:47 AM, Atish Patra wrote: > > > > On 4/16/24 21:02, Samuel Holland wrote: > >> Hi Atish, > >> > >> On 2024-04-16 1:44 PM, Atish Patra wrote: > >>> SBI v2.0 SBI introduced PMU snapshot feature which adds the

Re: [PATCH v4 00/14] security: digest_cache LSM

2024-04-19 Thread Roberto Sassu
On 4/19/2024 4:18 AM, Bagas Sanjaya wrote: On 4/18/24 02:02, Roberto Sassu wrote: 72374d71c315 Roberto Still FTA (fail to apply), unfortunately. Sorry, looks like I didn't regenerate the patches after rebasing to the latest kernel. The current ones are still based on 6.8-rc3, but they

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

2024-04-19 Thread Eduard Zingerman
On Thu, 2024-04-11 at 20:27 +0800, Xu Kuohai wrote: > From: Xu Kuohai > > With lsm return value check, the no-alu32 version > test_libbpf_get_fd_by_id_opts > is rejected by the verifier, and the log says: > > 0: R1=ctx() R10=fp0 > ; int BPF_PROG(check_access, struct bpf_map *map, fmode_t

Re: [PATCH v4 00/30] NT synchronization primitive driver

2024-04-19 Thread Elizabeth Figura
On Friday, 19 April 2024 11:16:11 CDT Peter Zijlstra wrote: > On Tue, Apr 16, 2024 at 05:18:56PM -0500, Elizabeth Figura wrote: > > On Tuesday, 16 April 2024 16:18:24 CDT Elizabeth Figura wrote: > > > On Tuesday, 16 April 2024 03:14:21 CDT Peter Zijlstra wrote: > > > > I don't support GE has it in

Re: [PATCH v4 00/14] security: digest_cache LSM

2024-04-19 Thread Jarkko Sakkinen
On Fri Apr 19, 2024 at 2:18 PM EEST, Bagas Sanjaya wrote: > On 4/18/24 02:02, Roberto Sassu wrote: > > > > 72374d71c315 > > > > Roberto > > > > Still FTA (fail to apply), unfortunately. Robert, quick suggestion. Maybe pick recent rc for the patch set, rebase on top of that and document that

Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction

2024-04-19 Thread David Woodhouse
On 19 April 2024 18:13:16 BST, "Chen, Zide" wrote: >I'm wondering what's the underling theory that we definitely can achieve >±1ns accuracy? I tested it on a Sapphire Rapids @2100MHz TSC frequency, >and I can see delta_corrected=2 in ~2% cases. Hm. Thanks for testing! So the KVM clock is based

Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction

2024-04-19 Thread David Woodhouse
On 19 April 2024 19:40:06 BST, David Woodhouse wrote: >On 19 April 2024 18:13:16 BST, "Chen, Zide" wrote: >>I'm wondering what's the underling theory that we definitely can achieve >>±1ns accuracy? I tested it on a Sapphire Rapids @2100MHz TSC frequency, >>and I can see delta_corrected=2 in ~2%

Re: [PATCH v10 0/5] Introduce mseal

2024-04-19 Thread Pedro Falcato
On Fri, Apr 19, 2024 at 2:22 AM Jeff Xu wrote: > The overhead is likely to grow linearly with the number of VMA, since > it takes time to retrieve VMA's metadata. > > Let's use one data sample to look at impact: > > Test: munmap 1000 memory range, each memory range has 1 VMA > > syscall__

Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction

2024-04-19 Thread Chen, Zide
On 4/8/2024 3:07 PM, Jack Allister wrote: > This test proves that there is an inherent KVM/PV clock drift away from the > guest TSC when KVM decides to update the PV time information structure due > to a KVM_REQ_MASTERCLOCK_UPDATE. This drift is exascerbated when a guest is > using TSC scaling

Re: [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking

2024-04-19 Thread David Hildenbrand
On 19.04.24 18:30, Mike Rapoport wrote: On Fri, Apr 19, 2024 at 11:45:14AM +0200, David Hildenbrand wrote: On 19.04.24 10:33, Shivansh Vij wrote: On 19/04/2024 08:43, Ryan Roberts wrote: Hi All, This series adds uffd write-protect and soft-dirty tracking support for arm64. I consider the

RE: [PATCH v2 07/25] KVM: VMX: Set intercept for FRED MSRs

2024-04-19 Thread Li, Xin3
> >+case MSR_IA32_FRED_RSP0 ... MSR_IA32_FRED_CONFIG: > >+/* FRED MSRs should be passthrough to FRED guests only */ > > This comment sounds weird. It sounds like the code will be something like: > if guest supports FRED > return true >

RE: [PATCH v2 08/25] KVM: VMX: Initialize VMCS FRED fields

2024-04-19 Thread Li, Xin3
> >+#ifdef CONFIG_X86_64 > > is this #ifdeffery neccesary? Yes, otherwise build fails on 32 bit. > > I assume kvm_cpu_cap_has(X86_FEATURE_FRED) is always false > for !CONFIG_X86_64. > Looks most of FRED changes in core kernel don't have such #ifdeffery. Because it's not a compile time false,

Re: [PATCH v10 0/5] Introduce mseal

2024-04-19 Thread Suren Baghdasaryan
On Fri, Apr 19, 2024 at 3:15 PM Jeff Xu wrote: > > On Fri, Apr 19, 2024 at 7:57 AM Suren Baghdasaryan wrote: > > > > On Thu, Apr 18, 2024 at 6:22 PM Jeff Xu wrote: > > > > > > On Thu, Apr 18, 2024 at 1:19 PM Suren Baghdasaryan > > > wrote: > > > > > > > > On Tue, Apr 16, 2024 at 12:40 PM Jeff

Re: [PATCH] selftests: Make ksft_exit functions return void instead of int

2024-04-19 Thread Muhammad Usama Anjum
On 4/17/24 8:37 PM, Nathan Chancellor wrote: > Commit f7d5bcd35d42 ("selftests: kselftest: Mark functions that > unconditionally call exit() as __noreturn") marked functions that call > exit() as __noreturn but it did not change the return type of these > functions from 'void' to 'int' like it

Re: [PATCH] selftests: Fix asan linkage to work with clang

2024-04-19 Thread Muhammad Usama Anjum
Thanks for the fix. On 4/17/24 9:07 PM, Ryan Roberts wrote: > Both fchmodat2 and openat2 statically link against libasan (for > explanation of why, look at the fixes commit). This is done using > `-static-libasan`. However, it turns out that clang uses a different > option, `-static-libsan`. This

Re: [PATCH] selftests: filesystems: add missing stddef header

2024-04-19 Thread Muhammad Usama Anjum
On 4/17/24 9:16 PM, Amer Al Shanawany wrote: > fix compiler warning and errors when compiling statmount test. The error description or the compiler with version is required to reproduce the error easily. I'm unable to reproduce the error by gcc 12 and clang 17. > > Signed-off-by: Amer Al

Re: [PATCH 1/1] selftest mm/mseal: fix compile warning

2024-04-19 Thread Pedro Falcato
On Fri, Apr 19, 2024 at 4:44 AM wrote: > > From: Jeff Xu > > fix compile warning reported by test robot > > Signed-off-by: Jeff Xu > Reported-by: kernel test robot > Closes: https://lore.kernel.org/r/202404190226.ofjoewv8-...@intel.com/ > --- > tools/testing/selftests/mm/mseal_test.c | 3 +--

Re: [PATCH] selftests: filesystems: fix warn_unused_result build warnings

2024-04-19 Thread Muhammad Usama Anjum
On 4/17/24 11:49 PM, Amer Al Shanawany wrote: > Fix the following warnings by adding return check and error messages. > > statmount_test.c: In function ‘cleanup_namespace’: > statmount_test.c:128:9: warning: ignoring return value of ‘fchdir’ > declared with attribute ‘warn_unused_result’

RE: [PATCH v2 09/25] KVM: VMX: Switch FRED RSP0 between host and guest

2024-04-19 Thread Li, Xin3
> >+if (unlikely(vmx->msr_host_fred_rsp0 == 0)) > >+vmx->msr_host_fred_rsp0 = > read_msr(MSR_IA32_FRED_RSP0); > > can we just drop this and use "(unsigned long)task_stack_page(current) + > THREAD_SIZE" > as host fred rsp0? I thought about it, however, don't see a

Re: [PATCH v4 1/2] kunit: unregister the device on error

2024-04-19 Thread Markus Elfring
> > kunit_init_device() should unregister the device on bus register error, > > but mistakenly it tries to unregister the bus. > > > > Unregister the device instead of the bus. … > Reviewed-by: Greg Kroah-Hartman Would you ever like to distinguish hardware register errors from item registration

Re: [PATCH v1 0/5] arm64/mm: uffd write-protect and soft-dirty tracking

2024-04-19 Thread Mike Rapoport
On Fri, Apr 19, 2024 at 11:45:14AM +0200, David Hildenbrand wrote: > On 19.04.24 10:33, Shivansh Vij wrote: > > > On 19/04/2024 08:43, Ryan Roberts wrote: > > > > Hi All, > > > > > > > > This series adds uffd write-protect and soft-dirty tracking support for > > > > arm64. I > > > > consider the

Re: [PATCH v4 02/27] ntsync: Introduce NTSYNC_IOC_WAIT_ALL.

2024-04-19 Thread Peter Zijlstra
On Thu, Apr 18, 2024 at 11:35:11AM +0200, Peter Zijlstra wrote: > On Wed, Apr 17, 2024 at 03:03:05PM -0500, Elizabeth Figura wrote: > > > Ach. I wrote this with the idea that the race isn't meaningful, but > > looking at it again you're right—there is a harmful race here. > > > > I think it

Re: [PATCH 1/1] selftest mm/mseal: fix compile warning

2024-04-19 Thread Muhammad Usama Anjum
On 4/19/24 8:43 AM, jef...@chromium.org wrote: > From: Jeff Xu > > fix compile warning reported by test robot > > Signed-off-by: Jeff Xu > Reported-by: kernel test robot > Closes: https://lore.kernel.org/r/202404190226.ofjoewv8-...@intel.com/ Reviewed-by: Muhammad Usama Anjum > --- >

Re: [PATCH v4 0/2] kunit: fix minor error path mistakes

2024-04-19 Thread Markus Elfring
… > * Remove some changes requested by Marcus Elfring, I became curious how affected software components can evolve further. > as I was alerted he is a known troll. I would appreciate if this interpretation will be reconsidered somehow. Regards, Markus

Re: [PATCH v4 00/30] NT synchronization primitive driver

2024-04-19 Thread Peter Zijlstra
On Tue, Apr 16, 2024 at 05:18:56PM -0500, Elizabeth Figura wrote: > On Tuesday, 16 April 2024 16:18:24 CDT Elizabeth Figura wrote: > > On Tuesday, 16 April 2024 03:14:21 CDT Peter Zijlstra wrote: > > > I don't support GE has it in his builds? Last time I tried, building > > > Wine was a bit of a

Re: [PATCH 10/10] KVM: x86: Fix KVM clock precision in __get_kvmclock()

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse When in 'master clock mode' (i.e. when host and guest TSCs are behaving sanely and in sync), the KVM clock is defined in terms of the guest TSC. When TSC scaling is used, calculating the KVM clock directly from *host* TSC

Re: [PATCH bpf-next 17/18] bpf: add bpf_wq_start

2024-04-19 Thread Benjamin Tissoires
On Apr 19 2024, Alexei Starovoitov wrote: > On Fri, Apr 19, 2024 at 8:14 AM Benjamin Tissoires wrote: > > > > > > Honestly I just felt the patch series was big enough for a PoC and > > comparison with sleepable bpf_timer. But if we think this needs not to > > be added, I guess that works too :) >

Re: [PATCH 09/10] KVM: x86: Kill KVM_REQ_GLOBAL_CLOCK_UPDATE

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse This was introduced in commit 0061d53daf26 ("KVM: x86: limit difference between kvmclock updates") to reduce cross-vCPU differences which arose because the KVM clock was based on CLOCK_MONOTONIC and thus subject to NTP frequency

Re: [PATCH 08/10] KVM: x86: Remove periodic global clock updates

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse This effectively reverts commit 332967a3eac0 ("x86: kvm: introduce periodic global clock updates"). The periodic update was introduced to propagate NTP corrections to the guest KVM clock, when the KVM clock was based on

Re: [PATCH v2 02/12] riscv: dts: enable Zc* extensions when needed

2024-04-19 Thread Conor Dooley
On Thu, Apr 18, 2024 at 02:42:25PM +0200, Clément Léger wrote: > The Zc* spec states that: > > "The C extension is the superset of the following extensions: > - Zca > - Zcf if F is specified (RV32 only) > - Zcd if D is specified > As C defines the same instructions as Zca, Zcf and Zcd, the

Re: [PATCH bpf-next 11/18] bpf: wq: add bpf_wq_init

2024-04-19 Thread Benjamin Tissoires
On Apr 19 2024, Alexei Starovoitov wrote: > On Fri, Apr 19, 2024 at 8:12 AM Benjamin Tissoires wrote: > > > > > > It's something I added while adding the tests. And some tests were passing > > in case I was having a non sleepable callback. But if we have > > bpf_rcu_read_lock(), we are all fine

Re: [PATCH 07/10] KVM: x86: Avoid NTP frequency skew for KVM clock on 32-bit host

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse Commit 53fafdbb8b21 ("KVM: x86: switch KVMCLOCK base to monotonic raw clock") did so only for 64-bit hosts, by capturing the boot offset from within the existing clocksource notifier update_pvclock_gtod(). That notifier was

Re: [PATCH 06/10] KVM: x86: Add KVM_VCPU_TSC_SCALE and fix the documentation on TSC migration

2024-04-19 Thread David Woodhouse
On Fri, 2024-04-19 at 16:49 +0100, Paul Durrant wrote: > On 18/04/2024 20:34, David Woodhouse wrote: > > From: David Woodhouse > > > > The documentation on TSC migration using KVM_VCPU_TSC_OFFSET is woefully > > inadequate. It ignores TSC scaling, and ignores the fact that the host > > TSC may

Re: [PATCH v2 04/12] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb

2024-04-19 Thread Conor Dooley
On Thu, Apr 18, 2024 at 02:42:27PM +0200, Clément Léger wrote: > 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

Re: [PATCH v2 08/12] dt-bindings: riscv: add Zcmop ISA extension description

2024-04-19 Thread Conor Dooley
On Thu, Apr 18, 2024 at 02:42:31PM +0200, Clément Léger wrote: > 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. Acked-by: Conor Dooley signature.asc Description: PGP

Re: [PATCH 06/10] KVM: x86: Add KVM_VCPU_TSC_SCALE and fix the documentation on TSC migration

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse The documentation on TSC migration using KVM_VCPU_TSC_OFFSET is woefully inadequate. It ignores TSC scaling, and ignores the fact that the host TSC may differ from one host to the next (and in fact because of the way the kernel

Re: [PATCH bpf-next 17/18] bpf: add bpf_wq_start

2024-04-19 Thread Alexei Starovoitov
On Fri, Apr 19, 2024 at 8:14 AM Benjamin Tissoires wrote: > > > Honestly I just felt the patch series was big enough for a PoC and > comparison with sleepable bpf_timer. But if we think this needs not to > be added, I guess that works too :) It certainly did its job to compare the two and imo

Re: [PATCH v2 03/12] dt-bindings: riscv: add Zc* extension rules implied by C extension

2024-04-19 Thread Conor Dooley
On Thu, Apr 18, 2024 at 02:42:26PM +0200, Clément Léger wrote: > As stated by Zc* spec: > > "As C defines the same instructions as Zca, Zcf and Zcd, the rule is that: > - C always implies Zca > - C+F implies Zcf (RV32 only) > - C+D implies Zcd" > > Add additionnal validation rules to enforce

Re: [PATCH 03/10] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM clock migration

2024-04-19 Thread David Woodhouse
On Fri, 2024-04-19 at 16:40 +0100, Paul Durrant wrote: > > > +    * If KVM_REQ_CLOCK_UPDATE is already pending, or if the > > hv_clock has > > +    * never been generated at all, call > > kvm_guest_time_update() to do so. > > +    * Might as well use the PVCLOCK_TSC_STABLE_BIT as the

Re: [PATCH 05/10] KVM: x86: Explicitly disable TSC scaling without CONSTANT_TSC

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse KVM does make an attempt to cope with non-constant TSC, and has notifiers to handle host TSC frequency changes. However, it *only* adjusts the KVM clock, and doesn't adjust TSC frequency scaling when the host changes. This is

Re: [PATCH 04/10] KVM: selftests: Add KVM/PV clock selftest to prove timer correction

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: Jack Allister A VM's KVM/PV clock has an inherent relationship to its TSC (guest). When either the host system live-updates or the VM is live-migrated this pairing of the two clock sources should stay the same. In reality this is not the case

Re: [PATCH 03/10] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM clock migration

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: Jack Allister In the common case (where kvm->arch.use_master_clock is true), the KVM clock is defined as a simple arithmetic function of the guest TSC, based on a reference point stored in kvm->arch.master_kernel_ns and

Re: [PATCH bpf-next 11/18] bpf: wq: add bpf_wq_init

2024-04-19 Thread Alexei Starovoitov
On Fri, Apr 19, 2024 at 8:12 AM Benjamin Tissoires wrote: > > > It's something I added while adding the tests. And some tests were passing > in case I was having a non sleepable callback. But if we have > bpf_rcu_read_lock(), we are all fine and can reduce the complexity. Not quite following

Re: [PATCH 02/10] KVM: x86: Improve accuracy of KVM clock when TSC scaling is in force

2024-04-19 Thread Paul Durrant
On 18/04/2024 20:34, David Woodhouse wrote: From: David Woodhouse The kvm_guest_time_update() function scales the host TSC frequency to the guest's using kvm_scale_tsc() and the v->arch.l1_tsc_scaling_ratio scaling ratio previously calculated for that vCPU. Then calcuates the scaling factors

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

2024-04-19 Thread Conor Dooley
On Thu, Apr 18, 2024 at 02:42:24PM +0200, Clément Léger wrote: > 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

Re: [PATCH v10 0/5] Introduce mseal

2024-04-19 Thread Jeff Xu
On Fri, Apr 19, 2024 at 7:57 AM Suren Baghdasaryan wrote: > > On Thu, Apr 18, 2024 at 6:22 PM Jeff Xu wrote: > > > > On Thu, Apr 18, 2024 at 1:19 PM Suren Baghdasaryan > > wrote: > > > > > > On Tue, Apr 16, 2024 at 12:40 PM Jeff Xu wrote: > > > > > > > > On Tue, Apr 16, 2024 at 8:13 AM Liam

Re: [PATCH bpf-next 17/18] bpf: add bpf_wq_start

2024-04-19 Thread Benjamin Tissoires
On Apr 18 2024, Alexei Starovoitov wrote: > On Tue, Apr 16, 2024 at 04:08:30PM +0200, Benjamin Tissoires wrote: > > again, copy/paste from bpf_timer_start(). > > > > Signed-off-by: Benjamin Tissoires > > --- > > kernel/bpf/helpers.c | 24 > > 1 file changed, 24

Re: [PATCH bpf-next 11/18] bpf: wq: add bpf_wq_init

2024-04-19 Thread Benjamin Tissoires
On Apr 18 2024, Alexei Starovoitov wrote: > On Tue, Apr 16, 2024 at 04:08:24PM +0200, Benjamin Tissoires wrote: > > We need to teach the verifier about the second argument which is declared > > as void * but which is of type KF_ARG_PTR_TO_MAP. We could have dropped > > this extra case if we

Re: [PATCH v10 0/5] Introduce mseal

2024-04-19 Thread Suren Baghdasaryan
On Thu, Apr 18, 2024 at 6:22 PM Jeff Xu wrote: > > On Thu, Apr 18, 2024 at 1:19 PM Suren Baghdasaryan wrote: > > > > On Tue, Apr 16, 2024 at 12:40 PM Jeff Xu wrote: > > > > > > On Tue, Apr 16, 2024 at 8:13 AM Liam R. Howlett > > > wrote: > > > > > > > > * jef...@chromium.org [240415 12:35]:

Re: [PATCH v2 09/25] KVM: VMX: Switch FRED RSP0 between host and guest

2024-04-19 Thread Chao Gao
On Wed, Feb 07, 2024 at 09:26:29AM -0800, Xin Li wrote: >Switch MSR_IA32_FRED_RSP0 between host and guest in >vmx_prepare_switch_to_{host,guest}(). > >MSR_IA32_FRED_RSP0 is used during ring 3 event delivery only, thus >KVM, running on ring 0, can run safely with guest FRED RSP0, i.e., >no need to

Re: [PATCH v4 2/2] kunit: avoid memory leak on device register error

2024-04-19 Thread Wander Lairson Costa
On Fri, Apr 19, 2024 at 11:03 AM Greg Kroah-Hartman wrote: > > On Fri, Apr 19, 2024 at 10:25:02AM -0300, Wander Lairson Costa wrote: > > If the device register fails, free the allocated memory before > > returning. > > > > Signed-off-by: Wander Lairson Costa > > Fixes: d03c720e03bd ("kunit: Add

Re: [PATCH v4 1/2] kunit: unregister the device on error

2024-04-19 Thread Greg Kroah-Hartman
On Fri, Apr 19, 2024 at 10:25:01AM -0300, Wander Lairson Costa wrote: > kunit_init_device() should unregister the device on bus register error, > but mistakenly it tries to unregister the bus. > > Unregister the device instead of the bus. > > Signed-off-by: Wander Lairson Costa > Fixes:

Re: [PATCH v4 2/2] kunit: avoid memory leak on device register error

2024-04-19 Thread Greg Kroah-Hartman
On Fri, Apr 19, 2024 at 10:25:02AM -0300, Wander Lairson Costa wrote: > If the device register fails, free the allocated memory before > returning. > > Signed-off-by: Wander Lairson Costa > Fixes: d03c720e03bd ("kunit: Add APIs for managing devices") > --- > lib/kunit/device.c | 1 + > 1 file

  1   2   >