Re: [PATCH v2 2/3] vhost: support PACKED when setting-getting vring_base

2023-05-16 Thread Stefano Garzarella
On Mon, May 15, 2023 at 01:41:12PM -0700, Shannon Nelson wrote: On 5/9/23 1:46 AM, Stefano Garzarella wrote: On Mon, Apr 24, 2023 at 03:50:30PM -0700, Shannon Nelson via Virtualization wrote: Use the right structs for PACKED or split vqs when setting and getting the vring base. Signed-off-by:

Re: [PATCH v2] virtio: Add missing documentation for structure fields

2023-05-16 Thread Stefano Garzarella
On Thu, May 11, 2023 at 04:46:22PM +0200, Simon Horman wrote: Add missing documentation for the vqs_list_lock field of struct virtio_device, and the validate field of struct virtio_driver. ./scripts/kernel-doc says: .../virtio.h:131: warning: Function parameter or member 'vqs_list_lock' not de

[PATCH] vdpa/mlx5: Fix hang when cvq commands are triggered during device unregister

2023-05-16 Thread Dragos Tatulea via Virtualization
Currently the vdpa device is unregistered after the workqueue that processes vq commands is disabled. However, the device unregister process can still send commands to the cvq (a vlan delete for example) which leads to a hang because the handing workqueue has been disabled and the command never fin

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-05-16 Thread Oleg Nesterov
On 05/15, Mike Christie wrote: > > Oleg and Christian, > > > Below is an updated patch that doesn't check for PF_USER_WORKER in the > signal.c code and instead will check for if we have blocked the signal. Looks like I need to read the whole series... will try tomorrow. > --- a/kernel/fork.c > ++

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-05-16 Thread Oleg Nesterov
On 05/15, Mike Christie wrote: > > --- a/kernel/vhost_task.c > +++ b/kernel/vhost_task.c > @@ -75,13 +75,13 @@ struct vhost_task *vhost_task_create(int (*fn)(void *), > void *arg, >const char *name) > { > struct kernel_clone_args args = { > -

[PATCH v1] virtio_pci: Optimize virtio_pci_device structure size

2023-05-16 Thread Feng Liu via Virtualization
Improve the size of the virtio_pci_device structure, which is commonly used to represent a virtio PCI device. A given virtio PCI device can either of legacy type or modern type, with the struct virtio_pci_legacy_device occupying 32 bytes and the struct virtio_pci_modern_device occupying 88 bytes. M

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-05-16 Thread Mike Christie
On 5/16/23 3:39 AM, Christian Brauner wrote: > On Mon, May 15, 2023 at 05:23:12PM -0500, Mike Christie wrote: >> On 5/15/23 10:44 AM, Linus Torvalds wrote: >>> On Mon, May 15, 2023 at 7:23 AM Christian Brauner >>> wrote: So I think we will be able to address (1) and (2) by making vhost

Re: [PATCH v6 virtio 04/11] pds_vdpa: move enum from common to adminq header

2023-05-16 Thread Shannon Nelson via Virtualization
On 5/15/23 11:12 PM, Michael S. Tsirkin wrote: On Mon, May 15, 2023 at 07:55:14PM -0700, Shannon Nelson wrote: The pds_core_logical_qtype enum and IFNAMSIZ are not needed in the common PDS header, only needed when working with the adminq, so move them to the adminq header. Note: This patch migh

Re: [PATCH v6 virtio 09/11] pds_vdpa: add support for vdpa and vdpamgmt interfaces

2023-05-16 Thread Shannon Nelson via Virtualization
On 5/16/23 3:35 AM, Simon Horman wrote: On Mon, May 15, 2023 at 07:55:19PM -0700, Shannon Nelson wrote: This is the vDPA device support, where we advertise that we can support the virtio queues and deal with the configuration work through the pds_core's adminq. Signed-off-by: Shannon Nelson A

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-05-16 Thread Eric W. Biederman
Linus Torvalds writes: > On Mon, May 15, 2023 at 3:23 PM Mike Christie > wrote: >> >> The vhost layer really doesn't want any signals and wants to work like >> kthreads >> for that case. To make it really simple can we do something like this where >> it >> separates user and io worker behavior

Re: [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies

2023-05-16 Thread Thomas Zimmermann
Hi Am 16.05.23 um 13:00 schrieb Niklas Schnelle: In a future patch HAS_IOPORT=n will result in inb()/outb() and friends not being declared. We thus need to add HAS_IOPORT as dependency for those drivers using them. In the bochs driver there is optional MMIO support detected at runtime, warn if t

Re: [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies

2023-05-16 Thread Arnd Bergmann
On Tue, May 16, 2023, at 19:13, Thomas Zimmermann wrote: > > Am 16.05.23 um 13:00 schrieb Niklas Schnelle: >> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends >> not being declared. We thus need to add HAS_IOPORT as dependency for >> those drivers using them. In the bochs driv

Re: [PATCH v2 2/3] vhost: support PACKED when setting-getting vring_base

2023-05-16 Thread Shannon Nelson via Virtualization
On 5/16/23 12:49 AM, Stefano Garzarella wrote: On Mon, May 15, 2023 at 01:41:12PM -0700, Shannon Nelson wrote: On 5/9/23 1:46 AM, Stefano Garzarella wrote: On Mon, Apr 24, 2023 at 03:50:30PM -0700, Shannon Nelson via Virtualization wrote: Use the right structs for PACKED or split vqs when sett

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-05-16 Thread Oleg Nesterov
On 05/16, Eric W. Biederman wrote: > > A kernel thread can block SIGKILL and that is supported. > > For a thread that is part of a process you can't block SIGKILL when the > task is part of a user mode process. Or SIGSTOP. Another thread can call do_signal_stop()->signal_wake_up/etc. > There is t

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-05-16 Thread Eric W. Biederman
Oleg Nesterov writes: > On 05/16, Eric W. Biederman wrote: >> >> A kernel thread can block SIGKILL and that is supported. >> >> For a thread that is part of a process you can't block SIGKILL when the >> task is part of a user mode process. > > Or SIGSTOP. Another thread can call do_signal_stop()-

Re: [PATCH net-next V2 2/2] virtio-net: sleep instead of busy waiting for cvq command

2023-05-16 Thread Michael S. Tsirkin
On Thu, Apr 13, 2023 at 02:40:27PM +0800, Jason Wang wrote: > We used to busy waiting on the cvq command this tends to be > problematic since there no way for to schedule another process which > may serve for the control virtqueue. This might be the case when the > control virtqueue is emulated by

Re: [PATCH 01/20] x86: move prepare_ftrace_return prototype to header

2023-05-16 Thread Steven Rostedt
On Tue, 16 May 2023 21:35:30 +0200 Arnd Bergmann wrote: > From: Arnd Bergmann > > On 32-bit builds, the prepare_ftrace_return() function only has a global > definition, but no prototype before it, which causes a warning: > > arch/x86/kernel/ftrace.c:625:6: warning: no previous prototype for >

Re: [PATCH net-next V2 2/2] virtio-net: sleep instead of busy waiting for cvq command

2023-05-16 Thread Jason Wang
On Wed, May 17, 2023 at 4:54 AM Michael S. Tsirkin wrote: > > On Thu, Apr 13, 2023 at 02:40:27PM +0800, Jason Wang wrote: > > We used to busy waiting on the cvq command this tends to be > > problematic since there no way for to schedule another process which > > may serve for the control virtqueue

Re: [PATCH v1] virtio_pci: Optimize virtio_pci_device structure size

2023-05-16 Thread Xuan Zhuo
On Tue, 16 May 2023 09:54:46 -0400, Feng Liu wrote: > Improve the size of the virtio_pci_device structure, which is commonly > used to represent a virtio PCI device. A given virtio PCI device can > either of legacy type or modern type, with the > struct virtio_pci_legacy_device occupying 32 bytes

[PATCH vhost v9 02/12] virtio_ring: simplify the reference of desc state inside detach_buf_split()

2023-05-16 Thread Xuan Zhuo
The purpose of this is to simplify the reference to state. It is convenient for subsequent commit. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.

[PATCH vhost v9 01/12] virtio_ring: put mapping error check in vring_map_one_sg

2023-05-16 Thread Xuan Zhuo
This patch put the dma addr error check in vring_map_one_sg(). The benefits of doing this: 1. make vring_map_one_sg more simple, without calling vring_mapping_error to check the return value. 2. reduce one judgment of vq->use_dma_api. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.

[PATCH vhost v9 00/12] virtio core prepares for AF_XDP

2023-05-16 Thread Xuan Zhuo
## About DMA APIs Now, virtio may can not work with DMA APIs when virtio features do not have VIRTIO_F_ACCESS_PLATFORM. 1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just work with the "real" devices. 2. I tried to let xsk support callballs to get phy address fr

[PATCH vhost v9 05/12] virtio_ring: split: virtqueue_add_split() support premapped

2023-05-16 Thread Xuan Zhuo
virtqueue_add_split() only supports virtual addresses, dma is completed in virtqueue_add_split(). In some scenarios (such as the AF_XDP scenario), the memory is allocated and DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtqueue_add_split(). Record

[PATCH vhost v9 04/12] virtio_ring: virtqueue_add() support premapped

2023-05-16 Thread Xuan Zhuo
virtuque_add() adds parameter premapped. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1ffab1eb40c0..e2fc50c05bec 100644 --- a/drivers/virtio

[PATCH vhost v9 11/12] virtio_ring: separate the logic of reset/enable from virtqueue_resize

2023-05-16 Thread Xuan Zhuo
The subsequent reset function will reuse these logic. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 58 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ri

[PATCH vhost v9 06/12] virtio_ring: packed: virtqueue_add_packed() support premapped

2023-05-16 Thread Xuan Zhuo
virtqueue_add_packed() only supports virtual addresses, dma is completed in virtqueue_add_packed(). In some scenarios (such as the AF_XDP scenario), the memory is allocated and DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtqueue_add_packed(). Rec

[PATCH vhost v9 03/12] virtio_ring: check use_dma_api before unmap desc for indirect

2023-05-16 Thread Xuan Zhuo
Inside detach_buf_split(), if use_dma_api is false, vring_unmap_one_split_indirect will be called many times, but actually nothing is done. So this patch check use_dma_api firstly. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(

[PATCH vhost v9 08/12] virtio_ring: introduce virtqueue_add_inbuf_premapped()

2023-05-16 Thread Xuan Zhuo
Introduce virtqueue_add_inbuf_premapped() to submit premapped sgs. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 25 + include/linux/virtio.h | 5 + 2 files changed, 30 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virt

[PATCH vhost v9 07/12] virtio_ring: introduce virtqueue_add_outbuf_premapped()

2023-05-16 Thread Xuan Zhuo
Introduce virtqueue_add_outbuf_premapped() to submit premapped sgs. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 25 + include/linux/virtio.h | 5 + 2 files changed, 30 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/vir

[PATCH vhost v9 09/12] virtio_ring: introduce virtqueue_dma_dev()

2023-05-16 Thread Xuan Zhuo
Added virtqueue_dma_dev() to get DMA device for virtio. Then the caller can do dma operation in advance. The purpose is to keep memory mapped across multiple add/get buf operations. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 17 + include/linux/virtio.h |

[PATCH vhost v9 10/12] virtio_ring: correct the expression of the description of virtqueue_resize()

2023-05-16 Thread Xuan Zhuo
Modify the "useless" to a more accurate "unused". Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 42730c4ecdc5..c90160d2d280 10064

[PATCH vhost v9 12/12] virtio_ring: introduce virtqueue_reset()

2023-05-16 Thread Xuan Zhuo
Introduce virtqueue_reset() to release all buffer inside vq. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 33 + include/linux/virtio.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/drivers/virtio/virtio_ring.c

[PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
There is already a virtqueue abstract structure in virtio subsystem (see struct virtqueue in include/linux/virtio.h), however the vring based virtqueue is used only in the past years, the virtqueue related methods mix much with vring(just look like the codes, virtqueue_xxx functions are implemented

[PATCH v2 2/2] tools/virtio: implement virtqueue in test

2023-05-16 Thread zhenwei pi via Virtualization
virtqueue related functions has been abstract since commit ("virtio: abstract virtqueue related methods"), add compatible for abstract API. Signed-off-by: zhenwei pi --- tools/virtio/linux/virtio.h | 355 1 file changed, 324 insertions(+), 31 deletions(-) di

[PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive API. - Reduce changes in tools/virtio. Add test result(no obvious change): Before: time ./vringh_test --parallel Using CPUS 0 and 191 Guest: notified 10036893, pinged 68278 Host: notified 68278, pinged 3093532 real

Re: [PATCH 13/14] vhost: allow userspace to create workers

2023-05-16 Thread Jason Wang
On Sat, Apr 29, 2023 at 12:32 AM Mike Christie wrote: > > For vhost-scsi with 3 vqs or more and a workload that tries to use > them in parallel like: > > fio --filename=/dev/sdb --direct=1 --rw=randrw --bs=4k \ > --ioengine=libaio --iodepth=128 --numjobs=3 > > the single vhost worker thread will

Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread Michael S. Tsirkin
On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: > v1 -> v2: > - Suggested by MST, use fast path for vring based performance > sensitive API. > - Reduce changes in tools/virtio. > > Add test result(no obvious change): > Before: > time ./vringh_test --parallel > Using CPUS 0 and 191 > Gu

Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive API. - Reduce changes in tools/virtio. Add test result(no obvious change): Before: time ./vringh_test --pa

Re: [PATCH v6 virtio 11/11] pds_vdpa: pds_vdps.rst and Kconfig

2023-05-16 Thread Shannon Nelson via Virtualization
On 5/16/23 7:24 PM, kernel test robot wrote: Hi Shannon, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on v6.4-rc2 next-20230516] [cannot apply to mst-vhost/linux-next] [If your patch is applied to the wrong git tree

Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread Michael S. Tsirkin
On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: > > > On 5/17/23 11:46, Michael S. Tsirkin wrote: > > On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: > > > v1 -> v2: > > > - Suggested by MST, use fast path for vring based performance > > > sensitive API. > > > - Reduce cha

Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 11:57, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive AP

Re: [PATCH v1] virtio_pci: Optimize virtio_pci_device structure size

2023-05-16 Thread Jason Wang
On Tue, May 16, 2023 at 9:55 PM Feng Liu wrote: > > Improve the size of the virtio_pci_device structure, which is commonly > used to represent a virtio PCI device. A given virtio PCI device can > either of legacy type or modern type, with the > struct virtio_pci_legacy_device occupying 32 bytes an

Re: [PATCH] vdpa/mlx5: Fix hang when cvq commands are triggered during device unregister

2023-05-16 Thread Jason Wang
On Tue, May 16, 2023 at 5:58 PM Dragos Tatulea wrote: > > Currently the vdpa device is unregistered after the workqueue that > processes vq commands is disabled. However, the device unregister > process can still send commands to the cvq (a vlan delete for example) > which leads to a hang because

Re: [PATCH v2 2/3] vhost: support PACKED when setting-getting vring_base

2023-05-16 Thread Jason Wang
On Wed, May 17, 2023 at 2:26 AM Shannon Nelson wrote: > > On 5/16/23 12:49 AM, Stefano Garzarella wrote: > > On Mon, May 15, 2023 at 01:41:12PM -0700, Shannon Nelson wrote: > >> On 5/9/23 1:46 AM, Stefano Garzarella wrote: > >>> On Mon, Apr 24, 2023 at 03:50:30PM -0700, Shannon Nelson via > >>> Vi

Re: [PATCH] vdpa: consume device_features parameter

2023-05-16 Thread Jason Wang
On Sat, May 13, 2023 at 12:42 AM Shannon Nelson wrote: > > From: Allen Hubbe > > Consume the parameter to device_features when parsing command line > options. Otherwise the parameter may be used again as an option name. > > # vdpa dev add ... device_features 0xdeadbeef mac 00:11:22:33:44:55 >

Re: [RESEND PATCH] vdpa: solidrun: constify pointers to hwmon_channel_info

2023-05-16 Thread Jason Wang
On Fri, May 12, 2023 at 1:54 AM Krzysztof Kozlowski wrote: > > Statically allocated array of pointers to hwmon_channel_info can be made > const for safety. > > Acked-by: Michael S. Tsirkin > Reviewed-by: Alvaro Karsz > Signed-off-by: Krzysztof Kozlowski Acked-by: Jason Wang Thanks > --- >

Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread Michael S. Tsirkin
On Wed, May 17, 2023 at 12:58:10PM +0800, zhenwei pi wrote: > On 5/17/23 11:57, Michael S. Tsirkin wrote: > > On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: > > > > > > > > > On 5/17/23 11:46, Michael S. Tsirkin wrote: > > > > On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrot

Re: Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 14:10, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 12:58:10PM +0800, zhenwei pi wrote: On 5/17/23 11:57, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +080

Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-16 Thread kernel test robot
Hi zhenwei, kernel test robot noticed the following build warnings: [auto build test WARNING on mst-vhost/linux-next] [also build test WARNING on linus/master v6.4-rc2 next-20230517] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to u