Re: [PATCH] vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines.

2025-01-30 Thread Dragos Tatulea
On 01/30, Konstantin Shkolnyy wrote: > mlx5_vdpa_dev_add() doesn’t initialize mvdev->actual_features. It’s > initialized later by mlx5_vdpa_set_driver_features(). However, > mlx5_vdpa_get_config() depends on the VIRTIO_F_VERSION_1 flag in > actual_features to return data with correct endianness. Wh

[PATCH bpf-next v4 13/14] selftests/bpf: test_xdp_veth: Add XDP program on egress test

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
XDP programs loaded on egress is tested by test_xdp_redirect_multi.sh but not by the test_progs framework. Add a test case in test_xdp_veth.c to test the XDP program on egress. Use the same BPF program than test_xdp_redirect_multi.sh that replaces the source MAC address by one provided through a B

Re: [PATCH] virtio_console: Convert to use devm funcs

2025-01-30 Thread Arnd Bergmann
On Wed, Jan 29, 2025, at 12:48, oushixiong wrote: > 在 2025/1/28 17:39, Amit Shah 写道: >> On Tue, 2025-01-28 at 13:52 +0800, oushixiong1...@163.com wrote: >> >> Hm, I'm not entirely sure about this - the devm_ interface is better, >> but to me that just says that it's an extra safety net that avoids

[PATCH bpf-next v4 14/14] selftests/bpf: Remove test_xdp_redirect_multi.sh

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The tests done by test_xdp_redirect_multi.sh are now fully covered by the CI through test_xdp_veth.c. Remove test_xdp_redirect_multi.sh Remove xdp_redirect_multi.c that was used by the script to load and attach the BPF programs. Remove their entries in the Makefile Acked-by: Stanislav Fomichev S

[PATCH bpf-next v4 12/14] selftests/bpf: test_xdp_veth: Add XDP broadcast redirection tests

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
XDP redirections with BPF_F_BROADCAST and BPF_F_EXCLUDE_INGRESS flags are tested by test_xdp_redirect_multi.sh but not within the test_progs framework. Add a broadcast test case in test_xdp_veth.c to test them. Use the same BPF programs than the one used by test_xdp_redirect_multi.sh. Use a BPF ma

[PATCH bpf-next v4 11/14] selftests/bpf: Optionally select broadcasting flags

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
Broadcasting flags are hardcoded for each kind for protocol. Create a redirect_flags map that allows to select the broadcasting flags to use in the bpf_redirect_map(). The protocol ID is used as a key. Set the old hardcoded values as default if the map isn't filled by the BPF caller. Acked-by: St

[PATCH bpf-next v4 10/14] selftests/bpf: test_xdp_veth: Add new test cases for XDP flags

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The XDP redirection is tested without any flag provided to the xdp_attach() function. Add two subtests that check the correct behaviour with XDP_FLAGS_{DRV/SKB}_MODE flags Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_xdp

[PATCH bpf-next v4 09/14] selftests/bpf: test_xdp_veth: Use unique names

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The network namespaces and the veth used by the tests have hardcoded names that can conflict with other tests during parallel runs. Use the append_tid() helper to ensure the uniqueness of these names. Use the static network configuration table as a template on which thread IDs are appended in each

[PATCH bpf-next v4 07/14] selftests/bpf: test_xdp_veth: Add prog_config[] table

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The BPF program attached to each veth is hardcoded through the use of the struct skeletons. It prevents from re-using the initialization code in new test cases. Replace the struct skeletons by a bpf_object table. Add a struct prog_configuration that holds the name of BPF program to load on a given

[PATCH bpf-next v4 08/14] selftests/bpf: test_xdp_veth: Add XDP flags to prog_configuration

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
XDP flags are hardcoded to 0 at attachment. Add flags attributes to the struct prog_configuration to allow flag modifications for each test case. Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c | 14 +++

[PATCH bpf-next v4 05/14] selftests/bpf: test_xdp_veth: Split network configuration

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
configure_network() does two things : it first creates the network topology and then configures the BPF maps to fit the test needs. This isn't convenient if we want to re-use the same network topology for different test cases. Rename configure_network() create_network(). Move the BPF configuration

[PATCH bpf-next v4 04/14] selftests/bpf: test_xdp_veth: Use int to describe next veth

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
In the struct veth_configuration, the next_veth string is used to tell the next virtual interface to which packets must be redirected to. So it has to match the local_veth string of an other veth_configuration. Change next_veth type to int to avoid handling two identical strings. This integer is u

[PATCH bpf-next v4 06/14] selftests/bpf: test_xdp_veth: Rename config[]

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The network topology is held by the config[] table. This 'config' name is a bit too generic if we want to add other configuration variables. Rename config[] to net_config[]. Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_x

[PATCH bpf-next v4 03/14] selftests/bpf: test_xdp_veth: Remove unecessarry check_ping()

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
check_ping() directly returns a SYS_NOFAIL without any previous treatment. It's called only once in the file and hardcodes the used namespace and ip address. Replace check_ping() with a direct call of SYS_NOFAIL in the test. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/

[PATCH bpf-next v4 02/14] selftests/bpf: test_xdp_veth: Remove unused defines

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
IP_CMD_MAX_LEN and NS_SUFFIX_LEN aren't used anywhere. Remove these unused defines Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_xdp_

[PATCH bpf-next v4 01/14] selftests/bpf: helpers: Add append_tid()

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
Some tests can't be run in parallel because they use same namespace names or veth names. Create an helper that appends the thread ID to a given string. 8 characters are used for it (7 digits + '\0') Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/network_help

[PATCH bpf-next v4 00/14] selftests/bpf: Migrate test_xdp_redirect_multi.sh to test_progs

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
Hi all, This patch series continues the work to migrate the *.sh tests into prog_tests framework. test_xdp_redirect_multi.sh tests the XDP redirections done through bpf_redirect_map(). This is already partly covered by test_xdp_veth.c that already tests map redirections at XDP level. What isn't

[PATCH v2 1/2] selftests/bpf: Define SYS_PREFIX for powerpc

2025-01-30 Thread Saket Kumar Bhaskar
Since commit 7e92e01b7245 ("powerpc: Provide syscall wrapper") landed in v6.1, syscall wrapper is enabled on powerpc. Commit 94746890202c ("powerpc: Don't add __powerpc_ prefix to syscall entry points") , that drops the prefix to syscall entry points, also landed in the same release. So, add the m

[PATCH v2 2/2] selftests/bpf: Select NUMA_NO_NODE to create map

2025-01-30 Thread Saket Kumar Bhaskar
On powerpc, a CPU does not necessarily originate from NUMA node 0. This contrasts with architectures like x86, where CPU 0 is not hot-pluggable, making NUMA node 0 a consistently valid node. This discrepancy can lead to failures when creating a map on NUMA node 0, which is initialized by default, i

Re: [PATCH] selftests: bpf: Support dynamic linking LLVM if static not available

2025-01-30 Thread Yonghong Song
On 1/30/25 2:33 PM, Daniel Xu wrote: Since 67ab80a01886 ("selftests/bpf: Prefer static linking for LLVM libraries"), only statically linking test_progs is supported. However, some distros only provide a dynamically linkable LLVM. This commit adds a fallback for dynamically linking LLVM if st

Re: [PATCH] selftests: bpf: Support dynamic linking LLVM if static not available

2025-01-30 Thread Yonghong Song
On 1/30/25 2:33 PM, Daniel Xu wrote: Since 67ab80a01886 ("selftests/bpf: Prefer static linking for LLVM libraries"), only statically linking test_progs is supported. However, some distros only provide a dynamically linkable LLVM. This commit adds a fallback for dynamically linking LLVM if st

Re: [PATCH] selftests: bpf: Support dynamic linking LLVM if static not available

2025-01-30 Thread Eduard Zingerman
On Thu, 2025-01-30 at 15:33 -0700, Daniel Xu wrote: > Since 67ab80a01886 ("selftests/bpf: Prefer static linking for LLVM > libraries"), only statically linking test_progs is supported. However, > some distros only provide a dynamically linkable LLVM. > > This commit adds a fallback for dynamically

Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Andrew Morton
On Thu, 30 Jan 2025 23:10:53 + Pedro Falcato wrote: > On Thu, Jan 30, 2025 at 10:53 PM Lorenzo Stoakes > wrote: > > > > > The above code sequence doesn't seem at all onerous. I'm not > > > understanding why it's worth altering the kernel to permit this little > > > shortcut? > > > > In pra

Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Pedro Falcato
On Thu, Jan 30, 2025 at 10:53 PM Lorenzo Stoakes wrote: > > On Thu, Jan 30, 2025 at 02:37:54PM -0800, Andrew Morton wrote: > > On Thu, 30 Jan 2025 20:40:25 + Lorenzo Stoakes > > wrote: > > > > > If you wish to utilise a pidfd interface to refer to the current process > > > or > > > thread i

Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Lorenzo Stoakes
On Thu, Jan 30, 2025 at 02:37:54PM -0800, Andrew Morton wrote: > On Thu, 30 Jan 2025 20:40:25 + Lorenzo Stoakes > wrote: > > > If you wish to utilise a pidfd interface to refer to the current process or > > thread it is rather cumbersome, requiring something like: > > > > int pidfd = pidf

Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Andrew Morton
On Thu, 30 Jan 2025 20:40:25 + Lorenzo Stoakes wrote: > If you wish to utilise a pidfd interface to refer to the current process or > thread it is rather cumbersome, requiring something like: > > int pidfd = pidfd_open(getpid(), 0 or PIDFD_THREAD); > > ... > > close(pidf

[PATCH] selftests: bpf: Support dynamic linking LLVM if static not available

2025-01-30 Thread Daniel Xu
Since 67ab80a01886 ("selftests/bpf: Prefer static linking for LLVM libraries"), only statically linking test_progs is supported. However, some distros only provide a dynamically linkable LLVM. This commit adds a fallback for dynamically linking LLVM if static linking is not available. If both opti

[PATCH] vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines.

2025-01-30 Thread Konstantin Shkolnyy
mlx5_vdpa_dev_add() doesn’t initialize mvdev->actual_features. It’s initialized later by mlx5_vdpa_set_driver_features(). However, mlx5_vdpa_get_config() depends on the VIRTIO_F_VERSION_1 flag in actual_features to return data with correct endianness. When it’s called before mlx5_vdpa_set_driver_fe

[PATCH v7 1/6] pidfd: add PIDFD_SELF* sentinels to refer to own thread/process

2025-01-30 Thread Lorenzo Stoakes
It is useful to be able to utilise the pidfd mechanism to reference the current thread or process (from a userland point of view - thread group leader from the kernel's point of view). Therefore introduce PIDFD_SELF_THREAD to refer to the current thread, and PIDFD_SELF_THREAD_GROUP to refer to the

[PATCH v7 6/6] selftests/mm: use PIDFD_SELF in guard pages test

2025-01-30 Thread Lorenzo Stoakes
Now we have PIDFD_SELF available for process_madvise(), make use of it in the guard pages test. This is both more convenient and asserts that PIDFD_SELF works as expected. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/mm/Makefile | 4 tools/testing/selftests/mm/guard-pag

[PATCH v7 5/6] selftests: pidfd: add tests for PIDFD_SELF_*

2025-01-30 Thread Lorenzo Stoakes
Add tests to assert that PIDFD_SELF* correctly refers to the current thread and process. We explicitly test pidfd_send_signal(), however We defer testing of mm-specific functionality which uses pidfd, namely process_madvise() and process_mrelease() to mm testing (though note the latter can not be

[PATCH v7 4/6] selftests: pidfd: add pidfd.h UAPI wrapper

2025-01-30 Thread Lorenzo Stoakes
Conflicts can arise between system fcntl.h and linux/fcntl.h, imported by the linux/pidfd.h UAPI header. Work around this by adding a wrapper for linux/pidfd.h to tools/include/ which sets the linux/fcntl.h header guard ahead of importing the pidfd.h header file. Adjust the pidfd selftests Makefi

[PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Lorenzo Stoakes
If you wish to utilise a pidfd interface to refer to the current process or thread it is rather cumbersome, requiring something like: int pidfd = pidfd_open(getpid(), 0 or PIDFD_THREAD); ... close(pidfd); Or the equivalent call opening /proc/self. It is more convenient t

[PATCH v7 3/6] tools: testing: separate out wait_for_pid() into helper header

2025-01-30 Thread Lorenzo Stoakes
It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/cgroup

[PATCH v7 2/6] selftests/pidfd: add missing system header imcludes to pidfd tests

2025-01-30 Thread Lorenzo Stoakes
The pidfd_fdinfo_test.c and pidfd_setns_test.c tests appear to be missing fundamental system header imports required to execute correctly. Add these. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 1 + tools/testing/selftests/pidfd/pidfd_setns_test.c | 1

[PATCH 2/2] tools/nolibc: add support for directory access

2025-01-30 Thread Thomas Weißschuh
From: Thomas Weißschuh Add an allocation-free implementation of readdir() and related functions. The implementation is modelled after the one for FILE. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Weißschuh --- I'm not entirely sure where to put it. It doesn't really belong into stdi

[PATCH 1/2] tools/nolibc: add support for sys_llseek()

2025-01-30 Thread Thomas Weißschuh
From: Thomas Weißschuh Not all architectures have the old sys_lseek(), notably riscv32. Implement lseek() in terms of sys_llseek() in that case. Signed-off-by: Thomas Weißschuh Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 29 - 1 file changed, 2

[PATCH 0/2] tools/nolibc: add support for directory access

2025-01-30 Thread Thomas Weißschuh
change-id: 20250130-nolibc-dir-980c2e2b661a Best regards, -- Thomas Weißschuh

[PATCH rcu v2] 11/20] srcu: Pull integer-to-pointer conversion into __srcu_ctr_to_ptr()

2025-01-30 Thread Paul E. McKenney
This commit abstracts the srcu_read_unlock*() integer-to-pointer conversion into a new __srcu_ctr_to_ptr(). This will be used in rcutorture for testing an srcu_read_unlock_fast() that avoids array-indexing overhead by taking a pointer rather than an integer. [ paulmck: Apply kernel test robot fee

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-01-30 Thread Song Liu
Hi Roman, On Thu, Jan 30, 2025 at 11:01 AM Roman Gushchin wrote: > > On Thu, Jan 30, 2025 at 10:34:09AM -0800, Song Liu wrote: > > On Thu, Jan 30, 2025 at 9:59 AM Song Liu wrote: > > > > > > I missed this set before sending my RFC set. If this set works well, we > > > won't need the other set. I

[PATCH rcu v2] 04/11] rcutorture: Expand failure/close-call grace-period output

2025-01-30 Thread Paul E. McKenney
With only eight bits per grace-period sequence number, wrap can happen in 64 grace periods. This commit therefore increases this to sixteen bits for normal grace-period sequence numbers and the combined short-form polling sequence numbers, thus deferring wrap for at least 16,384 grace periods. Be

[PATCH rcu v2] 02/11] rcutorture: Add a test_boost_holdoff module parameter

2025-01-30 Thread Paul E. McKenney
This commit adds a test_boost_holdoff module parameter that tells the RCU priority-boosting tests to wait for the specified number of seconds past the start of the rcutorture test. This can be useful when rcutorture is built into the kernel (as opposed to being modprobed), especially on large syst

[PATCH rcu v2] 05/11] rcu: Trace expedited grace-period numbers in hexadecimal

2025-01-30 Thread Paul E. McKenney
This commit reformats the expedited grace-period numbers into hexadecimal for easier decoding and comparison. The normal grace-period numbers remain in decimal for the time being. Signed-off-by: Paul E. McKenney --- include/trace/events/rcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-

[PATCH rcu v2] 06/11] rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output

2025-01-30 Thread Paul E. McKenney
This commit adds an ftrace-compatible microsecond-scale timestamp to the failure/close-call output, but only in kernels built with CONFIG_RCU_TORTURE_TEST_LOG_GP=y. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --gi

[PATCH rcu v2] 07/11] rcutorture: Make cur_ops->format_gp_seqs take buffer length

2025-01-30 Thread Paul E. McKenney
The Tree and Tiny implementations of rcutorture_format_gp_seqs() use hard-coded constants for the length of the buffer that they format into. This is of course an accident waiting to happen, so this commit therefore makes them take a length argument. The rcutorture calling code uses ARRAY_SIZE() t

[PATCH rcu v2] 08/11] rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool

2025-01-30 Thread Paul E. McKenney
The RCU_TORTURE_TEST_CHK_RDR_STATE and RCU_TORTURE_TEST_LOG_CPU Kconfig options are pointlessly defined as tristate. This commit therefore converts them to bool. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202412241458.150d082b-...@intel.com Signed-off-by: Paul E. McKen

[PATCH rcu v2] 09/11] rcutorture: Complain when invalid SRCU reader_flavor is specified

2025-01-30 Thread Paul E. McKenney
Currently, rcutorture ignores reader_flavor bits that are not in the SRCU_READ_FLAVOR_ALL bitmask, which could confuse rcutorture users into believing buggy patches had been fully tested. This commit therefore produces a splat in this case. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutort

[PATCH rcu v2] 01/11] torture: Add get_torture_init_jiffies() for test-start time

2025-01-30 Thread Paul E. McKenney
This commit adds a get_torture_init_jiffies() function that returns the value of the jiffies counter at the start of the test, that is, at the point where torture_init_begin() was invoked. This will be used to enable torture-test holdoffs for tests implemented using per-CPU kthreads, which are cre

[PATCH rcu v2] 11/11] torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe()

2025-01-30 Thread Paul E. McKenney
Recent experience shows that the srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions are not sufficiently tested. This commit therefore causes the torture.sh script's SRCU lockdep testing to use these two functions. This will cause these two functions to be regularly tested by severa

[PATCH rcu v2] 03/11] rcutorture: Include grace-period sequence numbers in failure/close-call

2025-01-30 Thread Paul E. McKenney
This commit includes the grace-period sequence numbers at the beginning and end of each segment in the "Failure/close-call rcutorture reader segments" list. These are in hexadecimal, and only the bottom byte. Currently, only RCU is supported, with its three sequence numbers (normal, expedited, and

[PATCH rcu v2] 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing

2025-01-30 Thread Paul E. McKenney
The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86 that have NMI-safe this_cpu_inc() operations. This makes the underlying __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions difficult to te

Re: [PATCH rcu 0/11] Torture-test updates

2025-01-30 Thread Paul E. McKenney
Hello! This series contains torture-test updates: 1. Add get_torture_init_jiffies() for test-start time. 2. Add a test_boost_holdoff module parameter. 3. Include grace-period sequence numbers in failure/close-call. 4. Expand failure/close-call grace-period output. 5.

[PATCH rcu v2] 17/20] srcu: Fix srcu_read_unlock_{lite,nmisafe}() kernel-doc

2025-01-30 Thread Paul E. McKenney
The srcu_read_unlock_lite() and srcu_read_unlock_nmisafe() both say that their idx parameters must come from srcu_read_lock(). This would be bad, because a given srcu_struct structure may be used only with one flavor of SRCU reader. This commit therefore updates the srcu_read_unlock_lite() kernel

[PATCH rcu v2] 18/20] srcu: Document that srcu_{read_lock,down_read}() can share srcu_struct

2025-01-30 Thread Paul E. McKenney
This commit adds a sentence to the srcu_down_read() function's kernel-doc header noting that it is permissible to use srcu_down_read() and srcu_read_lock() on the same srcu_struct, even concurrently. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra

[PATCH rcu v2] 20/20] srcu: Make SRCU-fast also be NMI-safe

2025-01-30 Thread Paul E. McKenney
BPF uses rcu_read_lock_trace() in NMI context, so srcu_read_lock_fast() must be NMI-safe if it is to have any chance of addressing RCU Tasks Trace use cases. This commit therefore causes srcu_read_lock_fast() and srcu_read_unlock_fast() to use atomic_long_inc() instead of this_cpu_inc() on archite

[PATCH rcu v2] 19/20] srcu: Add srcu_down_read_fast() and srcu_up_read_fast()

2025-01-30 Thread Paul E. McKenney
A pair of matching srcu_read_lock_fast() and srcu_read_unlock_fast() invocations must take place within the same context, for example, within the same task. Otherwise, lockdep complains, as is the right thing to do for most use cases. However, there are use cases involving tracing (for example, u

[PATCH rcu v2] 15/20] refscale: Add srcu_read_lock_fast() support using "srcu-fast"

2025-01-30 Thread Paul E. McKenney
This commit creates a new srcu-fast option for the refscale.scale_type module parameter that selects srcu_read_lock_fast() and srcu_read_unlock_fast(). Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: --- kernel/rcu/refsca

[PATCH rcu v2] 16/20] rcutorture: Make scenario SRCU-P use srcu_read_lock_fast()

2025-01-30 Thread Paul E. McKenney
This commit causes the rcutorture SRCU-P scenario use the srcu_read_lock_fast() and srcu_read_unlock_fast() functions. This will cause these two functions to be regularly tested by several developers (myself included), for example, those who use torture.sh as an RCU acceptance test. Signed-off-by

[PATCH rcu v2] 12/20] srcu: Move SRCU Tree/Tiny definitions from srcu.h

2025-01-30 Thread Paul E. McKenney
There are a couple of definitions under "#ifdef CONFIG_TINY_SRCU" in include/linux/srcu.h. There is no point in them being there, so this commit moves them to include/linux/srcutiny.h and include/linux/srcutree.c, thus eliminating that #ifdef. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoit

[PATCH rcu v2] 10/20] srcu: Pull pointer-to-integer conversion into __srcu_ptr_to_ctr()

2025-01-30 Thread Paul E. McKenney
This commit abstracts the srcu_read_lock*() pointer-to-integer conversion into a new __srcu_ptr_to_ctr(). This will be used in rcutorture for testing an srcu_read_lock_fast() that returns a pointer rather than an integer. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryik

[PATCH rcu v2] 14/20] rcutorture: Add ability to test srcu_read_{,un}lock_fast()

2025-01-30 Thread Paul E. McKenney
This commit permits rcutorture to test srcu_read_{,un}lock_fast(), which is specified by the rcutorture.reader_flavor=0x8 kernel boot parameter. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: --- kernel/rcu/rcutorture.c

[PATCH rcu v2] 13/20] srcu: Add SRCU-fast readers

2025-01-30 Thread Paul E. McKenney
This commit adds srcu_read_{,un}lock_fast(), which is similar to srcu_read_{,un}lock_lite(), but avoids the array-indexing and pointer-following overhead. On a microbenchmark featuring tight loops around empty readers, this results in about a 20% speedup compared to RCU Tasks Trace on my x86 lapto

[PATCH rcu v2] 09/20] srcu: Add SRCU_READ_FLAVOR_SLOWGP to flag need for synchronize_rcu()

2025-01-30 Thread Paul E. McKenney
This commit switches from a direct test of SRCU_READ_FLAVOR_LITE to a new SRCU_READ_FLAVOR_SLOWGP macro to check for substituting synchronize_rcu() for smp_mb() in SRCU grace periods. Right now, SRCU_READ_FLAVOR_SLOWGP is exactly SRCU_READ_FLAVOR_LITE, but the addition of the _fast() flavor of SRC

[PATCH rcu v2] 03/20] srcu: Use ->srcu_gp_seq for rcutorture reader batch

2025-01-30 Thread Paul E. McKenney
This commit stops using ->srcu_idx for rcutorture's reader-batch consistency checking, using ->srcu_gp_seq instead. This is a first step towards a faster srcu_read_{,un}lock_lite() that avoids the array accesses that use ->srcu_idx. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: And

[PATCH rcu v2] 05/20] srcu: Make SRCU readers use ->srcu_ctrs for counter selection

2025-01-30 Thread Paul E. McKenney
This commit causes SRCU readers to use ->srcu_ctrs for counter selection instead of ->srcu_idx. This takes another step towards array-indexing-free SRCU readers. [ paulmck: Apply kernel test robot feedback. ] Co-developed-by: Z qiang Signed-off-by: Z qiang Signed-off-by: Paul E. McKenney Test

[PATCH rcu v2] 08/20] srcu: Rename srcu_check_read_flavor_lite() to srcu_check_read_flavor_force()

2025-01-30 Thread Paul E. McKenney
This commit renames the srcu_check_read_flavor_lite() function to srcu_check_read_flavor_force() and adds a read_flavor argument in order to support an srcu_read_lock_fast() variant that is to avoid array indexing in both the lock and unlock primitives. Signed-off-by: Paul E. McKenney Cc: Alexei

[PATCH rcu v2] 04/20] srcu: Pull ->srcu_{un,}lock_count into a new srcu_ctr structure

2025-01-30 Thread Paul E. McKenney
This commit prepares for array-index-free srcu_read_lock*() by moving the ->srcu_{un,}lock_count fields into a new srcu_ctr structure. This will permit ->srcu_index to be replaced by a per-CPU pointer to this structure. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko

[PATCH rcu v2] 06/20] srcu: Make Tree SRCU updates independent of ->srcu_idx

2025-01-30 Thread Paul E. McKenney
This commit makes Tree SRCU updates independent of ->srcu_idx, then drop ->srcu_idx. Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: --- include/linux/srcutree.h | 1 - kernel/rcu/srcutree.c| 68 -

[PATCH rcu v2] 07/20] srcu: Force synchronization for srcu_get_delay()

2025-01-30 Thread Paul E. McKenney
Currently, srcu_get_delay() can be called concurrently, for example, by a CPU that is the first to request a new grace period and the CPU processing the current grace period. Although concurrent access is harmless, it unnecessarily expands the state space. Additionally, all calls to srcu_get_dela

[PATCH rcu v2] 01/20] srcu: Make Tiny SRCU able to operate in preemptible kernels

2025-01-30 Thread Paul E. McKenney
Given that SRCU allows its read-side critical sections are not just preemptible, but also allow general blocking, there is not much reason to restrict Tiny SRCU to non-preemptible kernels. This commit therefore removes Tiny SRCU dependencies on non-preemptibility, primarily surrounding its interac

[PATCH rcu v2] 02/20] srcu: Define SRCU_READ_FLAVOR_ALL in terms of symbols

2025-01-30 Thread Paul E. McKenney
This commit defines SRCU_READ_FLAVOR_ALL in terms of the SRCU_READ_FLAVOR_* definitions instead of a hexadecimal constant. Suggested-by: Neeraj Upadhyay Signed-off-by: Paul E. McKenney Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Peter Zijlstra Cc: Kent Overstreet Cc: --- include/linux/s

Re: [PATCH rcu 0/17] SRCU updates, including SRCU-fast

2025-01-30 Thread Paul E. McKenney
Hello! This series contains SRCU updates, perhaps most notably the addition of srcu_read_lock_fast() and srcu_read_unlock_fast(), which on my laptop are about 20% faster than rcu_read_lock_trace() and rcu_read_unlock_trace(). There are of course drawbacks: o Lack of CPU stall warnings. o

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-01-30 Thread Roman Gushchin
On Thu, Jan 30, 2025 at 10:34:09AM -0800, Song Liu wrote: > On Thu, Jan 30, 2025 at 9:59 AM Song Liu wrote: > > > > I missed this set before sending my RFC set. If this set works well, we > > won't need the other set. I will give this one a try. > > I just realized that llvm doesn't support sfram

[PATCH rcu v2] 6/9] osnoise: provide quiescent states

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora To reduce RCU noise for nohz_full configurations, osnoise depends on cond_resched() providing quiescent states for PREEMPT_RCU=n configurations. For PREEMPT_RCU=y configurations -- where cond_resched() is a stub -- we do this by directly calling rcu_momentary_eqs(). With (PREEM

[PATCH rcu v2] 7/9] rcu: limit PREEMPT_RCU configurations

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora PREEMPT_LAZY can be enabled stand-alone or alongside PREEMPT_DYNAMIC which allows for dynamic switching of preemption models. The choice of PREEMPT_RCU or not, however, is fixed at compile time. Given that PREEMPT_RCU makes some trade-offs to optimize for latency as opposed to

[PATCH rcu v2] 9/9] rcutorture: Make scenario TREE07 build CONFIG_PREEMPT_LAZY=y

2025-01-30 Thread Paul E. McKenney
This commit tests lazy preemption by causing the TREE07 rcutorture scenario to build its kernel with CONFIG_PREEMPT_LAZY=y. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/configs/rcu/TREE07 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testin

[PATCH rcu v2] 1/9] rcu: fix header guard for rcu_all_qs()

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora rcu_all_qs() is defined for !CONFIG_PREEMPT_RCU but the declaration is conditioned on CONFIG_PREEMPTION. With CONFIG_PREEMPT_LAZY, CONFIG_PREEMPTION=y does not imply CONFIG_PREEMPT_RCU=y. Decouple the two. Cc: Paul E. McKenney Reviewed-by: Frederic Weisbecker Reviewed-by: S

[PATCH rcu v2] 8/9] rcutorture: Make scenario TREE10 build CONFIG_PREEMPT_LAZY=y

2025-01-30 Thread Paul E. McKenney
This commit tests lazy preemption by causing the TREE10 rcutorture scenario to build its kernel with CONFIG_PREEMPT_LAZY=y. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/configs/rcu/TREE10 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testin

[PATCH rcu v2] 5/9] rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora With PREEMPT_RCU=n, cond_resched() provides urgently needed quiescent states for read-side critical sections via rcu_all_qs(). One reason why this was needed: lacking preempt-count, the tick handler has no way of knowing whether it is executing in a read-side critical section or

[PATCH rcu v2] 3/9] sched: update __cond_resched comment about RCU quiescent states

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora Update comment in __cond_resched() clarifying how urgently needed quiescent state are provided. Signed-off-by: Ankur Arora Reviewed-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney --- kernel/sched/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH rcu v2] 4/9] rcu: handle unstable rdp in rcu_read_unlock_strict()

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora rcu_read_unlock_strict() can be called with preemption enabled which can make for an unstable rdp and a racy norm value. Fix this by dropping the preempt-count in __rcu_read_unlock() after the call to rcu_read_unlock_strict(), adjusting the preempt-count check appropriately. S

[PATCH rcu v2] 2/9] rcu: rename PREEMPT_AUTO to PREEMPT_LAZY

2025-01-30 Thread Paul E. McKenney
From: Ankur Arora Replace mentions of PREEMPT_AUTO with PREEMPT_LAZY. Also, since PREMPT_LAZY implies PREEMPTION, we can reduce the TASKS_RCU selection criteria from this: NEED_TASKS_RCU && (PREEMPTION || PREEMPT_AUTO) to this: NEED_TASKS_RCU && PREEMPTION CC: Paul E. McKenney Reviewed-

Re: [PATCH rcu 0/9] Lazy-preemption-related updates

2025-01-30 Thread Paul E. McKenney
Hello! This series makes adjustments to RCU to better handle lazy preemption: 1. fix header guard for rcu_all_qs(), courtesy of Ankur Arora. 2. rename PREEMPT_AUTO to PREEMPT_LAZY, courtesy of Ankur Arora. 3. update __cond_resched comment about RCU quiescent states, court

[PATCH rcu v2] 3/5] rcu: Fix get_state_synchronize_rcu_full() GP-start detection

2025-01-30 Thread Paul E. McKenney
The get_state_synchronize_rcu_full() and poll_state_synchronize_rcu_full() functions use the root rcu_node structure's ->gp_seq field to detect the beginnings and ends of grace periods, respectively. This choice is necessary for the poll_state_synchronize_rcu_full() function because (give or take

[PATCH rcu v2] 5/5] rcu/nocb: Print segment lengths in show_rcu_nocb_gp_state()

2025-01-30 Thread Paul E. McKenney
Analysis of an rcutorture callback-based forward-progress test failure was hampered by the lack of ->cblist segment lengths. This commit therefore adds this information, so that what would have been ".W85620.N." (there are some callbacks waiting for grace period sequence number 85620 and some numb

[PATCH rcu v2] 1/5] rcu: Split rcu_report_exp_cpu_mult() mask parameter and use for tracing

2025-01-30 Thread Paul E. McKenney
This commit renames the rcu_report_exp_cpu_mult() function from "mask" to "mask_in" and introduced a "mask" local variable to better support upcoming event-tracing additions. Signed-off-by: Paul E. McKenney Cc: Frederic Weisbecker --- kernel/rcu/tree_exp.h | 6 -- 1 file changed, 4 insertio

[PATCH rcu v2] 2/5] rcu: Remove READ_ONCE() for rdp->gpwrap access in __note_gp_changes()

2025-01-30 Thread Paul E. McKenney
From: Zilin Guan There is one access to the per-CPU rdp->gpwrap field in the __note_gp_changes() function that does not use READ_ONCE(), but all other accesses do use READ_ONCE(). When using the 8*TREE03 and CONFIG_NR_CPUS=8 configuration, KCSAN found no data races at that point. This is becaus

[PATCH rcu 0/5] Miscellaneous fixes

2025-01-30 Thread Paul E. McKenney
Hello! This series contains miscellaneous fixes: 1. Split rcu_report_exp_cpu_mult() mask parameter and use for tracing. 2. Remove READ_ONCE() for rdp->gpwrap access in __note_gp_changes(), courtesy of Zilin Guan. 3. Fix get_state_synchronize_rcu_full() GP-start de

[PATCH rcu v2 7/7] rcu: Remove references to old grace-period-wait primitives

2025-01-30 Thread Paul E. McKenney
The rcu_barrier_sched(), synchronize_sched(), and synchronize_rcu_bh() RCU API members have been gone for many years. This commit therefore removes non-historical instances of them. Reported-by: Joe Perches Signed-off-by: Paul E. McKenney --- Documentation/RCU/rcubarrier.rst | 5 + includ

[PATCH rcu v2 3/7] rcu: Document self-propagating callbacks

2025-01-30 Thread Paul E. McKenney
This commit documents the fact that a given RCU callback function can repost itself. Reported-by: Jens Axboe Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 24f1cb292a92.

[PATCH rcu v2 6/7] rcu: Clarify RCU_LAZY and RCU_LAZY_DEFAULT_OFF help text

2025-01-30 Thread Paul E. McKenney
This commit wordsmiths the RCU_LAZY and RCU_LAZY_DEFAULT_OFF Kconfig options' help text. Signed-off-by: Paul E. McKenney --- kernel/rcu/Kconfig | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig index b9b6bc55185d..2b

[PATCH rcu v2 5/7] rcu: Add CONFIG_RCU_LAZY delays to call_rcu() kernel-doc header

2025-01-30 Thread Paul E. McKenney
This commit adds a description of the energy-efficiency delays that call_rcu() can impose, along with a pointer to call_rcu_hurry() for latency-sensitive kernel code. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/kernel/rcu/tree.

[PATCH rcu v2 4/7] srcu: Point call_srcu() to call_rcu() for detailed memory ordering

2025-01-30 Thread Paul E. McKenney
This commit causes the call_srcu() kernel-doc header to reference that of call_rcu() for detailed memory-ordering guarantees. Signed-off-by: Paul E. McKenney --- kernel/rcu/srcutree.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/s

[PATCH rcu v2 1/7] doc: Add broken-timing possibility to stallwarn.rst

2025-01-30 Thread Paul E. McKenney
Currently, stallwarn.rst does not mention the fact that timer bugs can result in false-positive RCU CPU stall warnings. This commit therefore adds this to the list. Signed-off-by: Paul E. McKenney --- Documentation/RCU/stallwarn.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Doc

Re: [PATCH rcu 0/7] Documentation upates

2025-01-30 Thread Paul E. McKenney
Hello! This series contains RCU documentation updates: 1. Add broken-timing possibility to stallwarn.rst. 2. Improve discussion of this_cpu_ptr(), add raw_cpu_ptr(). 3. Document self-propagating callbacks. 4. Point call_srcu() to call_rcu() for detailed memory ordering. 5.

Re: [PATCH bpf-next v7 4/5] bpf: verifier: Support eliding map lookup nullness

2025-01-30 Thread Daniel Xu
Hi Ilya, On Thu, Jan 30, 2025, at 2:06 AM, Ilya Leoshkevich wrote: > On Wed, 2025-01-29 at 10:45 -0700, Daniel Xu wrote: >> On Wed, Jan 29, 2025 at 09:49:12AM -0700, Daniel Xu wrote: >> > Hi Ilya, >> > >> > On Wed, Jan 29, 2025 at 03:58:54PM +0100, Ilya Leoshkevich wrote: >> > > On Tue, 2025-01-1

Re: [PATCH v2 net] udp: gso: do not drop small packets when PMTU reduces

2025-01-30 Thread Yan Zhai
On Thu, Jan 30, 2025 at 9:35 AM Willem de Bruijn wrote: > > Yan Zhai wrote: > > Commit 4094871db1d6 ("udp: only do GSO if # of segs > 1") avoided GSO > > for small packets. But the kernel currently dismisses GSO requests only > > after checking MTU/PMTU on gso_size. This means any packets, regardl

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-01-30 Thread Song Liu
On Thu, Jan 30, 2025 at 9:59 AM Song Liu wrote: > > I missed this set before sending my RFC set. If this set works well, we > won't need the other set. I will give this one a try. I just realized that llvm doesn't support sframe yet. So we (Meta) still need some sframe-less approach before llvm s

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-01-30 Thread Song Liu
I missed this set before sending my RFC set. If this set works well, we won't need the other set. I will give this one a try. Thanks, Song On Mon, Jan 27, 2025 at 1:33 PM Weinan Liu wrote: > > This patchset implements a generic kernel sframe-based [1] unwinder. > The main goal is to support reli

Re: [RFC net-next 2/2] selftests: drv-net: Test queue xsk attribute

2025-01-30 Thread Joe Damato
On Wed, Jan 29, 2025 at 06:07:51PM -0800, Jakub Kicinski wrote: > On Wed, 29 Jan 2025 17:24:25 + Joe Damato wrote: > > Test that queues which are used for AF_XDP have the xsk attribute set. > > > diff --git a/tools/testing/selftests/drivers/.gitignore > > b/tools/testing/selftests/drivers/.gi

  1   2   >