[PATCH vhost 10/10] virtio_ring: introduce virtqueue_reset()

2023-02-13 Thread Xuan Zhuo
Introduce virtqueue_reset() to release all buffer inside vq. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 50 include/linux/virtio.h | 2 ++ 2 files changed, 52 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/vi

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

2023-02-13 Thread Xuan Zhuo
Modify the "useless" to a more accurate "unused". Signed-off-by: Xuan Zhuo --- 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 84129b8c3e2a..2ba60a14f557 100644 --- a/drivers/virtio

[PATCH vhost 04/10] virtio_ring: split: introduce virtqueue_add_split_premapped()

2023-02-13 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 virtio core. Signed-off-by: X

[PATCH vhost 07/10] virtio_ring: add api virtio_dma_map() for advance dma

2023-02-13 Thread Xuan Zhuo
Added virtio_dma_map() to map DMA addresses for virtual memory in advance. The purpose is to keep memory mapped across multiple add/get buf operations. Added virtio_dma_unmap() for unmap DMA address. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 92

[PATCH vhost 08/10] virtio_ring: introduce dma sync api for virtio

2023-02-13 Thread Xuan Zhuo
These API has been introduced: * virtio_dma_need_sync * virtio_dma_sync_single_range_for_cpu * virtio_dma_sync_single_range_for_device These APIs can be used together with the premapped mechanism to sync the DMA address. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 70 ++

[PATCH vhost 05/10] virtio_ring: packed: introduce virtqueue_add_packed_premapped()

2023-02-13 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 virtio core. Signed-off-by:

[PATCH vhost 01/10] virtio_ring: split: refactor virtqueue_add_split() for premapped

2023-02-13 Thread Xuan Zhuo
DMA-related logic is separated from the virtqueue_add_split to prepare for subsequent support for premapped. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 219 --- 1 file changed, 152 insertions(+), 67 deletions(-) diff --git a/drivers/virtio/virtio

[PATCH vhost 06/10] virtio_ring: introduce virtqueue_add_inbuf_premapped()

2023-02-13 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 03/10] virtio_ring: packed: refactor virtqueue_add_packed() for premapped

2023-02-13 Thread Xuan Zhuo
DMA-related logic is separated from virtqueue_add_packed to prepare for the subsequent support for premapped. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 150 ++- 1 file changed, 78 insertions(+), 72 deletions(-) diff --git a/drivers/virtio/virtio

[PATCH vhost 00/10] virtio core prepares for AF_XDP

2023-02-13 Thread Xuan Zhuo
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero copy feature of xsk (XDP socket) needs to be supported by the driver. The performance of zero copy is very good. ENV: Qemu with vhost. vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS ---

[PATCH vhost 02/10] virtio_ring: packed: separate prepare code from virtuque_add_indirect_packed()

2023-02-13 Thread Xuan Zhuo
Separating the logic of allocating indirect desc and checking queue status to the upper layer function. The proposal of this is convenient to refactor virtqueue_add_packed() for premapped. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 29 - 1 file chang

Re: [PATCH] vp_vdpa: fix the crash in hot unplug with vp_vdpa

2023-02-13 Thread Jason Wang
On Tue, Feb 14, 2023 at 2:17 PM Cindy Lu wrote: > > While unplugging the vp_vdpa device, the kernel will crash > The root cause is the function vp_modern_get_status() called following the > vp_modern_remove(). This needs some tweaking, maybe it's better to say vdpa_mgmtdev_unregister() will acces

Re: [PATCH v2] vdpa/mlx5: should not activate virtq object when suspended

2023-02-13 Thread Jason Wang
On Tue, Feb 14, 2023 at 6:48 AM Si-Wei Liu wrote: > > Otherwise the virtqueue object to instate could point to invalid address > that was unmapped from the MTT: > > mlx5_core :41:04.2: mlx5_cmd_out_err:782:(pid 8321): > CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status > bad parame

Re: [PATCH] vhost-vdpa: cleanup memory maps when closing vdpa fds

2023-02-13 Thread Jason Wang
在 2023/1/31 22:53, Longpeng(Mike) 写道: From: Longpeng We must cleanup all memory maps when closing the vdpa fds, otherwise some critical resources (e.g. memory, iommu map) will leaked if the userspace exits unexpectedly (e.g. kill -9). Sounds like a bug of the kernel, should we fix there? T

Re: [EXT] [RFC PATCH 0/4] PCI: endpoint: Introduce a virtio-net EP function

2023-02-13 Thread Shunsuke Mie
On 2023/02/08 1:02, Frank Li wrote: We project extending this module to support RDMA. The plan is based on virtio-rdma[1]. It extends the virtio-net and we are plan to implement the proposed spec based on this patch. [1] virtio-rdma - proposal: https://eur01.safelinks.protection.outlook.com/?ur

Re: PCIe RC\EP virtio rdma solution discussion.

2023-02-13 Thread Shunsuke Mie
Thanks for organizing the discussion. On 2023/02/08 4:45, Frank Li wrote: From: Frank Li Recently more and more people are interested in PCI RC and EP connection, especially network usage cases. I upstreamed a vntb solution last year. But the transfer speed is not good enough. I initialized a d

Re: [PATCH 06/33] virtio_ring: introduce virtqueue_reset()

2023-02-13 Thread Xuan Zhuo
On Mon, 13 Feb 2023 07:15:02 -0500, "Michael S. Tsirkin" wrote: > On Fri, Feb 03, 2023 at 05:09:12PM +0800, Xuan Zhuo wrote: > > On Fri, 3 Feb 2023 04:05:38 -0500, "Michael S. Tsirkin" > > wrote: > > > On Thu, Feb 02, 2023 at 07:00:31PM +0800, Xuan Zhuo wrote: > > > > Introduce virtqueue_reset(

Re: [PATCH v2 01/13] vdpa net: move iova tree creation from init to start

2023-02-13 Thread Si-Wei Liu
On 2/13/2023 3:14 AM, Eugenio Perez Martin wrote: On Mon, Feb 13, 2023 at 7:51 AM Si-Wei Liu wrote: On 2/8/2023 1:42 AM, Eugenio Pérez wrote: Only create iova_tree if and when it is needed. The cleanup keeps being responsible of last VQ but this change allows it to merge both cleanup func

[PATCH v2] vdpa/mlx5: should not activate virtq object when suspended

2023-02-13 Thread Si-Wei Liu
Otherwise the virtqueue object to instate could point to invalid address that was unmapped from the MTT: mlx5_core :41:04.2: mlx5_cmd_out_err:782:(pid 8321): CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status bad parameter(0x3), syndrome (0x5fa1c), err(-22) Fixes: cae15c2ed8e6 ("vd

Re: [PATCH] vdpa/mlx5: should not activate virtq object when suspended

2023-02-13 Thread Si-Wei Liu
+ Eugenio On 2/11/2023 10:55 PM, Eli Cohen wrote: On 11/02/2023 8:08, Si-Wei Liu wrote: Otherwise the virtqueue object to instate could point to invalid address that was unmapped from the MTT:    mlx5_core :41:04.2: mlx5_cmd_out_err:782:(pid 8321):    CREATE_GENERAL_OBJECT(0xa00) op_mod(0

Re: [PATCH v2 01/11] genirq/affinity:: Export irq_create_affinity_masks()

2023-02-13 Thread Thomas Gleixner
On Mon, Feb 13 2023 at 22:50, Yongji Xie wrote: > On Mon, Feb 13, 2023 at 8:00 PM Michael S. Tsirkin wrote: > I can try to split irq_create_affinity_masks() into a common part and > an irq specific part, and move the common part to a common dir such as > /lib and export it. Then we can use the com

Re: [PATCH v6 2/5] ACPI: bus: Add stub acpi_sleep_state_supported() in non-ACPI cases

2023-02-13 Thread Rafael J. Wysocki
On Fri, Feb 10, 2023 at 10:34 AM Saurabh Sengar wrote: > > acpi_sleep_state_supported() is defined only when CONFIG_ACPI=y. The > function is in acpi_bus.h, and acpi_bus.h can only be used in > CONFIG_ACPI=y cases. Add the stub function to linux/acpi.h to make > compilation successful for !CONFIG_

Re: [PATCH 2/2] vdpa/mlx5: Initialize CVQ iotlb spinlock

2023-02-13 Thread Michael S. Tsirkin
On Mon, Feb 13, 2023 at 02:24:40PM +0200, Eli Cohen wrote: > > On 13/02/2023 14:19, Michael S. Tsirkin wrote: > > On Mon, Feb 06, 2023 at 02:20:16PM +0200, Eli Cohen wrote: > > > Initialize itolb spinlock. > > > > > > Fixes: 5262912ef3cf ("vdpa/mlx5: Add support for control VQ and MAC > > > sett

Re: [PATCH v2] vhost/vdpa: Add MSI translation tables to iommu for software-managed MSI

2023-02-13 Thread Michael S. Tsirkin
On Tue, Feb 07, 2023 at 08:08:43PM +0800, Nanyong Sun wrote: > From: Rong Wang > > Once enable iommu domain for one device, the MSI > translation tables have to be there for software-managed MSI. > Otherwise, platform with software-managed MSI without an > irq bypass function, can not get a corre

Re: [PATCH 2/2] vdpa/mlx5: Initialize CVQ iotlb spinlock

2023-02-13 Thread Michael S. Tsirkin
On Mon, Feb 06, 2023 at 02:20:16PM +0200, Eli Cohen wrote: > Initialize itolb spinlock. > > Fixes: 5262912ef3cf ("vdpa/mlx5: Add support for control VQ and MAC setting") > Signed-off-by: Eli Cohen threading was broken here but whatevs. > --- > drivers/vdpa/mlx5/core/resources.c | 1 + > 1 file

Re: [PATCH 06/33] virtio_ring: introduce virtqueue_reset()

2023-02-13 Thread Michael S. Tsirkin
On Fri, Feb 03, 2023 at 05:09:12PM +0800, Xuan Zhuo wrote: > On Fri, 3 Feb 2023 04:05:38 -0500, "Michael S. Tsirkin" > wrote: > > On Thu, Feb 02, 2023 at 07:00:31PM +0800, Xuan Zhuo wrote: > > > Introduce virtqueue_reset() to release all buffer inside vq. > > > > > > Signed-off-by: Xuan Zhuo > >

Re: [PATCH 00/33] virtio-net: support AF_XDP zero copy

2023-02-13 Thread Michael S. Tsirkin
On Mon, Feb 06, 2023 at 10:41:16AM +0800, Xuan Zhuo wrote: > On Fri, 3 Feb 2023 04:17:59 -0500, "Michael S. Tsirkin" > wrote: > > On Fri, Feb 03, 2023 at 11:33:31AM +0800, Xuan Zhuo wrote: > > > On Thu, 02 Feb 2023 15:41:44 +0100, Paolo Abeni wrote: > > > > On Thu, 2023-02-02 at 19:00 +0800, Xua

Re: [PATCH v2] scsi: virtio_scsi: Fix poential NULL pointer dereference in virtscsi_rescan_hotunplug

2023-02-13 Thread Michael S. Tsirkin
On Thu, Feb 02, 2023 at 02:41:24PM +0800, Zheng Wang wrote: > There is no check about the return value of kmalloc in > virtscsi_rescan_hotunplug. Add the check to avoid use > of null pointer 'inq_result' in case of the failure > of kmalloc. > > Signed-off-by: Zheng Wang > --- I fixed a typo in s

Re: [PATCH v3 2/2] vdpasim: support doorbell mapping

2023-02-13 Thread Michael S. Tsirkin
On Sun, Jan 29, 2023 at 02:19:51PM +0800, Jason Wang wrote: > On Sun, Jan 29, 2023 at 10:51 AM Longpeng(Mike) wrote: > > > > From: Longpeng > > > > Support doorbell mapping for vdpasim devices, then we can test the notify > > passthrough feature even if there's no real hardware on hand. > > > > A

Re: [PATCH 2/2] vringh: fetch used_idx from vring at vringh_init_iotlb

2023-02-13 Thread Michael S. Tsirkin
On Tue, Jan 31, 2023 at 08:58:37AM +0100, Eugenio Perez Martin wrote: > On Tue, Jan 31, 2023 at 4:16 AM Jason Wang wrote: > > > > On Tue, Jan 31, 2023 at 12:39 AM Eugenio Perez Martin > > wrote: > > > > > > On Sun, Jan 29, 2023 at 7:01 AM Jason Wang wrote: > > > > > > > > On Thu, Jan 19, 2023 at

Re: [PATCH v2 01/11] genirq/affinity:: Export irq_create_affinity_masks()

2023-02-13 Thread Michael S. Tsirkin
On Mon, Jan 30, 2023 at 07:53:55PM +0800, Yongji Xie wrote: > On Fri, Jan 27, 2023 at 4:22 PM Michael S. Tsirkin wrote: > > > > On Mon, Dec 19, 2022 at 05:36:02PM +0800, Yongji Xie wrote: > > > On Mon, Dec 19, 2022 at 3:33 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Dec 05, 2022 a

Re: [PATCH] vhost: Add uAPI for Vhost SCMI backend

2023-02-13 Thread Leon Romanovsky
On Mon, Feb 13, 2023 at 10:04:17AM +0530, Neeraj Upadhyay wrote: > Add a uAPI for starting and stopping a SCMI vhost based > backend. > > Signed-off-by: Neeraj Upadhyay > --- > > SCMI Vhost backend implementation is work in progress: > https://lore.kernel.org/linux-arm-kernel/20220609071956.518