Re: [PATCH net-next 4/5] virtio_ring: Introduce DMA pre-handler

2023-05-25 Thread Jason Wang
On Fri, May 26, 2023 at 1:47 PM Liang Chen wrote: > > Currently, DMA operations of virtio devices' data buffer are encapsulated > within the underlying virtqueue implementation. DMA map/unmap operations > are performed for each data buffer attached to/detached from the virtqueue, > which is transp

[PATCH V3 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Zhu Lingshan
This commit synchronize irqs of the virtqueues and config space in the reset routine. Thus ifcvf_stop() and reset() are refactored as well. This commit renames ifcvf_stop_hw() to ifcvf_stop() Signed-off-by: Zhu Lingshan Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_base.c | 43 +

[PATCH V3 2/5] vDPA/ifcvf: get_driver_features from virtio registers

2023-05-25 Thread Zhu Lingshan
This commit implements a new function ifcvf_get_driver_feature() which read driver_features from virtio registers. To be less ambiguous, ifcvf_set_features() is renamed to ifcvf_set_driver_features(), and ifcvf_get_features() is renamed to ifcvf_get_dev_features() which returns the provisioned vDP

[PATCH V3 5/5] vDPA/ifcvf: a vendor driver should not set _CONFIG_S_FAILED

2023-05-25 Thread Zhu Lingshan
VIRTIO_CONFIG_S_FAILED indicates the guest driver has given up the device due to fatal errors. So it is the guest decision, the vendor driver should not set this status to the device. Signed-off-by: Zhu Lingshan Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 4 +--- 1 file changed,

[PATCH V3 1/5] vDPA/ifcvf: virt queue ops take immediate actions

2023-05-25 Thread Zhu Lingshan
In this commit, virtqueue operations including: set_vq_num(), set_vq_address(), set_vq_ready() and get_vq_ready() access PCI registers directly to take immediate actions. Signed-off-by: Zhu Lingshan Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_base.c | 58 -

[PATCH V3 3/5] vDPA/ifcvf: retire ifcvf_start_datapath and ifcvf_add_status

2023-05-25 Thread Zhu Lingshan
Rather than former lazy-initialization mechanism, now the virtqueue operations and driver_features related ops access the virtio registers directly to take immediate actions. So ifcvf_start_datapath() should retire. ifcvf_add_status() is retierd because we should not change device status by a vend

[PATCH V3 0/5] vDPA/ifcvf: implement immediate initialization mechanism

2023-05-25 Thread Zhu Lingshan
Formerly, ifcvf driver has implemented a lazy-initialization mechanism for the virtqueues and other config space contents, it would store all configurations that passed down from the userspace, then load them to the device config space upon DRIVER_OK. This can not serve live migration, so this ser

Re: [PATCH net-next 2/5] virtio_net: Add page_pool support to improve performance

2023-05-25 Thread Jason Wang
On Fri, May 26, 2023 at 1:46 PM Liang Chen wrote: > > The implementation at the moment uses one page per packet in both the > normal and XDP path. It's better to explain why we need a page pool and how it can help the performance. > In addition, introducing a module parameter to enable > or disa

Re: [PATCH net-next 1/5] virtio_net: Fix an unsafe reference to the page chain

2023-05-25 Thread Jason Wang
On Fri, May 26, 2023 at 1:46 PM Liang Chen wrote: > > "private" of buffer page is currently used for big mode to chain pages. > But in mergeable mode, that offset of page could mean something else, > e.g. when page_pool page is used instead. So excluding mergeable mode to > avoid such a problem.

Re: [PATCH V2 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Zhu, Lingshan
On 5/26/2023 2:09 PM, Jason Wang wrote: On Fri, May 26, 2023 at 1:30 PM Zhu, Lingshan wrote: On 5/26/2023 11:36 AM, Zhu, Lingshan wrote: On 5/26/2023 9:34 AM, Jason Wang wrote: On Thu, May 25, 2023 at 5:38 PM Zhu, Lingshan wrote: On 5/24/2023 4:03 PM, Jason Wang wrote: On Mon, May 8,

[PATCH] virtio_ring: validate used buffer length

2023-05-25 Thread Jason Wang
This patch validate the used buffer length provided by the device before trying to use it. This is done by remembering the in buffer length in a dedicated array during virtqueue_add(), then we can fail the virtqueue_get_buf() when we find the device is trying to give us a used buffer length which i

Re: [PATCH V2 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Jason Wang
On Fri, May 26, 2023 at 1:30 PM Zhu, Lingshan wrote: > > > > On 5/26/2023 11:36 AM, Zhu, Lingshan wrote: > > > > > > On 5/26/2023 9:34 AM, Jason Wang wrote: > >> On Thu, May 25, 2023 at 5:38 PM Zhu, Lingshan > >> wrote: > >>> > >>> > >>> On 5/24/2023 4:03 PM, Jason Wang wrote: > On Mon, May

[PATCH net-next 5/5] virtio_net: Implement DMA pre-handler

2023-05-25 Thread Liang Chen
Adding a DMA pre-handler that utilizes page pool for managing DMA mappings. When IOMMU is enabled, turning on the page_pool_dma_map module parameter to select page pool for DMA mapping management gives a significant reduction in the overhead caused by DMA mappings. In testing environments with a s

[PATCH net-next 4/5] virtio_ring: Introduce DMA pre-handler

2023-05-25 Thread Liang Chen
Currently, DMA operations of virtio devices' data buffer are encapsulated within the underlying virtqueue implementation. DMA map/unmap operations are performed for each data buffer attached to/detached from the virtqueue, which is transparent and invisible to the higher-level virtio device drivers

[PATCH net-next 3/5] virtio_net: Add page pool fragmentation support

2023-05-25 Thread Liang Chen
To further enhance performance, implement page pool fragmentation support and introduce a module parameter to enable or disable it. In single-core vm testing environments, there is an additional performance gain observed in the normal path compared to the one packet per page approach. Upstream c

[PATCH net-next 2/5] virtio_net: Add page_pool support to improve performance

2023-05-25 Thread Liang Chen
The implementation at the moment uses one page per packet in both the normal and XDP path. In addition, introducing a module parameter to enable or disable the usage of page pool (disabled by default). In single-core vm testing environments, it gives a modest performance gain in the normal path.

[PATCH net-next 1/5] virtio_net: Fix an unsafe reference to the page chain

2023-05-25 Thread Liang Chen
"private" of buffer page is currently used for big mode to chain pages. But in mergeable mode, that offset of page could mean something else, e.g. when page_pool page is used instead. So excluding mergeable mode to avoid such a problem. Signed-off-by: Liang Chen --- drivers/net/virtio_net.c | 2

Re: [PATCH V2 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Zhu, Lingshan
On 5/26/2023 11:36 AM, Zhu, Lingshan wrote: On 5/26/2023 9:34 AM, Jason Wang wrote: On Thu, May 25, 2023 at 5:38 PM Zhu, Lingshan wrote: On 5/24/2023 4:03 PM, Jason Wang wrote: On Mon, May 8, 2023 at 6:05 PM Zhu Lingshan wrote: This commit synchronize irqs of the virtqueues and config

Re: [PATCH V2 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Zhu, Lingshan
On 5/26/2023 9:34 AM, Jason Wang wrote: On Thu, May 25, 2023 at 5:38 PM Zhu, Lingshan wrote: On 5/24/2023 4:03 PM, Jason Wang wrote: On Mon, May 8, 2023 at 6:05 PM Zhu Lingshan wrote: This commit synchronize irqs of the virtqueues and config space in the reset routine. Thus ifcvf_stop_hw

Re: [PATCH V2 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Jason Wang
On Thu, May 25, 2023 at 5:38 PM Zhu, Lingshan wrote: > > > > On 5/24/2023 4:03 PM, Jason Wang wrote: > > On Mon, May 8, 2023 at 6:05 PM Zhu Lingshan wrote: > >> This commit synchronize irqs of the virtqueues > >> and config space in the reset routine. > >> Thus ifcvf_stop_hw() and reset() are ref

Re: [PATCH V3 net-next 1/2] virtio-net: convert rx mode setting to use workqueue

2023-05-25 Thread Jason Wang
On Thu, May 25, 2023 at 3:41 PM Michael S. Tsirkin wrote: > > On Thu, May 25, 2023 at 11:43:34AM +0800, Jason Wang wrote: > > On Wed, May 24, 2023 at 5:15 PM Michael S. Tsirkin wrote: > > > > > > On Wed, May 24, 2023 at 04:18:41PM +0800, Jason Wang wrote: > > > > This patch convert rx mode settin

Re: [PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression

2023-05-25 Thread Linus Torvalds
On Thu, May 25, 2023 at 8:30 AM Eric W. Biederman wrote: > > Basically with no patches that is where Linus's kernel is. > > User complained about the new thread showing up in ps. Well, not only that, but it actively broke existing workflows for managing things. Showing up in 'ps' wasn't just some

Re: [PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression

2023-05-25 Thread Mike Christie
On 5/23/23 7:15 AM, Oleg Nesterov wrote: > > Now the main question. Whatever we do, SIGKILL/SIGSTOP/etc can come right > before we call work->fn(). Is it "safe" to run this callback with > signal_pending() or fatal_signal_pending() ? The questions before this one I'll leave for the core vhost dev

Re: [PATCH 1/3] vhost-scsi: Fix alignment handling with windows

2023-05-25 Thread Mike Christie
On 5/25/23 2:57 AM, Michael S. Tsirkin wrote: > On Wed, May 24, 2023 at 06:34:05PM -0500, Mike Christie wrote: >> The linux block layer requires bios/requests to have lengths with a 512 >> byte alignment. Some drivers/layers like dm-crypt and the directi IO code >> will test for it and just fail. O

Re: [PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression

2023-05-25 Thread Eric W. Biederman
Oleg Nesterov writes: > On 05/24, Eric W. Biederman wrote: >> >> Oleg Nesterov writes: >> >> > Yes, but probably SIGABRT/exit doesn't really differ from SIGKILL wrt >> > vhost_worker(). >> >> Actually I think it reveals that exiting with SIGABRT will cause >> a deadlock. >> >> coredump_wait will

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

2023-05-25 Thread Stefano Garzarella
On Thu, May 25, 2023 at 04:35:42PM +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

Re: [PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression

2023-05-25 Thread Oleg Nesterov
On 05/24, Eric W. Biederman wrote: > > Oleg Nesterov writes: > > > Yes, but probably SIGABRT/exit doesn't really differ from SIGKILL wrt > > vhost_worker(). > > Actually I think it reveals that exiting with SIGABRT will cause > a deadlock. > > coredump_wait will wait for all of the threads to reac

Re: [PATCH V2 4/5] vDPA/ifcvf: synchronize irqs in the reset routine

2023-05-25 Thread Zhu, Lingshan
On 5/24/2023 4:03 PM, Jason Wang wrote: On Mon, May 8, 2023 at 6:05 PM Zhu Lingshan wrote: This commit synchronize irqs of the virtqueues and config space in the reset routine. Thus ifcvf_stop_hw() and reset() are refactored as well. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcv

Re: [PATCH 0/3] vhost-scsi: Fix IO hangs when using windows

2023-05-25 Thread Michael S. Tsirkin
On Wed, May 24, 2023 at 06:34:04PM -0500, Mike Christie wrote: > The following patches were made over Linus's tree and fix an issue > where windows guests will send iovecs with offset/lengths that result > in IOs that are not aligned to 512. The LIO layer will then send them > to Linux's block laye

Re: [PATCH 1/3] vhost-scsi: Fix alignment handling with windows

2023-05-25 Thread Michael S. Tsirkin
On Wed, May 24, 2023 at 06:34:05PM -0500, Mike Christie wrote: > The linux block layer requires bios/requests to have lengths with a 512 > byte alignment. Some drivers/layers like dm-crypt and the directi IO code > will test for it and just fail. Other drivers like SCSI just assume the > requiremen

Re: [PATCH] tools/virtio: Add .gitignore to ringtest

2023-05-25 Thread Michael S. Tsirkin
Subject should be "for ringtest" not "to ringtest". On Wed, May 24, 2023 at 08:36:12PM +0800, Rong Tao wrote: > From: Rong Tao > > Ignore executions for ringtest. > > Signed-off-by: Rong Tao > --- > tools/virtio/ringtest/.gitignore | 7 +++ > 1 file changed, 7 insertions(+) > create mo

Re: [PATCH] tools/virtio: Add .gitignore to ringtest

2023-05-25 Thread Michael S. Tsirkin
On Wed, May 24, 2023 at 08:36:12PM +0800, Rong Tao wrote: > From: Rong Tao > > Ignore executions for ringtest. I think you mean "executables". > > Signed-off-by: Rong Tao > --- > tools/virtio/ringtest/.gitignore | 7 +++ > 1 file changed, 7 insertions(+) > create mode 100644 tools/virti

Re: [PATCH] tools/virtio: Add .gitignore to ringtest

2023-05-25 Thread Michael S. Tsirkin
On Wed, May 24, 2023 at 08:36:12PM +0800, Rong Tao wrote: > From: Rong Tao > > Ignore executions for ringtest. > > Signed-off-by: Rong Tao > --- > tools/virtio/ringtest/.gitignore | 7 +++ > 1 file changed, 7 insertions(+) > create mode 100644 tools/virtio/ringtest/.gitignore > > diff --

Re: [PATCH V3 net-next 1/2] virtio-net: convert rx mode setting to use workqueue

2023-05-25 Thread Michael S. Tsirkin
On Thu, May 25, 2023 at 11:43:34AM +0800, Jason Wang wrote: > On Wed, May 24, 2023 at 5:15 PM Michael S. Tsirkin wrote: > > > > On Wed, May 24, 2023 at 04:18:41PM +0800, Jason Wang wrote: > > > This patch convert rx mode setting to be done in a workqueue, this is > > > a must for allow to sleep wh