Re: [PATCH] virtio: break and reset virtio devices on device_shutdown()

2025-02-23 Thread Eric Auger
Hi Michael, On 2/21/25 12:42 AM, Michael S. Tsirkin wrote: > Hongyu reported a hang on kexec in a VM. QEMU reported invalid memory > accesses during the hang. > > Invalid read at addr 0x102877002, size 2, region '(null)', reason: > rejected > Invalid write at addr 0x102877A44, size 2

Re: [RFC v2 5/5] virtiofs: Disable notifications more aggresively

2025-02-23 Thread Eugenio Perez Martin
On Mon, Feb 24, 2025 at 7:44 AM Eugenio Perez Martin wrote: > > On Mon, Feb 24, 2025 at 3:01 AM Jason Wang wrote: > > > > On Sat, Feb 22, 2025 at 1:07 AM Eugenio Pérez wrote: > > > > > > Disable notifications right before scheduling, instead of waiting until > > > the work is running. > > > > >

Re: [RFC v2 5/5] virtiofs: Disable notifications more aggresively

2025-02-23 Thread Eugenio Perez Martin
On Mon, Feb 24, 2025 at 3:01 AM Jason Wang wrote: > > On Sat, Feb 22, 2025 at 1:07 AM Eugenio Pérez wrote: > > > > Disable notifications right before scheduling, instead of waiting until > > the work is running. > > > > After applying this patch, fio read test goes from 1191MiB/s to > > 1263.14Mi

Re: [RFC v2 1/5] vduse: add virtio_fs to allowed dev id

2025-02-23 Thread Eugenio Perez Martin
On Mon, Feb 24, 2025 at 2:57 AM Jason Wang wrote: > > On Sat, Feb 22, 2025 at 1:06 AM Eugenio Pérez wrote: > > > > A VDUSE device that implements virtiofs device works fine just by > > adding the device id to the whitelist. > > > > Signed-off-by: Eugenio Pérez > > Acked-by: Jason Wang > > --- >

[PATCH -next] selftests/filesystems: Remove duplicate sys/types.h header

2025-02-23 Thread Jiapeng Chong
./tools/testing/selftests/filesystems/utils.c: sys/types.h is included more than once. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=19042 Signed-off-by: Jiapeng Chong --- tools/testing/selftests/filesystems/utils.c | 1 - 1 file changed, 1 deletion(-) diff -

[RESEND PATCH v2] wireguard: selftests: Cleanup CONFIG_UBSAN_SANITIZE_ALL

2025-02-23 Thread WangYuli
Commit 918327e9b7ff ("ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL") removed the CONFIG_UBSAN_SANITIZE_ALL configuration option. Eliminate invalid configurations to improve code readability. Link: https://lore.kernel.org/all/20250123105743.go395...@kernel.org/ Reviewed-by: Simon Horman Signed-off-by:

[PATCH] selftests/mount: Use 'const' for filename parameters

2025-02-23 Thread Ritvik Gupta
The filename parameter in write_file(), maybe_write_file(), and vmaybe_write_file() is unmodified / read-only. So, used 'const' to improve type safety. Signed-off-by: Ritvik Gupta --- tools/testing/selftests/mount/unprivileged-remount-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletio

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

2025-02-23 Thread Boqun Feng
From: "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 o

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

2025-02-23 Thread Boqun Feng
From: "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 Nak

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

2025-02-23 Thread Boqun Feng
From: "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 involv

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

2025-02-23 Thread Boqun Feng
From: "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. McK

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

2025-02-23 Thread Boqun Feng
From: "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 src

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

2025-02-23 Thread Boqun Feng
From: "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

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

2025-02-23 Thread Boqun Feng
From: "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 acce

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

2025-02-23 Thread Boqun Feng
From: "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

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

2025-02-23 Thread Boqun Feng
From: "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: Si

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

2025-02-23 Thread Boqun Feng
From: "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 Star

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

2025-02-23 Thread Boqun Feng
From: "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:

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

2025-02-23 Thread Boqun Feng
From: "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,

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

2025-02-23 Thread Boqun Feng
From: "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: Signed-off-by: Boqun Feng --- include/linux/srcutree.h | 1

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

2025-02-23 Thread Boqun Feng
From: "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 o

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

2025-02-23 Thread Boqun Feng
From: "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: Pa

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

2025-02-23 Thread Boqun Feng
From: "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

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

2025-02-23 Thread Boqun Feng
From: "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 Starov

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

2025-02-23 Thread Boqun Feng
From: "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:

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

2025-02-23 Thread Boqun Feng
From: "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

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

2025-02-23 Thread Boqun Feng
From: "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, primar

[PATCH rcu 00/20] SRCU changes for v6.15

2025-02-23 Thread Boqun Feng
Hi, Please find the upcoming changes in SRCU for v6.15. The changes can also be found at: git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git srcu.2025.02.05a Regards, Boqun Paul E. McKenney (20): srcu: Make Tiny SRCU able to operate in preemptible kernels srcu: Define SRCU

Re: [PATCH] virtio: break and reset virtio devices on device_shutdown()

2025-02-23 Thread Jason Wang
On Fri, Feb 21, 2025 at 9:37 AM Michael S. Tsirkin wrote: > > On Fri, Feb 21, 2025 at 09:11:51AM +0800, Jason Wang wrote: > > On Fri, Feb 21, 2025 at 7:42 AM Michael S. Tsirkin wrote: > > > > > > Hongyu reported a hang on kexec in a VM. QEMU reported invalid memory > > > accesses during the hang.

Re: [PATCH v6 5/6] vhost: Add new UAPI to support change to task mode

2025-02-23 Thread Jason Wang
On Sun, Feb 23, 2025 at 11:41 PM Cindy Lu wrote: > > Add a new UAPI to enable setting the vhost device to task mode. > The userspace application can use VHOST_SET_INHERIT_FROM_OWNER > to configure the mode if necessary. > This setting must be applied before VHOST_SET_OWNER, as the worker > will be

Re: [RFC v2 4/5] virtiofs: perform DMA operations out of the spinlock

2025-02-23 Thread Jason Wang
On Sat, Feb 22, 2025 at 1:07 AM Eugenio Pérez wrote: > > This is useful for some setups like swiotlb or VDUSE where the DMA > operations are expensive and/or need to be performed with a write lock. > > After applying this patch, fio read test goes from 1124MiB/s to 1191MiB/s. What FIO parameter h

Re: [RFC v2 5/5] virtiofs: Disable notifications more aggresively

2025-02-23 Thread Jason Wang
On Sat, Feb 22, 2025 at 1:07 AM Eugenio Pérez wrote: > > Disable notifications right before scheduling, instead of waiting until > the work is running. > > After applying this patch, fio read test goes from 1191MiB/s to > 1263.14Mib/s Let's describe more about the testing. E.g FIO parameters, tes

Re: [RFC v2 1/5] vduse: add virtio_fs to allowed dev id

2025-02-23 Thread Jason Wang
On Sat, Feb 22, 2025 at 1:06 AM Eugenio Pérez wrote: > > A VDUSE device that implements virtiofs device works fine just by > adding the device id to the whitelist. > > Signed-off-by: Eugenio Pérez > Acked-by: Jason Wang > --- Let's separate this from this series. Thanks

Re: [PATCH v6 6/6] vhost: Add check for inherit_owner status

2025-02-23 Thread Jason Wang
On Sun, Feb 23, 2025 at 11:41 PM Cindy Lu wrote: > > The VHOST_NEW_WORKER requires the inherit_owner > setting to be true. So we need to add a check for this. > > Signed-off-by: Cindy Lu > --- Acked-by: Jason Wang Thanks

Re: [PATCH v6 4/6] vhost: introduce worker ops to support multiple thread models

2025-02-23 Thread Jason Wang
On Sun, Feb 23, 2025 at 11:41 PM Cindy Lu wrote: > > This commit restores the previously removed functions kthread_wakeup and > kthread_stop, and introduces a new ops structure to handle worker wakeup, > stop, and creation. The function vhost_worker_create initializes these > ops pointers based on

Re: [PATCH RFC v2 00/10] SLUB percpu sheaves

2025-02-23 Thread Suren Baghdasaryan
On Sun, Feb 23, 2025 at 5:36 PM Suren Baghdasaryan wrote: > > On Sat, Feb 22, 2025 at 8:44 PM Suren Baghdasaryan wrote: > > > > On Sat, Feb 22, 2025 at 4:19 PM Kent Overstreet > > wrote: > > > > > > On Fri, Feb 14, 2025 at 05:27:36PM +0100, Vlastimil Babka wrote: > > > > - Cheaper fast paths. Fo

Re: [PATCH v6 3/6] vhost: Add the cgroup related function

2025-02-23 Thread Jason Wang
On Sun, Feb 23, 2025 at 11:41 PM Cindy Lu wrote: > > Add back the previously removed cgroup function to support the kthread > The biggest change for this part is in vhost_attach_cgroups() and > vhost_attach_task_to_cgroups(). > > Reuse the function __vhost_worker_flush, but in this situation, the

Re: [PATCH v6 2/6] vhost: Reintroduce vhost_worker to support kthread

2025-02-23 Thread Jason Wang
On Sun, Feb 23, 2025 at 11:41 PM Cindy Lu wrote: > > Add the previously removed function vhost_worker() back > to support the kthread and rename it to vhost_run_work_kthread_list. > > The old function vhost_worker was change to support task in > commit 6e890c5d5021 ("vhost: use vhost_tasks for wor

Re: [PATCH RFC v2 00/10] SLUB percpu sheaves

2025-02-23 Thread Suren Baghdasaryan
On Sat, Feb 22, 2025 at 8:44 PM Suren Baghdasaryan wrote: > > On Sat, Feb 22, 2025 at 4:19 PM Kent Overstreet > wrote: > > > > On Fri, Feb 14, 2025 at 05:27:36PM +0100, Vlastimil Babka wrote: > > > - Cheaper fast paths. For allocations, instead of local double cmpxchg, > > > after Patch 5 it's

Re: [PATCH v6 1/6] vhost: Add a new parameter in vhost_dev to allow user select kthread

2025-02-23 Thread Jason Wang
On Sun, Feb 23, 2025 at 11:40 PM Cindy Lu wrote: > > The vhost now uses vhost_task and workers as a child of the owner thread. > While this aligns with containerization principles,it confuses some legacy > userspace app, Therefore, we are reintroducing kthread API support. > > Introduce a new para

Re: [PATCH 4/4] arm64: dts: qcom: sdm632-fairphone-fp3: Enable modem

2025-02-23 Thread Dmitry Baryshkov
On Sat, Feb 22, 2025 at 02:00:50PM +0100, Luca Weiss wrote: > Add the necessary supplies and set an appropriete firmware-name for the Nit: appropriate > modem and enable it. > > Signed-off-by: Luca Weiss > --- > arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 8 > 1 file changed,

Re: [PATCH 3/4] arm64: dts: qcom: sdm632-fairphone-fp3: Add firmware-name for adsp & wcnss

2025-02-23 Thread Dmitry Baryshkov
On Sat, Feb 22, 2025 at 02:00:49PM +0100, Luca Weiss wrote: > Set the paths where the device-specific firmware can be found for this > device. > > Fairphone 3 was shipped with secure-boot off so any testkey-signed > firmware is accepted. > > Signed-off-by: Luca Weiss > --- > arch/arm64/boot/dts

Re: [PATCH 1/4] arm64: dts: qcom: sdm632-fairphone-fp3: Move status properties last

2025-02-23 Thread Dmitry Baryshkov
On Sat, Feb 22, 2025 at 02:00:47PM +0100, Luca Weiss wrote: > As is common style nowadays, move the status properties to be the last > property of a node. > > Signed-off-by: Luca Weiss > --- > arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 15 +-- > 1 file changed, 9 insertions(

Re: [PATCH 2/4] arm64: dts: qcom: sdm632-fairphone-fp3: Add newlines between regulator nodes

2025-02-23 Thread Dmitry Baryshkov
On Sat, Feb 22, 2025 at 02:00:48PM +0100, Luca Weiss wrote: > As is common style nowadays, make sure there's an empty line between > regulator subnodes. > > Signed-off-by: Luca Weiss > --- > arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 18 ++ > 1 file changed, 18 insertion

[PATCH v6 6/6] vhost: Add check for inherit_owner status

2025-02-23 Thread Cindy Lu
The VHOST_NEW_WORKER requires the inherit_owner setting to be true. So we need to add a check for this. Signed-off-by: Cindy Lu --- drivers/vhost/vhost.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 45d8f5c5bca9..26da561c6685 1006

[PATCH v6 5/6] vhost: Add new UAPI to support change to task mode

2025-02-23 Thread Cindy Lu
Add a new UAPI to enable setting the vhost device to task mode. The userspace application can use VHOST_SET_INHERIT_FROM_OWNER to configure the mode if necessary. This setting must be applied before VHOST_SET_OWNER, as the worker will be created in the VHOST_SET_OWNER function Signed-off-by: Cindy

[PATCH v6 4/6] vhost: introduce worker ops to support multiple thread models

2025-02-23 Thread Cindy Lu
This commit restores the previously removed functions kthread_wakeup and kthread_stop, and introduces a new ops structure to handle worker wakeup, stop, and creation. The function vhost_worker_create initializes these ops pointers based on the inherit_owner value. Signed-off-by: Cindy Lu --- dri

[PATCH v6 2/6] vhost: Reintroduce vhost_worker to support kthread

2025-02-23 Thread Cindy Lu
Add the previously removed function vhost_worker() back to support the kthread and rename it to vhost_run_work_kthread_list. The old function vhost_worker was change to support task in commit 6e890c5d5021 ("vhost: use vhost_tasks for worker threads") change to xarray in commit 1cdaafa1b8b4 ("vhost

[PATCH v6 3/6] vhost: Add the cgroup related function

2025-02-23 Thread Cindy Lu
Add back the previously removed cgroup function to support the kthread The biggest change for this part is in vhost_attach_cgroups() and vhost_attach_task_to_cgroups(). Reuse the function __vhost_worker_flush, but in this situation, the attachment_cnt is 0. Therefore, add a boolean to disable this

[PATCH v6 1/6] vhost: Add a new parameter in vhost_dev to allow user select kthread

2025-02-23 Thread Cindy Lu
The vhost now uses vhost_task and workers as a child of the owner thread. While this aligns with containerization principles,it confuses some legacy userspace app, Therefore, we are reintroducing kthread API support. Introduce a new parameter to enable users to choose between kthread and task mode

[PATCH v6 0/6] vhost: Add support of kthread API

2025-02-23 Thread Cindy Lu
In commit 6e890c5d5021 ("vhost: use vhost_tasks for worker threads"), the vhost now uses vhost_task and operates as a child of the owner thread. This aligns with containerization principles. However, this change has caused confusion for some legacy userspace applications. Therefore, we

[PATCH] selftests/net: deflake GRO tests and fix return value and output

2025-02-23 Thread Kevin Krakauer
Thanks for the review! I'll split this up. Do you think it's better as two patchsets -- one for stability/deflaking, one for return value and output cleanup -- or as a single patchset with several commits? > To be clear - are you running this over veth or a real device? Over a veth. >> Set the d

Re: [PATCH v2] selftests/mount: Close 'fd' when write fails

2025-02-23 Thread Ritvik Gupta
> Yes, the kernel will handle the 'fd' cleanup automatically, but > the existing implementation already closes it before exiting. ^^^ Whoops! I meant 'returning' there. Wording issue on my part :P We're referring to the same thing! Thanks