Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
ote: > > > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > > [...] > > > There are other options like CONFIG_TEST_PRINTF or so in defconfig files. > > Why are they there to begin with? The answer to this Q will affect the > > change >

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
> There are other options like CONFIG_TEST_PRINTF or so in defconfig files. > Why are they there to begin with? The answer to this Q will affect the change > you have done in this patch. CONFIG_TEST_PRINTF still exists; that test has not been converted to kunit.

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

2025-01-31 Thread Willem de Bruijn
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, regardless > of their payload sizes, could be dropped when PMTU becomes sm

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Andy Shevchenko
due to > > passing `test` around. > > Ah, you were referring to git format-patch. Sure, if you'd like me to > rename the file, I'll use those flags in v2. Yes. -- With Best Regards, Andy Shevchenko

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Andy Shevchenko
On Fri, Jan 31, 2025 at 12:22:39PM -0500, Tamir Duberstein wrote: > On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko > wrote: > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > > > Convert the scanf() self-test to a KUnit test. > > > > > &g

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
On Fri, Jan 31, 2025 at 12:22 PM Tamir Duberstein wrote: > > On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko > wrote: > > > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > > > Convert the scanf() self-test to a KUnit test. > > > >

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko wrote: > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > > Convert the scanf() self-test to a KUnit test. > > > > In the interest of keeping the patch reasonably-sized this doesn't > > renam

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Andy Shevchenko
On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > Convert the scanf() self-test to a KUnit test. > > In the interest of keeping the patch reasonably-sized this doesn't > rename the file in accordance with usual kunit conventions nor does it > refactor t

Re: [PATCH 8/8] arm64: Enable livepatch for ARM64

2025-01-31 Thread Prasanna Kumar T S M
On 28-01-2025 03:03, Weinan Liu wrote: Since SFrame is considered as reliable stacktrace, enable livepatch in arch/arm64/Kconfig Signed-off-by: Weinan Liu --- arch/arm64/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 100570a048c

[PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't rename the file in accordance with usual kunit conventions nor does it refactor the tests into proper parameterized tests - it's all one big test case. Signed-off

Re: [PATCH v2 3/3] arm64: dts: qcom: sdm630: Add missing resets to mmc blocks

2025-01-31 Thread Konrad Dybcio
On 29.01.2025 10:23 PM, Alexey Minnekhanov wrote: > Add resets to eMMC/SD card blocks so linux can properly reset > them during initialization. > > Signed-off-by: Alexey Minnekhanov > --- Thanks! Reviewed-by: Konrad Dybcio Konrad

Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode

2025-01-31 Thread Miroslav Benes
sleep 5s > yum erase -y kernel-livepatch-6.1.12-0.x86_64 > yum install -y ./kernel-livepatch-6.1.6-0.x86_64.rpm > ./apply_livepatch_61.sh # it will sleep 5s > done A live patch application is a slowpath. It is expected not to run frequently (in a relative sense). If

Re: [PATCH v2 2/3] clk: qcom: gcc-sdm660: Add missing SDCC block resets

2025-01-31 Thread Konrad Dybcio
On 29.01.2025 10:23 PM, Alexey Minnekhanov wrote: > This will allow linux to properly reset eMMC/SD blocks. > > Signed-off-by: Alexey Minnekhanov > Fixes: f2a76a2955c0 ("clk: qcom: Add Global Clock controller (GCC) driver for > SDM660") > --- Reviewed-by: Konrad Dybcio Konrad

[PATCH RFC net-next] netconsole: selftest: Add test for fragmented messages

2025-01-31 Thread Breno Leitao
Add a new selftest to verify netconsole's handling of messages that exceed the packet size limit and require fragmentation. The test sends messages with varying sizes and userdata, validating that: 1. Large messages are correctly fragmented and reassembled 2. Userdata fields are properly preserved

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-01-31 Thread Michael S. Tsirkin
sole > > is not in use. > > > > Looks like virtio-console continues to write to the MMIO even after > > underlying virtio-pci device is removed. > > > > The problem can be mitigated by removing all virtio devices on virtio > > bus shutdown. > >

Re: [PATCH] kunit: tool: Use qboot on QEMU x86_64

2025-01-31 Thread Brendan Jackman
On Fri, 31 Jan 2025 at 09:45, David Gow wrote: > One future idea would be to look into microvms, which might be even > faster. I'll give myself a TODO to experiment with those. Yeah, that would be cool although I think they require CONFIG_PARAVIRT which isn't an entirely negligible constraint. St

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

2025-01-31 Thread Lorenzo Stoakes
been > > > working with this code in practice and found this to be useful. > > > > It's also nice to add that people on the libc/allocator side should > > also appreciate skipping pidfd_open's reliability concerns (mostly, > > that RLIMIT_NOFILE Sho

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-01-31 Thread Eric Auger
derlying virtio-pci device is removed. > > The problem can be mitigated by removing all virtio devices on virtio > bus shutdown. > > Signed-off-by: Kirill A. Shutemov > Reported-by: Hongyu Ning Gentle ping on that patch that seems to have fallen though the cracks. I think this fi

[PATCH 5.10 3/5] net: tighten bad gso csum offset check in virtio_net_hdr

2025-01-31 Thread Denis Arefev
From: Willem de Bruijn commit 6513eb3d3191574b58859ef2d6dc26c0277c6f81 upstream. The referenced commit drops bad input, but has false positives. Tighten the check to avoid these. The check detects illegal checksum offload requests, which produce csum_start/csum_off beyond end of packet after s

Re: [PATCH] kunit: tool: Use qboot on QEMU x86_64

2025-01-31 Thread David Gow
On Fri, 24 Jan 2025 at 19:01, Brendan Jackman wrote: > > As noted in [0], SeaBIOS (QEMU default) makes a mess of the terminal, > qboot does not. > > It turns out this is actually useful with kunit.py, since the user is > exposed to this issue if they set --raw_output=all. > > qboot is also faster

[PATCH 5.10 2/5] net: drop bad gso csum_start and offset in virtio_net_hdr

2025-01-31 Thread Denis Arefev
From: Willem de Bruijn commit 89add40066f9ed9abe5f7f886fe5789ff7e0c50e upstream. Tighten csum_start and csum_offset checks in virtio_net_hdr_to_skb for GSO packets. The function already checks that a checksum requested with VIRTIO_NET_HDR_F_NEEDS_CSUM is in skb linear. But for GSO packets this

[PATCH 5.10 5/5] net: test for not too small csum_start in virtio_net_hdr_to_skb()

2025-01-31 Thread Denis Arefev
From: Eric Dumazet commit 49d14b54a527289d09a9480f214b8c586322310a upstream. syzbot was able to trigger this warning [1], after injecting a malicious packet through af_packet, setting skb->csum_start and thus the transport header to an incorrect value. We can at least make sure the transport he

[PATCH 5.10 4/5] net: add more sanity check in virtio_net_hdr_to_skb()

2025-01-31 Thread Denis Arefev
From: Eric Dumazet commit 9181d6f8a2bb32d158de66a84164fac05e3ddd18 upstream. syzbot/KMSAN reports access to uninitialized data from gso_features_check() [1] The repro use af_packet, injecting a gso packet and hdrlen == 0. We could fix the issue making gso_features_check() more careful while de

[PATCH 5.10 0/5] net: Backport fix for CVE-2024-43817

2025-01-31 Thread Denis Arefev
Link: https://nvd.nist.gov/vuln/detail/cve-2024-43817 [PATCH 5.10 1/5] net: more strict VIRTIO_NET_HDR_GSO_UDP_L4 validation [PATCH 5.10 2/5] net: drop bad gso csum_start and offset in virtio_net_hdr [PATCH 5.10 3/5] net: tighten bad gso csum offset check in virtio_net_hdr [PATCH 5.10 4/5] net

[PATCH 5.10 1/5] net: more strict VIRTIO_NET_HDR_GSO_UDP_L4 validation

2025-01-31 Thread Denis Arefev
From: Willem de Bruijn commit fc8b2a619469378717e7270d2a4e1ef93c585f7a upstream. Syzbot reported two new paths to hit an internal WARNING using the new virtio gso type VIRTIO_NET_HDR_GSO_UDP_L4. RIP: 0010:skb_checksum_help+0x4a2/0x600 net/core/dev.c:3260 skb len=64521 gso_size=344 and

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

2025-01-31 Thread Yan Zhai
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, regardless of their payload sizes, could be dropped when PMTU becomes smaller than requested gso

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

2025-01-30 Thread Dragos Tatulea
rect endianness. When it’s called > before mlx5_vdpa_set_driver_features(), the flag is clear, and the data are > returned as big-endian on big-endian machines, while QEMU interprets them > as little-endian. > Good catch! Thank you for the patch. Could you add the clarification that m

[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
x27;s an extra safety net that avoids >> memleaks when we forget to kfree, and not that we deliberately do not >> free and get lax about managing allocated memory. >> >> So I'd prefer a patch that keeps all current frees as they are, but >> with the added advanta

[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&#

[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
, if no CPUs are allocated from NUMA node 0. This patch fixes the issue by setting NUMA_NO_NODE (-1) for map creation for this selftest. Fixes: 96eabe7a40aa ("bpf: Allow selecting numa node during map creation") Signed-off-by: Saket Kumar Bhaskar --- tools/testing/selftests/bpf/

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
or a > malloc[1]). Besides the big syscall reduction and nice speedup, that > is. > > [1] whether this is the already case is an exercise left to the > reader, but at the very least we should not add onto existing problems Thanks. Could we please get all the above spelled out much more thoroughly in the [0/n] description (aka Patch Series Sales Brochure)?

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
Add support opendir(), readdir(), closedir() and friends. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (2): tools/nolibc: add support for sys_llseek() tools/nolibc: add support for directory access tools/include/nolibc/stdio.h | 76 +++

[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

  1   2   3   4   5   6   7   8   9   10   >