[PATCH v2 1/3] vdpa: factor out vdpa_set_features_unlocked for vdpa internal use

2022-01-14 Thread Si-Wei Liu
No functional change introduced. vdpa bus driver such as virtio_vdpa or vhost_vdpa is not supposed to take care of the locking for core by its own. The locked API vdpa_set_features should suffice the bus driver's need. Signed-off-by: Si-Wei Liu Reviewed-by: Eli Cohen --- drivers/vdpa/vdpa.c

[PATCH v2 3/3] vdpa/mlx5: add validation for VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command

2022-01-14 Thread Si-Wei Liu
When control vq receives a VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command request from the driver, presently there is no validation against the number of queue pairs to configure, or even if multiqueue had been negotiated or not is unverified. This may lead to kernel panic due to uninitialized resource fo

[PATCH v2 2/3] vdpa/mlx5: should verify CTRL_VQ feature exists for MQ

2022-01-14 Thread Si-Wei Liu
Per VIRTIO v1.1 specification, section 5.1.3.1 Feature bit requirements: "VIRTIO_NET_F_MQ Requires VIRTIO_NET_F_CTRL_VQ". There's assumption in the mlx5_vdpa multiqueue code that MQ must come together with CTRL_VQ. However, there's nowhere in the upper layer to guarantee this assumption would hold

[PATCH v2 0/3] fixes for mlx5_vdpa multiqueue support

2022-01-14 Thread Si-Wei Liu
This patchset contains the fixes and code cleanups for a couple issues uncovered during the review for the "Allow for configuring max number of virtqueue pairs" series. It is based on Eli's fixes: 2e4cda633a22 ("vdpa/mlx5: Fix tracking of current number of VQs") in the vhost tree. -- v1 -> v2:

Re: [GIT PULL] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Michael S. Tsirkin
On Fri, Jan 14, 2022 at 08:56:14PM +, Jean-Philippe Brucker wrote: > Hi, > > On Fri, Jan 14, 2022 at 03:35:15PM -0500, Michael S. Tsirkin wrote: > > Jean-Philippe Brucker (5): > > iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG > > iommu/virtio: Support bypass domain

[GIT PULL v2] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Michael S. Tsirkin
Changes from v1: Dropped iommu changes at author's request. Pity this was only requested after I sent pull v1 :( Note that since these were the first in queue other hashes do not match what was in linux-next, however as the changes are in a separate driver, this should not matter. The following

Re: [GIT PULL] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Michael S. Tsirkin
On Fri, Jan 14, 2022 at 08:56:14PM +, Jean-Philippe Brucker wrote: > Hi, > > On Fri, Jan 14, 2022 at 03:35:15PM -0500, Michael S. Tsirkin wrote: > > Jean-Philippe Brucker (5): > > iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG > > iommu/virtio: Support bypass domain

Re: [GIT PULL] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Michael S. Tsirkin
On Fri, Jan 14, 2022 at 03:35:15PM -0500, Michael S. Tsirkin wrote: > The following changes since commit c9e6606c7fe92b50a02ce51dda82586ebdf99b48: > > Linux 5.16-rc8 (2022-01-02 14:23:25 -0800) > > are available in the Git repository at: > > https://git.kernel.org/pub/scm/linux/kernel/git/ms

[PATCH v2 3/3] virtio_mem: break device on remove

2022-01-14 Thread Michael S. Tsirkin
A common pattern for device reset is currently: vdev->config->reset(vdev); .. cleanup .. reset prevents new interrupts from arriving and waits for interrupt handlers to finish. However if - as is common - the handler queues a work request which is flushed during the cleanup stage, we have code ad

[PATCH v2 1/3] virtio: document virtio_reset_device

2022-01-14 Thread Michael S. Tsirkin
Looks like most callers get driver/device removal wrong. Document what's expected of callers. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 2ed6e2451fd8..

[PATCH v2 2/3] virtio_console: break out of buf poll on remove

2022-01-14 Thread Michael S. Tsirkin
A common pattern for device reset is currently: vdev->config->reset(vdev); .. cleanup .. reset prevents new interrupts from arriving and waits for interrupt handlers to finish. However if - as is common - the handler queues a work request which is flushed during the cleanup stage, we have code ad

Re: [PATCH] virtio_console: break out of buf poll on remove

2022-01-14 Thread Michael S. Tsirkin
On Tue, Oct 05, 2021 at 03:33:42PM +0200, Greg Kroah-Hartman wrote: > On Tue, Oct 05, 2021 at 03:04:07AM -0400, Michael S. Tsirkin wrote: > > A common pattern for device reset is currently: > > vdev->config->reset(vdev); > > .. cleanup .. > > > > reset prevents new interrupts from arriving and wai

[PATCH] virtio_mem: break device on remove

2022-01-14 Thread Michael S. Tsirkin
A common pattern for device reset is currently: vdev->config->reset(vdev); .. cleanup .. reset prevents new interrupts from arriving and waits for interrupt handlers to finish. However if - as is common - the handler queues a work request which is flushed during the cleanup stage, we have code ad

Re: [GIT PULL] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Jean-Philippe Brucker
Hi, On Fri, Jan 14, 2022 at 03:35:15PM -0500, Michael S. Tsirkin wrote: > Jean-Philippe Brucker (5): > iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG > iommu/virtio: Support bypass domains > iommu/virtio: Sort reserved regions > iommu/virtio: Pass end addres

[GIT PULL] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Michael S. Tsirkin
The following changes since commit c9e6606c7fe92b50a02ce51dda82586ebdf99b48: Linux 5.16-rc8 (2022-01-02 14:23:25 -0800) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus for you to fetch changes up to f04ac267029c8063fc35116

Re: [PATCH 4/4] vdpa/mlx5: Fix tracking of current number of VQs

2022-01-14 Thread Michael S. Tsirkin
On Tue, Jan 11, 2022 at 02:14:47PM -0800, Si-Wei Liu wrote: > Reviewed-by: Si-Wei Liu Note: the correct format is: Reviewed-by: Si-Wei Liu (with a space before <>). Pls take care in the future. Thanks! -- MST ___ Virtualization mailing list Virtua

Re: [PATCH] Bluetooth: virtio_bt: fix device removal

2022-01-14 Thread Michael S. Tsirkin
On Thu, Dec 16, 2021 at 08:58:31PM +0100, Marcel Holtmann wrote: > Hi Michael, > > > Device removal is clearly out of virtio spec: it attempts to remove > > unused buffers from a VQ before invoking device reset. To fix, make > > open/close NOPs and do all cleanup/setup in probe/remove.

[PATCH] virtio: acknowledge all features before access

2022-01-14 Thread Michael S. Tsirkin
The feature negotiation was designed in a way that makes it possible for devices to know which config fields will be accessed by drivers. This is broken since commit 404123c2db79 ("virtio: allow drivers to validate features") with fallout in at least block and net. We have a partial work-around in

[PATCH] virtio: unexport virtio_finalize_features

2022-01-14 Thread Michael S. Tsirkin
virtio_finalize_features is only used internally within virtio. No reason to export it. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio.c | 3 +-- include/linux/virtio.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/vir

Re: [RFC PATCH v3 7/8] drivers: virtio_mem: use pageblock size as the minimum virtio_mem size.

2022-01-14 Thread David Hildenbrand
On 05.01.22 22:47, Zi Yan wrote: > From: Zi Yan > > alloc_contig_range() now only needs to be aligned to pageblock_order, > drop virtio_mem size requirement that it needs to be the max of > pageblock_order and MAX_ORDER. > > Signed-off-by: Zi Yan > --- > drivers/virtio/virtio_mem.c | 3 +-- >

Re: [PATCH v1] vhost: cache avail index in vhost_enable_notify()

2022-01-14 Thread Michael S. Tsirkin
On Fri, Jan 14, 2022 at 02:38:16PM +0100, Stefano Garzarella wrote: > On Fri, Jan 14, 2022 at 07:45:35AM -0500, Michael S. Tsirkin wrote: > > On Fri, Jan 14, 2022 at 10:05:08AM +0100, Stefano Garzarella wrote: > > > In vhost_enable_notify() we enable the notifications and we read > > > the avail in

Re: [RFC PATCH v3 5/8] mm: page_isolation: check specified range for unmovable pages during isolation.

2022-01-14 Thread David Hildenbrand
On 05.01.22 22:47, Zi Yan wrote: > From: Zi Yan > > Enable set_migratetype_isolate() to check specified sub-range for > unmovable pages during isolation. Page isolation is done > at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all > pages within that granularity are intended t

Re: [PATCH v1] vhost: cache avail index in vhost_enable_notify()

2022-01-14 Thread Stefano Garzarella
On Fri, Jan 14, 2022 at 07:45:35AM -0500, Michael S. Tsirkin wrote: On Fri, Jan 14, 2022 at 10:05:08AM +0100, Stefano Garzarella wrote: In vhost_enable_notify() we enable the notifications and we read the avail index to check if new buffers have become available in the meantime. We are not cach

Re: [PATCH 2/3] vdpa/mlx5: set_features should nack MQ if no CTRL_VQ

2022-01-14 Thread Michael S. Tsirkin
On Fri, Jan 14, 2022 at 12:51:55AM -0800, Si-Wei Liu wrote: > > > On 1/12/2022 10:57 PM, Michael S. Tsirkin wrote: > > On Thu, Jan 13, 2022 at 12:10:50AM -0500, Si-Wei Liu wrote: > > > Made corresponding change per spec: > > > > > The device MUST NOT offer a feature which requires another featur

Re: [PATCH v1] vhost: cache avail index in vhost_enable_notify()

2022-01-14 Thread Michael S. Tsirkin
On Fri, Jan 14, 2022 at 10:05:08AM +0100, Stefano Garzarella wrote: > In vhost_enable_notify() we enable the notifications and we read > the avail index to check if new buffers have become available in > the meantime. > > We are not caching the avail index, so when the device will call > vhost_get

Re: [PATCH 0/3] fixes for mlx5_vdpa multiqueue support

2022-01-14 Thread Si-Wei Liu
On 1/12/2022 11:03 PM, Michael S. Tsirkin wrote: On Thu, Jan 13, 2022 at 12:10:48AM -0500, Si-Wei Liu wrote: This patchset contains the fixes for a few issues uncovered during the review for the "Allow for configuring max number of virtqueue pairs" series. It is based on Eli's fixes: 2e4cda63

Re: [PATCH 3/3] vdpa/mlx5: validate the queue pair value from driver

2022-01-14 Thread Si-Wei Liu
On 1/12/2022 11:00 PM, Michael S. Tsirkin wrote: On Thu, Jan 13, 2022 at 12:10:51AM -0500, Si-Wei Liu wrote: Fixes: 52893733f2c5 ("vdpa/mlx5: Add multiqueue support") Signed-off-by: Si-Wei Liu Add motivation for change in the commit log. --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 ++

[PATCH v1] vhost: cache avail index in vhost_enable_notify()

2022-01-14 Thread Stefano Garzarella
In vhost_enable_notify() we enable the notifications and we read the avail index to check if new buffers have become available in the meantime. We are not caching the avail index, so when the device will call vhost_get_vq_desc(), it will find the old value in the cache and it will read the avail i

Re: [PATCH 2/3] vdpa/mlx5: set_features should nack MQ if no CTRL_VQ

2022-01-14 Thread Si-Wei Liu
On 1/12/2022 10:57 PM, Michael S. Tsirkin wrote: On Thu, Jan 13, 2022 at 12:10:50AM -0500, Si-Wei Liu wrote: Made corresponding change per spec: The device MUST NOT offer a feature which requires another feature which was not offered. Says nothing about the driver though, and you seem to

Re: [RFC PATCH] vhost: cache avail index in vhost_enable_notify()

2022-01-14 Thread Stefano Garzarella
On Fri, Jan 14, 2022 at 02:18:01PM +0800, Jason Wang wrote: On Thu, Jan 13, 2022 at 10:57 PM Stefano Garzarella wrote: In vhost_enable_notify() we enable the notifications and we read the avail index to check if new buffers have become available in the meantime. In this case, the device would