Re: [PATCH vhost v3 3/4] virtio_pci: add check for common cfg size

2023-10-10 Thread Jason Wang
On Tue, Oct 10, 2023 at 3:58 PM Xuan Zhuo wrote: > > On Tue, 10 Oct 2023 14:41:39 +0800, Jason Wang wrote: > > On Tue, Oct 10, 2023 at 11:11 AM Xuan Zhuo > > wrote: > > > > > > Some buggy devices, the common cfg size may not match the features. > > > > > > This patch checks the common cfg size

Re: [RFC PATCH 5/7] tun: Introduce virtio-net hashing feature

2023-10-10 Thread Jason Wang
On Tue, Oct 10, 2023 at 2:19 PM Akihiko Odaki wrote: > > On 2023/10/10 15:00, Jason Wang wrote: > > On Tue, Oct 10, 2023 at 1:51 PM Akihiko Odaki > > wrote: > >> > >> On 2023/10/10 14:45, Jason Wang wrote: > >>> On Tue, Oct 10, 2023 at 9:52 AM Akihiko Odaki > >>> wrote: > > On

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 07:09:08PM +0300, Yishai Hadas wrote: > > > > Assuming that we'll put each command inside virtio as the generic layer, > > > we > > > won't be able to call/use this API internally to get the PF as of cyclic > > > dependencies between the modules, link will fail. I just

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 04:21:15PM +, Parav Pandit wrote: > > > From: Jason Gunthorpe > > Sent: Tuesday, October 10, 2023 9:37 PM > > > > On Tue, Oct 10, 2023 at 12:03:29PM -0400, Michael S. Tsirkin wrote: > > > On Tue, Oct 10, 2023 at 12:59:37PM -0300, Jason Gunthorpe wrote: > > > > On

RE: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Parav Pandit via Virtualization
> From: Jason Gunthorpe > Sent: Tuesday, October 10, 2023 9:37 PM > > On Tue, Oct 10, 2023 at 12:03:29PM -0400, Michael S. Tsirkin wrote: > > On Tue, Oct 10, 2023 at 12:59:37PM -0300, Jason Gunthorpe wrote: > > > On Tue, Oct 10, 2023 at 11:14:56AM -0400, Michael S. Tsirkin wrote: > > > > > > >

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Yishai Hadas via Virtualization
On 10/10/2023 18:58, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 06:43:32PM +0300, Yishai Hadas wrote: On 10/10/2023 18:14, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 06:09:44PM +0300, Yishai Hadas wrote: On 10/10/2023 17:54, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 12:59:37PM -0300, Jason Gunthorpe wrote: > On Tue, Oct 10, 2023 at 11:14:56AM -0400, Michael S. Tsirkin wrote: > > > I suggest 3 but call it on the VF. commands will switch to PF > > internally as needed. For example, intel might be interested in exposing > > admin

RE: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Parav Pandit via Virtualization
> From: Yishai Hadas > Sent: Tuesday, October 10, 2023 9:14 PM > > On 10/10/2023 18:14, Michael S. Tsirkin wrote: > > On Tue, Oct 10, 2023 at 06:09:44PM +0300, Yishai Hadas wrote: > >> On 10/10/2023 17:54, Michael S. Tsirkin wrote: > >>> On Tue, Oct 10, 2023 at 11:08:49AM -0300, Jason

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 06:43:32PM +0300, Yishai Hadas wrote: > On 10/10/2023 18:14, Michael S. Tsirkin wrote: > > On Tue, Oct 10, 2023 at 06:09:44PM +0300, Yishai Hadas wrote: > > > On 10/10/2023 17:54, Michael S. Tsirkin wrote: > > > > On Tue, Oct 10, 2023 at 11:08:49AM -0300, Jason Gunthorpe

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Yishai Hadas via Virtualization
On 10/10/2023 18:14, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 06:09:44PM +0300, Yishai Hadas wrote: On 10/10/2023 17:54, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 11:08:49AM -0300, Jason Gunthorpe wrote: On Tue, Oct 10, 2023 at 09:56:00AM -0400, Michael S. Tsirkin wrote:

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 06:09:44PM +0300, Yishai Hadas wrote: > On 10/10/2023 17:54, Michael S. Tsirkin wrote: > > On Tue, Oct 10, 2023 at 11:08:49AM -0300, Jason Gunthorpe wrote: > > > On Tue, Oct 10, 2023 at 09:56:00AM -0400, Michael S. Tsirkin wrote: > > > > > > > > However - the Intel GPU

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Yishai Hadas via Virtualization
On 10/10/2023 17:54, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 11:08:49AM -0300, Jason Gunthorpe wrote: On Tue, Oct 10, 2023 at 09:56:00AM -0400, Michael S. Tsirkin wrote: However - the Intel GPU VFIO driver is such a bad experiance I don't want to encourage people to make VFIO

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 11:08:49AM -0300, Jason Gunthorpe wrote: > On Tue, Oct 10, 2023 at 09:56:00AM -0400, Michael S. Tsirkin wrote: > > > > However - the Intel GPU VFIO driver is such a bad experiance I don't > > > want to encourage people to make VFIO drivers, or code that is only > > > used

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-10 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 10:10:31AM -0300, Jason Gunthorpe wrote: > > > There is alot of code in VFIO and the VMM side to take a VF and turn > > > it into a vPCI function. You can't just trivially duplicate VFIO in a > > > dozen drivers without creating a giant mess. > > > > I do not advocate for

Re: [PATCH][next] iommu/virtio: Add __counted_by for struct viommu_request and use struct_size()

2023-10-10 Thread Jean-Philippe Brucker
On Mon, Oct 09, 2023 at 12:24:27PM -0600, Gustavo A. R. Silva wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for >

[PATCH 4/4] vdpa/mlx5: implement .reset_map driver op

2023-10-10 Thread Si-Wei Liu
Since commit 6f5312f80183 ("vdpa/mlx5: Add support for running with virtio_vdpa"), mlx5_vdpa starts with preallocate 1:1 DMA MR at device creation time. This 1:1 DMA MR will be implicitly destroyed while the first .set_map call is invoked, in which case callers like vhost-vdpa will start to set up

[PATCH 3/4] vhost-vdpa: introduce IOTLB_PERSIST backend feature bit

2023-10-10 Thread Si-Wei Liu
Userspace needs this feature flag to distinguish if vhost-vdpa iotlb in the kernel supports persistent IOTLB mapping across device reset. Without it, userspace has no way to tell apart if it's running on an older kernel, which could silently drop all iotlb mapping across vDPA reset. There are 3

[PATCH 0/4] vdpa: decouple reset of iotlb mapping from device reset

2023-10-10 Thread Si-Wei Liu
In order to reduce needlessly high setup and teardown cost of iotlb mapping during live migration, it's crucial to decouple the vhost-vdpa iotlb abstraction from the virtio device life cycle, i.e. iotlb mappings should be left intact across virtio device reset [1]. For it to work, the on-chip

[PATCH 1/4] vdpa: introduce .reset_map operation callback

2023-10-10 Thread Si-Wei Liu
Device specific IOMMU parent driver who wishes to see mapping to be decoupled from virtio or vdpa device life cycle (device reset) can use it to restore memory mapping in the device IOMMU to the initial or default state. The reset of mapping is done per address space basis. The reason why a

[PATCH 2/4] vhost-vdpa: reset vendor specific mapping to initial state in .release

2023-10-10 Thread Si-Wei Liu
Devices with on-chip IOMMU or vendor specific IOTLB implementation may need to restore iotlb mapping to the initial or default state using the .reset_map op, as it's desirable for some parent devices to solely manipulate mappings by its own, independent of virtio device state. For instance, device

Re: [PATCH vhost v3 3/4] virtio_pci: add check for common cfg size

2023-10-10 Thread Xuan Zhuo
On Tue, 10 Oct 2023 14:41:39 +0800, Jason Wang wrote: > On Tue, Oct 10, 2023 at 11:11 AM Xuan Zhuo wrote: > > > > Some buggy devices, the common cfg size may not match the features. > > > > This patch checks the common cfg size for the > > features(VIRTIO_F_NOTIF_CONFIG_DATA,

Re: [PATCH net-next v3 10/12] test/vsock: MSG_ZEROCOPY flag tests

2023-10-10 Thread Stefano Garzarella
On Mon, Oct 09, 2023 at 11:24:18PM +0300, Arseniy Krasnov wrote: On 09.10.2023 18:17, Stefano Garzarella wrote: On Sat, Oct 07, 2023 at 08:21:37PM +0300, Arseniy Krasnov wrote: This adds three tests for MSG_ZEROCOPY feature: 1) SOCK_STREAM tx with different buffers. 2) SOCK_SEQPACKET tx with

Re: [PATCH 2/2] virtio-mmio: Support multiple interrupts per device

2023-10-10 Thread Jason Wang
On Sat, Sep 30, 2023 at 4:46 AM Jakub Sitnicki wrote: > > Some virtual devices, such as the virtio network device, can use multiple > virtqueues (or multiple pairs of virtqueues in the case of a vNIC). In such > case, when there are multiple vCPUs present, it is possible to process > virtqueue

Re: [PATCH vhost v3 1/4] virtio: add definition of VIRTIO_F_NOTIF_CONFIG_DATA feature bit

2023-10-10 Thread Jason Wang
On Tue, Oct 10, 2023 at 11:11 AM Xuan Zhuo wrote: > > This patch adds the definition of VIRTIO_F_NOTIF_CONFIG_DATA feature bit > in the relevant header file. > > This feature indicates that the driver uses the data provided by the > device as a virtqueue identifier in available buffer

Re: [PATCH vhost v3 2/4] virtio_pci: fix the common cfg map size

2023-10-10 Thread Jason Wang
On Tue, Oct 10, 2023 at 11:11 AM Xuan Zhuo wrote: > > The function vp_modern_map_capability() takes the size parameter, > which corresponds to the size of virtio_pci_common_cfg. As a result, > this indicates the size of memory area to map. > > Now the size is the size of virtio_pci_common_cfg,

Re: [PATCH vhost v3 3/4] virtio_pci: add check for common cfg size

2023-10-10 Thread Jason Wang
On Tue, Oct 10, 2023 at 11:11 AM Xuan Zhuo wrote: > > Some buggy devices, the common cfg size may not match the features. > > This patch checks the common cfg size for the > features(VIRTIO_F_NOTIF_CONFIG_DATA, VIRTIO_F_RING_RESET). When the > common cfg size does not match the corresponding

Re: [PATCH vhost v3 16/16] vdpa/mlx5: Update cvq iotlb mapping on ASID change

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > For the following sequence: > - cvq group is in ASID 0 > - .set_map(1, cvq_iotlb) > - .set_group_asid(cvq_group, 1) > > ... the cvq mapping from ASID 0 will be used. This is not always correct > behaviour. > > This patch adds support for

Re: [PATCH vhost v3 15/16] vdpa/mlx5: Make iotlb helper functions more generic

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > They will be used in a follow-up patch. > > For dup_iotlb, avoid the src == dst case. This is an error. > > Acked-by: Eugenio Pérez > Signed-off-by: Dragos Tatulea Acked-by: Jason Wang Thanks

Re: [PATCH vhost v3 14/16] vdpa/mlx5: Enable hw support for vq descriptor mapping

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > Vq descriptor mappings are supported in hardware by filling in an > additional mkey which contains the descriptor mappings to the hw vq. > > A previous patch in this series added support for hw mkey (mr) creation > for ASID 1. > > This

Re: [PATCH vhost v3 13/16] vdpa/mlx5: Introduce mr for vq descriptor

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > Introduce the vq descriptor group and mr per ASID. Until now > .set_map on ASID 1 was only updating the cvq iotlb. From now on it also > creates a mkey for it. The current patch doesn't use it but follow-up > patches will add hardware

Re: [PATCH vhost v3 12/16] vdpa/mlx5: Improve mr update flow

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > The current flow for updating an mr works directly on mvdev->mr which > makes it cumbersome to handle multiple new mr structs. > > This patch makes the flow more straightforward by having > mlx5_vdpa_create_mr return a new mr which will

Re: [PATCH vhost v3 11/16] vdpa/mlx5: Move mr mutex out of mr struct

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > The mutex is named like it is supposed to protect only the mkey but in > reality it is a global lock for all mr resources. > > Shift the mutex to it's rightful location (struct mlx5_vdpa_dev) and > give it a more appropriate name. > >

Re: [PATCH vhost v3 10/16] vdpa/mlx5: Allow creation/deletion of any given mr struct

2023-10-10 Thread Jason Wang
On Mon, Oct 9, 2023 at 7:25 PM Dragos Tatulea wrote: > > This patch adapts the mr creation/deletion code to be able to work with > any given mr struct pointer. All the APIs are adapted to take an extra > parameter for the mr. > > mlx5_vdpa_create/delete_mr doesn't need a ASID parameter anymore.

Re: [RFC PATCH 5/7] tun: Introduce virtio-net hashing feature

2023-10-10 Thread Jason Wang
On Tue, Oct 10, 2023 at 1:51 PM Akihiko Odaki wrote: > > On 2023/10/10 14:45, Jason Wang wrote: > > On Tue, Oct 10, 2023 at 9:52 AM Akihiko Odaki > > wrote: > >> > >> On 2023/10/09 19:44, Willem de Bruijn wrote: > >>> On Mon, Oct 9, 2023 at 3:12 AM Akihiko Odaki > >>> wrote: > > On