Re: [PATCH bpf-next v2 2/2] selftests/bpf: Export send_recv_data helper

2024-04-08 Thread Martin KaFai Lau
On 4/8/24 8:51 PM, Geliang Tang wrote: +static void *send_recv_server(void *arg) +{ + struct send_recv_arg *a = (struct send_recv_arg *)arg; + ssize_t nr_sent = 0, bytes = 0; + char batch[1500]; + int err = 0, fd; + + fd = accept(a->fd, NULL, NULL); + while

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

2024-04-08 Thread David Woodhouse
On Mon, 2024-04-08 at 17:43 -0700, Dongli Zhang wrote: > Hi Jack, > > On 4/8/24 15:07, 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

Re: [PATCH bpf-next v2 2/2] selftests/bpf: Export send_recv_data helper

2024-04-08 Thread Geliang Tang
Hi Martin, On Mon, 2024-04-08 at 11:45 +0800, Geliang Tang wrote: > From: Geliang Tang > > This patch extracts the code to send and receive data into a new > helper named send_recv_data() in network_helpers.c and export it > in network_helpers.h. > > This helper will be used for MPTCP BPF

Re: [PATCH RFC bpf-next v6 0/6] sleepable bpf_timer (was: allow HID-BPF to do device IOs)

2024-04-08 Thread Alexei Starovoitov
On Mon, Apr 8, 2024 at 1:09 AM Benjamin Tissoires wrote: > > New version of the sleepable bpf_timer code. > > I'm posting this as this is the result of the previous review, so we can > have a baseline to compare to. > > The plan is now to introduce a new user API struct bpf_wq, as the timer > API

[PATCH net-next 4/4] selftests: net: reuse common code in bpf_offload

2024-04-08 Thread Jakub Kicinski
net/lib/py/nsim.py already contains the most useful parts of the netdevsim wrapper classes. Reuse them. Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/bpf_offload.py | 120 + tools/testing/selftests/net/lib/py/nsim.py | 9 +- 2 files changed, 35

[PATCH net-next 3/4] selftests: net: declare section names for bpf_offload

2024-04-08 Thread Jakub Kicinski
Non-ancient ip (iproute2-5.15.0, libbpf 0.7.0) refuses to load the sample with maps because we don't generate BTF: libbpf: BTF is required, but is missing or corrupted. ERROR: opening BPF object file failed Enable BTF by adding -g to clang flags. With that done neither of the programs

[PATCH net-next 1/4] selftests: move bpf-offload test from bpf to net

2024-04-08 Thread Jakub Kicinski
We're building more python tests on the netdev side, and some of the classes from the venerable BPF offload tests can be reused. Signed-off-by: Jakub Kicinski --- tools/testing/selftests/bpf/Makefile | 1 - tools/testing/selftests/net/Makefile | 8

[PATCH net-next 2/4] selftests: net: bpf_offload: wait for maps

2024-04-08 Thread Jakub Kicinski
Maps are removed asynchronously. Either there's a bigger delay now or the test has always been flaky. Retry waiting in the loop. Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/bpf_offload.py | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git

Re: [PATCH RFC bpf-next v6 6/6] selftests/bpf: add sleepable timer tests

2024-04-08 Thread Alexei Starovoitov
On Mon, Apr 8, 2024 at 4:01 PM Eduard Zingerman wrote: > > > +SEC("tc") > > +/* check that calling bpf_timer_start() with a delay on a sleepable > > + * callback is returning -EINVAL > > + */ > > +__retval(-22) > > +long test_call_sleepable_delay(void *ctx) > > +{ > > + int key = 2; > > +

[PATCH net-next 0/4] selftests: move bpf-offload test from bpf to net

2024-04-08 Thread Jakub Kicinski
The test_offload.py test fits in networking and bpf equally well. We started adding more Python tests in networking and some of the code in test_offload.py can be reused, so move it to networking. Looks like it bit rotted over time and some fixes are needed. Admittedly more code could be

Re: [PATCH RFC bpf-next v6 5/6] tools: sync include/uapi/linux/bpf.h

2024-04-08 Thread Alexei Starovoitov
On Mon, Apr 8, 2024 at 1:10 AM Benjamin Tissoires wrote: > > cp include/uapi/linux/bpf.h tools/include/uapi/linux/bpf.h > > Signed-off-by: Benjamin Tissoires > > --- > > updated in v6 > > no changes in v5 > > new in v4 > --- > tools/include/uapi/linux/bpf.h | 20 +--- > 1 file

Re: [PATCH RFC bpf-next v6 4/6] bpf/helpers: mark the callback of bpf_timer_set_sleepable_cb() as sleepable

2024-04-08 Thread Alexei Starovoitov
On Mon, Apr 8, 2024 at 3:36 PM Eduard Zingerman wrote: > > On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > > Now that we have bpf_timer_set_sleepable_cb() available and working, we > > can tag the attached callback as sleepable, and let the verifier check > > in the correct context

[PATCH v7 3/3] KVM: selftests: aarch64: Add invalid filter test in pmu_event_filter_test

2024-04-08 Thread Shaoqin Huang
Add the invalid filter test which sets the filter beyond the event space and sets the invalid action to double check if the KVM_ARM_VCPU_PMU_V3_FILTER will return the expected error. Reviewed-by: Eric Auger Signed-off-by: Shaoqin Huang --- .../kvm/aarch64/pmu_event_filter_test.c | 38

[PATCH v7 2/3] KVM: selftests: aarch64: Introduce pmu_event_filter_test

2024-04-08 Thread Shaoqin Huang
Introduce pmu_event_filter_test for arm64 platforms. The test configures PMUv3 for a vCPU, and sets different pmu event filters for the vCPU, and check if the guest can see those events which user allow and can't use those events which use deny. This test refactor the create_vpmu_vm() and make it

[PATCH v7 1/3] KVM: selftests: aarch64: Add helper function for the vpmu vcpu creation

2024-04-08 Thread Shaoqin Huang
Create a vcpu with vpmu would be a common requirement for the vpmu test, so add the helper function for the vpmu vcpu creation. And use those helper function in the vpmu_counter_access.c test. Use this chance to delete the meaningless ASSERT about the pmuver, because KVM does not advertise an

[PATCH v7 0/3] KVM: selftests: aarch64: Introduce pmu_event_filter_test

2024-04-08 Thread Shaoqin Huang
The test is inspired by the pmu_event_filter_test which implemented by x86. On the arm64 platform, there is the same ability to set the pmu_event_filter through the KVM_ARM_VCPU_PMU_V3_FILTER attribute. So add the test for arm64. The series first create the helper function which can be used for

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Alexei Starovoitov
On Mon, Apr 8, 2024 at 10:20 AM Benjamin Tissoires wrote: > > On Mon, Apr 8, 2024 at 7:08 PM Eduard Zingerman wrote: > > > > On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > > > > [...] > > > > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > > > index

Re: [PATCH] riscv: selftests: Add signal handling vector tests

2024-04-08 Thread Andy Chiu
On Thu, Apr 4, 2024 at 1:47 PM Björn Töpel wrote: > > Charlie Jenkins writes: > > > Add two tests to check vector save/restore when a signal is received > > during a vector routine. One test ensures that a value is not clobbered > > during signal handling. The other verifies that vector

Re: [PATCH] KVM: selftests: fix max_guest_memory_test with more that 256 vCPUs

2024-04-08 Thread Sean Christopherson
On Fri, 15 Mar 2024 10:35:07 -0400, Maxim Levitsky wrote: > max_guest_memory_test uses ucalls to sync with the host, but > it also resets the guest RIP back to its initial value in between > tests stages. > > This makes the guest never reach the code which frees the ucall struct > and since a

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

2024-04-08 Thread Dongli Zhang
Hi Jack, On 4/8/24 15:07, 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 Typo:

Re: [PATCH v5 20/22] KVM: riscv: selftests: Add SBI PMU selftest

2024-04-08 Thread Atish Patra
On 4/5/24 05:50, Andrew Jones wrote: On Wed, Apr 03, 2024 at 01:04:49AM -0700, Atish Patra wrote: ... +static void test_pmu_basic_sanity(void) +{ + long out_val = 0; + bool probe; + struct sbiret ret; + int num_counters = 0, i; + union sbi_pmu_ctr_info ctrinfo; + +

Re: [PATCH v5 12/22] RISC-V: KVM: Implement SBI PMU Snapshot feature

2024-04-08 Thread Atish Patra
On 4/5/24 04:23, Andrew Jones wrote: On Wed, Apr 03, 2024 at 01:04:41AM -0700, Atish Patra wrote: 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

Re: [PATCH v5 06/22] drivers/perf: riscv: Implement SBI PMU snapshot function

2024-04-08 Thread Atish Patra
On 4/4/24 05:01, Andrew Jones wrote: On Wed, Apr 03, 2024 at 01:04:35AM -0700, Atish Patra wrote: ... +static int pmu_sbi_snapshot_disable(void) +{ + struct sbiret ret; + + ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_SNAPSHOT_SET_SHMEM, -1, + -1, 0, 0, 0, 0);

Re: [PATCH v5 04/22] drivers/perf: riscv: Use BIT macro for shifting operations

2024-04-08 Thread Atish Patra
On 4/4/24 04:08, Andrew Jones wrote: On Wed, Apr 03, 2024 at 01:04:33AM -0700, Atish Patra wrote: It is a good practice to use BIT() instead of (1UL << x). (1UL << x) isn't generally a problem. The problem is with (1 << x). Yes. That's why, the commit message said it's good to have :) I

Re: [RFC PATCH v3 6/9] selftests: cgroup: Add basic tests for pids controller

2024-04-08 Thread Waiman Long
On 4/8/24 08:04, Muhammad Usama Anjum wrote: On 4/8/24 5:01 PM, Michal Koutný wrote: On Mon, Apr 08, 2024 at 04:53:11PM +0500, Muhammad Usama Anjum wrote: ksft_test_result_report(tests[i].fn(root), tests[i].name) $ git grep ksft_test_result_report v6.9-rc3 -- (empty result) I can't find

Re: [PATCH v5 03/22] drivers/perf: riscv: Read upper bits of a firmware counter

2024-04-08 Thread Atish Patra
On 4/4/24 04:02, Andrew Jones wrote: On Wed, Apr 03, 2024 at 01:04:32AM -0700, Atish Patra wrote: 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.

Re: [PATCH net-next] selftests/bpf: eliminate warning of get_cgroup_id_from_path()

2024-04-08 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau : On Sat, 6 Apr 2024 22:46:13 +0800 you wrote: > From: Jason Xing > > The output goes like this if I make samples/bpf: > ...warning: no previous prototype for ‘get_cgroup_id_from_path’... > > Make this function

Re: [PATCH RFC bpf-next v6 6/6] selftests/bpf: add sleepable timer tests

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > bpf_experimental.h and ../bpf_testmod/bpf_testmod_kfunc.h are both > including vmlinux.h, which is not compatible with including time.h > or bpf_tcp_helpers.h. > > So keep sleepable tests in a separate bpf source file. > > The first

Re: [PATCH RFC bpf-next v6 4/6] bpf/helpers: mark the callback of bpf_timer_set_sleepable_cb() as sleepable

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > Now that we have bpf_timer_set_sleepable_cb() available and working, we > can tag the attached callback as sleepable, and let the verifier check > in the correct context the calls and kfuncs. > > Signed-off-by: Benjamin Tissoires >

Re: [PATCH] selftests/timers/posix_timers: reimplement check_timer_distribution()

2024-04-08 Thread Thomas Gleixner
On Mon, Apr 08 2024 at 20:49, Oleg Nesterov wrote: > To me this test should simply do > > ksft_test_result(!ctd_failed, "check signal distribution\n"); > return 0; Right. > but I am not familiar with tools/testing/selftests/ and I am not sure > I understand the last email from

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

2024-04-08 Thread Jack Allister
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 and running at a different frequency to the host TSC

Re: [PATCH RFC bpf-next v6 2/6] bpf: Add support for KF_ARG_PTR_TO_TIMER

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 10:09 +0200, bent...@kernel.org wrote: > From: Kumar Kartikeya Dwivedi > > Introduce support for KF_ARG_PTR_TO_TIMER. The kfuncs will use bpf_timer > as argument and that will be recognized as timer argument by verifier. > bpf_timer_kern casting can happen inside kfunc, but

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 19:20 +0200, Benjamin Tissoires wrote: [...] > That was my initial assumption too, but Alexei told me it was fine. > And I think he is correct because kfree_rcu doesn't need the rcu_head > to be initialized. > > So in the end, we initialize the memory as a work_struct, and

Re: [PATCH] selftests/timers/posix_timers: reimplement check_timer_distribution()

2024-04-08 Thread Oleg Nesterov
On 04/08, Oleg Nesterov wrote: > > On 04/08, Dmitry Vyukov wrote: > > > > > > > > if (ctd_failed) > > > ksft_test_result_skip("No signal distribution. Assuming > > > old kernel\n"); > > > > Shouldn't the test fail here? The goal of a test is to fail when > > things don't

Re: [RFC PATCH v3 2/9] cgroup/pids: Separate semantics of pids.events related to pids.max

2024-04-08 Thread Tejun Heo
Hello, On Fri, Apr 05, 2024 at 07:05:41PM +0200, Michal Koutný wrote: > Currently, when pids.max limit is breached in the hierarchy, the event > is counted and reported in the cgroup where the forking task resides. > > This decouples the limit and the notification caused by the limit making > it

Re: [PATCH v2 0/2] cgroup/cpuset: Make cpuset hotplug processing synchronous

2024-04-08 Thread Tejun Heo
On Thu, Apr 04, 2024 at 09:47:47AM -0400, Waiman Long wrote: > v2: > - Found that rebuild_sched_domains() has external callers, revert its > change and introduce rebuild_sched_domains_cpuslocked() instead. > > As discussed in the LKML thread [1], the asynchronous nature of cpuset > hotplug

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Benjamin Tissoires
On Mon, Apr 8, 2024 at 7:08 PM Eduard Zingerman wrote: > > On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > > [...] > > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > > index 9234174ccb21..fd05d4358b31 100644 > > --- a/kernel/bpf/helpers.c > > +++

Re: [PATCH RFC bpf-next v6 3/6] bpf/helpers: introduce bpf_timer_set_sleepable_cb() kfunc

2024-04-08 Thread Benjamin Tissoires
On Mon, Apr 8, 2024 at 4:31 PM Eduard Zingerman wrote: > > On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > [...] > > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > > index fd05d4358b31..d6528359b3f4 100644 > > --- a/kernel/bpf/helpers.c > > +++ b/kernel/bpf/helpers.c

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: [...] > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > index 9234174ccb21..fd05d4358b31 100644 > --- a/kernel/bpf/helpers.c > +++ b/kernel/bpf/helpers.c > @@ -1096,12 +1096,19 @@ const struct bpf_func_proto

[PATCH v3 16/16] selftests/resctrl: Remove test name comparing from write_bm_pid_to_resctrl()

2024-04-08 Thread Ilpo Järvinen
write_bm_pid_to_resctrl() uses resctrl_val to check test name which is not a good interface generic resctrl FS functions should provide. Only MBM and CMT tests define mongrp so the test name check in write_bm_pid_to_resctrl() can be changed to depend simply on mongrp being non-NULL. With last

[PATCH v3 15/16] selftests/resctrl: Remove mongrp from MBA test

2024-04-08 Thread Ilpo Järvinen
Nothing during MBA test uses mongrp even if it has been defined ever since the introduction of the MBA test in the commit 01fee6b4d1f9 ("selftests/resctrl: Add MBA test"). Remove the mongrp from MBA test. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/mba_test.c | 1 - 1 file

[PATCH v3 14/16] selftests/resctrl: Convert ctrlgrp & mongrp to pointers

2024-04-08 Thread Ilpo Järvinen
The struct resctrl_val_param has control and monitor groups as char arrays but they are not supposed to be mutated within resctrl_val(). Convert the ctrlgrp and mongrp char array within resctrl_val_param to plain const char pointers and adjust the strlen() based checks to check NULL instead.

[PATCH v3 13/16] selftests/resctrl: Make some strings passed to resctrlfs functions const

2024-04-08 Thread Ilpo Järvinen
Control group, monitor group and resctrl_val are not mutated and should not be mutated within resctrlfs.c functions. Mark this by using const char * for the arguments. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl.h | 7 ---

[PATCH v3 12/16] selftests/resctrl: Simplify bandwidth report type handling

2024-04-08 Thread Ilpo Järvinen
bw_report is only needed for selecting the correct value from the values IMC measured. It is a member in the resctrl_val_param struct and is always set to "reads". The value is then checked in resctrl_val() using validate_bw_report_request() that besides validating the input, assumes it can mutate

[PATCH v3 11/16] selftests/resctrl: Add ->init() callback into resctrl_val_param

2024-04-08 Thread Ilpo Järvinen
The struct resctrl_val_param is there to customize behavior inside resctrl_val() which is currently not used to full extent and there are number of strcmp()s for test name in resctrl_val done by resctrl_val(). Create ->init() hook into the struct resctrl_val_param to cleanly do per test

Re: [PATCH v3 06/15] net: kunit: Suppress lock warning noise at end of dev_addr_lists tests

2024-04-08 Thread Guenter Roeck
On Wed, Apr 03, 2024 at 06:34:12PM -0700, Jakub Kicinski wrote: > On Wed, 3 Apr 2024 06:19:27 -0700 Guenter Roeck wrote: > > dev_addr_lists_test generates lock warning noise at the end of tests > > if lock debugging is enabled. There are two sets of warnings. > > > > WARNING: CPU: 0 PID: 689 at

[PATCH v3 10/16] selftests/resctrl: Add ->measure() callback to resctrl_val_param

2024-04-08 Thread Ilpo Järvinen
The measurement done in resctrl_val() varies depending on test type. The decision for how to measure is decided based on the string compare to test name which is quite inflexible. Add ->measure() callback into the struct resctrl_val_param to allow each test to provide necessary code as a function

[PATCH v3 07/16] selftests/resctrl: Cleanup bm_pid and ppid usage & limit scope

2024-04-08 Thread Ilpo Järvinen
'bm_pid' and 'ppid' are global variables. As they are used by different processes and in signal handler, they cannot be entirely converted into local variables. The scope of those variables can still be reduced into resctrl_val.c only. As PARENT_EXIT() macro is using 'ppid', make it a function in

[PATCH v3 06/16] selftests/resctrl: Use correct type for pids

2024-04-08 Thread Ilpo Järvinen
A few functions receive PIDs through int arguments. PIDs variables should be of type pid_t, not int. Convert pid arguments from int to pid_t. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cache.c | 6 +++--- tools/testing/selftests/resctrl/resctrl.h | 4 ++--

[PATCH v3 09/16] selftests/resctrl: Simplify mem bandwidth file code for MBA & MBM tests

2024-04-08 Thread Ilpo Järvinen
initialize_mem_bw_resctrl() and set_mbm_path() contain complicated set of conditions, each yielding different file to be opened to measure memory bandwidth through resctrl FS. In practice, only two of them are used. For MBA test, ctrlgrp is always provided, and for MBM test both ctrlgrp and mongrp

[PATCH v3 08/16] selftests/resctrl: Rename measure_vals() to measure_mem_bw_vals() & document

2024-04-08 Thread Ilpo Järvinen
measure_val() is awfully generic name so rename it to measure_mem_bw() to describe better what it does and document the function parameters. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl_val.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff

[PATCH v3 05/16] selftests/resctrl: Consolidate get_domain_id() into resctrl_val()

2024-04-08 Thread Ilpo Järvinen
Both initialize_mem_bw_resctrl() and initialize_llc_occu_resctrl() that are called from resctrl_val() need to determine domain ID to construct resctrl fs related paths. Both functions do it by taking CPU ID which neither needs for any other purpose than determining the domain ID. Consolidate

[PATCH v3 04/16] selftests/resctrl: Make "bandwidth" consistent in comments & prints

2024-04-08 Thread Ilpo Järvinen
Resctrl selftests refer to "bandwidth" currently in two other forms in the code ("B/W" and "band width"). Use "bandwidth" consistently everywhere. While at it, fix also one "over flow" -> "overflow" on a line that is touched by the change. Suggested-by: Reinette Chatre Signed-off-by: Ilpo

[PATCH v3 03/16] selftests/resctrl: Fix closing IMC fds on error

2024-04-08 Thread Ilpo Järvinen
If perf_open_imc_mem_bw() fails to open for a perf fd after the first one, the already opened fds remain open and error is directly returned. Close the fds inside perf_open_imc_mem_bw() if an error occurs. Fixes: 7f4d257e3a2a ("selftests/resctrl: Add callback to start a benchmark")

[PATCH v3 02/16] selftests/resctrl: Calculate resctrl FS derived mem bw over sleep(1) only

2024-04-08 Thread Ilpo Järvinen
For MBM/MBA tests, measure_vals() calls get_mem_bw_imc() that performs the measurement over a duration of sleep(1) call. The memory bandwidth numbers from IMC are derived over this duration. The resctrl FS derived memory bandwidth, however, is calculated inside measure_vals() and only takes delta

[PATCH v3 01/16] selftests/resctrl: Open get_mem_bw_imc() fd for loops

2024-04-08 Thread Ilpo Järvinen
get_mem_bw_imc() handles fds in a for loop but close() is based on two fixed indexes READ and WRITE. Open code all for loops to READ+WRITE entries for clarity. Suggested-by: Reinette Chatre Signed-off-by: Ilpo Järvinen --- v3: - Rework entirely, use open coding instead of for loops for

[PATCH v3 00/16] selftests/resctrl: resctrl_val() related cleanups & improvements

2024-04-08 Thread Ilpo Järvinen
Hi all, This series does a number of cleanups into resctrl_val() and generalizes it by removing test name specific handling from the function. One of the changes improves MBA/MBM measurement by narrowing down the period the resctrl FS derived memory bandwidth numbers are measured over. My feel

Re: [RFC PATCH net-next v8 14/14] selftests: add ncdevmem, netcat for devmem TCP

2024-04-08 Thread Cong Wang
On Tue, Apr 02, 2024 at 05:20:51PM -0700, Mina Almasry wrote: > +static char *server_ip = "192.168.1.4"; > +static char *client_ip = "192.168.1.2"; > +static char *port = "5201"; > +static size_t do_validation; > +static int start_queue = 8; > +static int num_queues = 8; > +static char *ifname =

Re: [RFC PATCH net-next v6 02/15] net: page_pool: create hooks for custom page providers

2024-04-08 Thread Cong Wang
On Mon, Apr 01, 2024 at 12:22:24PM -0700, Mina Almasry wrote: > On Thu, Mar 28, 2024 at 12:31 AM Christoph Hellwig wrote: > > > > On Tue, Mar 26, 2024 at 01:19:20PM -0700, Mina Almasry wrote: > > > > > > Are you envisioning that dmabuf support would be added to the block > > > layer > > > > Yes.

Re: [PATCH net-next] selftests/bpf: eliminate warning of get_cgroup_id_from_path()

2024-04-08 Thread Yonghong Song
On 4/6/24 7:46 AM, Jason Xing wrote: From: Jason Xing The output goes like this if I make samples/bpf: ...warning: no previous prototype for ‘get_cgroup_id_from_path’... The CI does not build samples/bpf... Make this function static could solve the warning problem since no one outside

Re: [PATCH v2 1/2] cgroup/cpuset: Make cpuset hotplug processing synchronous

2024-04-08 Thread Valentin Schneider
On 04/04/24 09:47, Waiman Long wrote: > Since commit 3a5a6d0c2b03("cpuset: don't nest cgroup_mutex inside > get_online_cpus()"), cpuset hotplug was done asynchronously via a work > function. This is to avoid recursive locking of cgroup_mutex. > > Since then, the cgroup locking scheme has changed

Re: [PATCH RFC bpf-next v6 3/6] bpf/helpers: introduce bpf_timer_set_sleepable_cb() kfunc

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: [...] > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > index fd05d4358b31..d6528359b3f4 100644 > --- a/kernel/bpf/helpers.c > +++ b/kernel/bpf/helpers.c [...] > @@ -2726,6 +2764,7 @@ BTF_ID_FLAGS(func, bpf_dynptr_is_null)

Re: [PATCH 0/5] Add parsing for Zimop ISA extension

2024-04-08 Thread Andrew Jones
On Mon, Apr 08, 2024 at 01:19:39PM +0200, Clément Léger wrote: > > > On 08/04/2024 13:03, Andrew Jones wrote: > > On Mon, Apr 08, 2024 at 10:01:12AM +0200, Clément Léger wrote: > >> > >> > >> On 05/04/2024 19:33, Deepak Gupta wrote: > >>> On Fri, Apr 5, 2024 at 8:26 AM Andrew Jones > >>>

Re: [PATCH 4/4] selftests: Add build infrastructure along with README

2024-04-08 Thread Mark Brown
On Sun, Apr 07, 2024 at 02:15:15AM +0500, Muhammad Usama Anjum wrote: > On 4/5/24 1:44 PM, Dev Jain wrote: > > @@ -0,0 +1,31 @@ > > +KSelfTest ARM > > +=== > > + > > +- This is a series of compatibility tests, wherein the source files are > > + built statically into a 32 bit ELF;

Re: [PATCH 2/4] selftests/arm: Add signal tests

2024-04-08 Thread Mark Brown
On Sun, Apr 07, 2024 at 02:28:06AM +0500, Muhammad Usama Anjum wrote: > On 4/5/24 1:44 PM, Dev Jain wrote: > > + ksft_print_msg("%s :: %s\n", current->name, current->descr); > > + if (test_setup(current) && test_init(current)) { > > + test_run(current); > > +

Re: [RFC PATCH v3 6/9] selftests: cgroup: Add basic tests for pids controller

2024-04-08 Thread Muhammad Usama Anjum
On 4/8/24 5:01 PM, Michal Koutný wrote: > On Mon, Apr 08, 2024 at 04:53:11PM +0500, Muhammad Usama Anjum > wrote: >> ksft_test_result_report(tests[i].fn(root), tests[i].name) > > $ git grep ksft_test_result_report v6.9-rc3 -- > (empty result) > > I can't find that helper. Is that in some

Re: Re: [RFC PATCH v3 6/9] selftests: cgroup: Add basic tests for pids controller

2024-04-08 Thread Michal Koutný
On Mon, Apr 08, 2024 at 04:53:11PM +0500, Muhammad Usama Anjum wrote: > ksft_test_result_report(tests[i].fn(root), tests[i].name) $ git grep ksft_test_result_report v6.9-rc3 -- (empty result) I can't find that helper. Is that in some devel repositories? Michal signature.asc Description:

Re: [RFC PATCH v3 6/9] selftests: cgroup: Add basic tests for pids controller

2024-04-08 Thread Muhammad Usama Anjum
On 4/8/24 4:29 PM, Michal Koutný wrote: > On Sun, Apr 07, 2024 at 02:37:44AM +0500, Muhammad Usama Anjum > wrote: >> The >> ksft_print_header(); >> ksft_set_plan(total_number_of_tests); >> are missing. Please use all of the ksft APIs to make the test TAP compliant. > > Will do. > >>>

Re: Re: [RFC PATCH v3 6/9] selftests: cgroup: Add basic tests for pids controller

2024-04-08 Thread Michal Koutný
On Sun, Apr 07, 2024 at 02:37:44AM +0500, Muhammad Usama Anjum wrote: > The > ksft_print_header(); > ksft_set_plan(total_number_of_tests); > are missing. Please use all of the ksft APIs to make the test TAP compliant. Will do. > > + for (i = 0; i < ARRAY_SIZE(tests); i++) { > > +

Re: [PATCH 0/5] Add parsing for Zimop ISA extension

2024-04-08 Thread Clément Léger
On 08/04/2024 13:03, Andrew Jones wrote: > On Mon, Apr 08, 2024 at 10:01:12AM +0200, Clément Léger wrote: >> >> >> On 05/04/2024 19:33, Deepak Gupta wrote: >>> On Fri, Apr 5, 2024 at 8:26 AM Andrew Jones wrote: On Thu, Apr 04, 2024 at 12:32:46PM +0200, Clément Léger wrote: > The

Re: [PATCH 0/5] Add parsing for Zimop ISA extension

2024-04-08 Thread Andrew Jones
On Thu, Apr 04, 2024 at 12:32:46PM +0200, Clément Léger wrote: > The Zimop ISA extension was ratified recently. This series adds support > for parsing it from riscv,isa, hwprobe export and kvm support for > Guest/VM. > > Clément Léger (5): > dt-bindings: riscv: add Zimop ISA extension

Re: [PATCH 0/5] Add parsing for Zimop ISA extension

2024-04-08 Thread Andrew Jones
On Mon, Apr 08, 2024 at 10:01:12AM +0200, Clément Léger wrote: > > > On 05/04/2024 19:33, Deepak Gupta wrote: > > On Fri, Apr 5, 2024 at 8:26 AM Andrew Jones wrote: > >> > >> On Thu, Apr 04, 2024 at 12:32:46PM +0200, Clément Léger wrote: > >>> The Zimop ISA extension was ratified recently. This

Re: [PATCH net-next 00/11] selftests: mptcp: cleanups and 'ip mptcp' support

2024-04-08 Thread patchwork-bot+netdevbpf
Hello: This series was applied to netdev/net-next.git (main) by David S. Miller : On Fri, 05 Apr 2024 12:52:04 +0200 you wrote: > Here are some patches from Geliang, doing different cleanups, and > supporting 'ip mptcp' in more MPTCP selftests. > > Patch 1 checks that TC is available in

Re: [PATCH net-next v3 0/5] selftests: net: groundwork for YNL-based tests

2024-04-08 Thread patchwork-bot+netdevbpf
Hello: This series was applied to netdev/net-next.git (main) by David S. Miller : On Thu, 4 Apr 2024 19:45:21 -0700 you wrote: > Currently the options for writing networking tests are C, bash or > some mix of the two. YAML/Netlink gives us the ability to easily > interface with Netlink in

Re: [PATCH] selftests/timers/posix_timers: reimplement check_timer_distribution()

2024-04-08 Thread Oleg Nesterov
On 04/08, Dmitry Vyukov wrote: > > > > > if (ctd_failed) > > ksft_test_result_skip("No signal distribution. Assuming old > > kernel\n"); > > Shouldn't the test fail here? The goal of a test is to fail when > things don't work. I've copied this from the previous patch from

Re: [PATCH] selftests/timers/posix_timers: reimplement check_timer_distribution()

2024-04-08 Thread Thomas Gleixner
On Mon, Apr 08 2024 at 10:30, Dmitry Vyukov wrote: > On Sat, 6 Apr 2024 at 17:12, Oleg Nesterov wrote: >> if (ctd_failed) >> ksft_test_result_skip("No signal distribution. Assuming old >> kernel\n"); > > Shouldn't the test fail here? The goal of a test is to fail when >

Re: [PATCH] selftests/timers/posix_timers: reimplement check_timer_distribution()

2024-04-08 Thread Dmitry Vyukov
On Sat, 6 Apr 2024 at 17:12, Oleg Nesterov wrote: > > Dmitry, Thomas, > > To simplify the review I've attached the code with this patch applied below. > > Yes, this changes the "semantics" of check_timer_distribution(), perhaps it > should be renamed. > > But I do not see a better approach, and

[PATCH RFC bpf-next v6 6/6] selftests/bpf: add sleepable timer tests

2024-04-08 Thread Benjamin Tissoires
bpf_experimental.h and ../bpf_testmod/bpf_testmod_kfunc.h are both including vmlinux.h, which is not compatible with including time.h or bpf_tcp_helpers.h. So keep sleepable tests in a separate bpf source file. The first correct test is run twice for convenience: - first through RUN_TESTS - then

[PATCH RFC bpf-next v6 5/6] tools: sync include/uapi/linux/bpf.h

2024-04-08 Thread Benjamin Tissoires
cp include/uapi/linux/bpf.h tools/include/uapi/linux/bpf.h Signed-off-by: Benjamin Tissoires --- updated in v6 no changes in v5 new in v4 --- tools/include/uapi/linux/bpf.h | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git

[PATCH RFC bpf-next v6 4/6] bpf/helpers: mark the callback of bpf_timer_set_sleepable_cb() as sleepable

2024-04-08 Thread Benjamin Tissoires
Now that we have bpf_timer_set_sleepable_cb() available and working, we can tag the attached callback as sleepable, and let the verifier check in the correct context the calls and kfuncs. Signed-off-by: Benjamin Tissoires --- no changes in v6 no changes in v5 changes in v4: - use a function

[PATCH RFC bpf-next v6 3/6] bpf/helpers: introduce bpf_timer_set_sleepable_cb() kfunc

2024-04-08 Thread Benjamin Tissoires
In this patch, bpf_timer_set_sleepable_cb() is functionally equivalent to bpf_timer_set_callback(), to the exception that it enforces the timer to be started with BPF_F_TIMER_SLEEPABLE. But given that bpf_timer_set_callback() is a helper when bpf_timer_set_sleepable_cb() is a kfunc, we need to

[PATCH RFC bpf-next v6 2/6] bpf: Add support for KF_ARG_PTR_TO_TIMER

2024-04-08 Thread bentiss
From: Kumar Kartikeya Dwivedi Introduce support for KF_ARG_PTR_TO_TIMER. The kfuncs will use bpf_timer as argument and that will be recognized as timer argument by verifier. bpf_timer_kern casting can happen inside kfunc, but using bpf_timer in argument makes life easier for users who work with

[PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Benjamin Tissoires
They are implemented as a workqueue, which means that there are no guarantees of timing nor ordering. Signed-off-by: Benjamin Tissoires --- changes in v6: - dropped extra spinlock - implement cancel_and_free of a sleepable timer through a dedicated workqueue no changes in v5 changes in v4:

[PATCH RFC bpf-next v6 0/6] sleepable bpf_timer (was: allow HID-BPF to do device IOs)

2024-04-08 Thread Benjamin Tissoires
New version of the sleepable bpf_timer code. I'm posting this as this is the result of the previous review, so we can have a baseline to compare to. The plan is now to introduce a new user API struct bpf_wq, as the timer API working on softIRQ seems to be quite far away from a wq. For

Re: [PATCH 0/5] Add parsing for Zimop ISA extension

2024-04-08 Thread Clément Léger
On 05/04/2024 19:33, Deepak Gupta wrote: > On Fri, Apr 5, 2024 at 8:26 AM Andrew Jones wrote: >> >> On Thu, Apr 04, 2024 at 12:32:46PM +0200, Clément Léger wrote: >>> The Zimop ISA extension was ratified recently. This series adds support >>> for parsing it from riscv,isa, hwprobe export and

[PATCH v4 RESEND 7/7] kunit: Add tests for fault

2024-04-08 Thread Mickaël Salaün
Add a test case to check NULL pointer dereference and make sure it would result as a failed test. The full kunit_fault test suite is marked as skipped when run on UML because it would result to a kernel panic. Tested with: ./tools/testing/kunit/kunit.py run --arch x86_64 kunit_fault

[PATCH v4 RESEND 6/7] kunit: Print last test location on fault

2024-04-08 Thread Mickaël Salaün
This helps identify the location of test faults with opportunistic calls to _KUNIT_SAVE_LOC(). This can be useful while writing tests or debugging them. It is possible to call KUNIT_SUCCESS() to explicit save last location. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan

[PATCH v4 RESEND 4/7] kunit: Handle test faults

2024-04-08 Thread Mickaël Salaün
Previously, when a kernel test thread crashed (e.g. NULL pointer dereference, general protection fault), the KUnit test hanged for 30 seconds and exited with a timeout error. Fix this issue by waiting on task_struct->vfork_done instead of the custom kunit_try_catch.try_completion, and track the

[PATCH v4 RESEND 5/7] kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests

2024-04-08 Thread Mickaël Salaün
Fix KUNIT_SUCCESS() calls to pass a test argument. This is a no-op for now because this macro does nothing, but it will be required for the next commit. Cc: Brendan Higgins Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Reviewed-by: David Gow Signed-off-by: Mickaël Salaün Link:

[PATCH v4 RESEND 3/7] kunit: Fix timeout message

2024-04-08 Thread Mickaël Salaün
The exit code is always checked, so let's properly handle the -ETIMEDOUT error code. Cc: Brendan Higgins Cc: Shuah Khan Reviewed-by: Kees Cook Reviewed-by: David Gow Reviewed-by: Rae Moar Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240408074625.65017-4-...@digikod.net

[PATCH v4 RESEND 1/7] kunit: Handle thread creation error

2024-04-08 Thread Mickaël Salaün
Previously, if a thread creation failed (e.g. -ENOMEM), the function was called (kunit_catch_run_case or kunit_catch_run_case_cleanup) without marking the test as failed. Instead, fill try_result with the error code returned by kthread_run(), which will mark the test as failed and print "internal

[PATCH v4 RESEND 0/7] Handle faults in KUnit tests

2024-04-08 Thread Mickaël Salaün
Hi, This patch series teaches KUnit to handle kthread faults as errors, and it brings a few related fixes and improvements. Shuah, everything should be OK now, could you please merge this series? All these tests pass (on top of v6.8): ./tools/testing/kunit/kunit.py run --alltests

[PATCH v4 RESEND 2/7] kunit: Fix kthread reference

2024-04-08 Thread Mickaël Salaün
There is a race condition when a kthread finishes after the deadline and before the call to kthread_stop(), which may lead to use after free. Cc: Brendan Higgins Cc: Shuah Khan Reviewed-by: Kees Cook Fixes: adf505457032 ("kunit: fix UAF when run kfence test case test_gfpzero") Reviewed-by: