Commit 821c9e51 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio updates from Michael Tsirkin:

 - vhost can now support legacy threading if enabled in Kconfig

 - vsock memory allocation strategies for large buffers have been
   improved, reducing pressure on kmalloc

 - vhost now supports the in-order feature. guest bits missed the merge
   window.

 - fixes, cleanups all over the place

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (30 commits)
  vsock/virtio: Allocate nonlinear SKBs for handling large transmit buffers
  vsock/virtio: Rename virtio_vsock_skb_rx_put()
  vhost/vsock: Allocate nonlinear SKBs for handling large receive buffers
  vsock/virtio: Move SKB allocation lower-bound check to callers
  vsock/virtio: Rename virtio_vsock_alloc_skb()
  vsock/virtio: Resize receive buffers so that each SKB fits in a 4K page
  vsock/virtio: Move length check to callers of virtio_vsock_skb_rx_put()
  vsock/virtio: Validate length in packet header before skb_put()
  vhost/vsock: Avoid allocating arbitrarily-sized SKBs
  vhost_net: basic in_order support
  vhost: basic in order support
  vhost: fail early when __vhost_add_used() fails
  vhost: Reintroduce kthread API and add mode selection
  vdpa: Fix IDR memory leak in VDUSE module exit
  vdpa/mlx5: Fix release of uninitialized resources on error path
  vhost-scsi: Fix check for inline_sg_cnt exceeding preallocated limit
  virtio: virtio_dma_buf: fix missing parameter documentation
  vhost: Fix typos
  vhost: vringh: Remove unused functions
  vhost: vringh: Remove unused iotlb functions
  ...
parents 0bd0a41a 66937314
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -130,10 +130,10 @@ static void virtio_gpu_remove(struct virtio_device *vdev)

static void virtio_gpu_shutdown(struct virtio_device *vdev)
{
	/*
	 * drm does its own synchronization on shutdown.
	 * Do nothing here, opt out of device reset.
	 */
	struct drm_device *dev = vdev->priv;

	/* stop talking to the device */
	drm_dev_unplug(dev);
}

static void virtio_gpu_config_changed(struct virtio_device *vdev)
+3 −0
Original line number Diff line number Diff line
@@ -908,6 +908,9 @@ void mlx5_vdpa_destroy_mr_resources(struct mlx5_vdpa_dev *mvdev)
{
	struct mlx5_vdpa_mr_resources *mres = &mvdev->mres;

	if (!mres->wq_gc)
		return;

	atomic_set(&mres->shutdown, 1);

	flush_delayed_work(&mres->gc_dwork_ent);
+7 −5
Original line number Diff line number Diff line
@@ -2491,7 +2491,7 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
        }

	mvq = &ndev->vqs[idx];
	ndev->needs_teardown = num != mvq->num_ent;
	ndev->needs_teardown |= num != mvq->num_ent;
	mvq->num_ent = num;
}

@@ -3432,15 +3432,17 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev)

	ndev = to_mlx5_vdpa_ndev(mvdev);

	/* Functions called here should be able to work with
	 * uninitialized resources.
	 */
	free_fixed_resources(ndev);
	mlx5_vdpa_clean_mrs(mvdev);
	mlx5_vdpa_destroy_mr_resources(&ndev->mvdev);
	mlx5_cmd_cleanup_async_ctx(&mvdev->async_ctx);

	if (!is_zero_ether_addr(ndev->config.mac)) {
		pfmdev = pci_get_drvdata(pci_physfn(mvdev->mdev->pdev));
		mlx5_mpfs_del_mac(pfmdev, ndev->config.mac);
	}
	mlx5_cmd_cleanup_async_ctx(&mvdev->async_ctx);
	mlx5_vdpa_free_resources(&ndev->mvdev);
	free_irqs(ndev);
	kfree(ndev->event_cbs);
@@ -3888,6 +3890,8 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
	mvdev->actual_features =
			(device_features & BIT_ULL(VIRTIO_F_VERSION_1));

	mlx5_cmd_init_async_ctx(mdev, &mvdev->async_ctx);

	ndev->vqs = kcalloc(max_vqs, sizeof(*ndev->vqs), GFP_KERNEL);
	ndev->event_cbs = kcalloc(max_vqs + 1, sizeof(*ndev->event_cbs), GFP_KERNEL);
	if (!ndev->vqs || !ndev->event_cbs) {
@@ -3960,8 +3964,6 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
		ndev->rqt_size = 1;
	}

	mlx5_cmd_init_async_ctx(mdev, &mvdev->async_ctx);

	ndev->mvdev.mlx_features = device_features;
	mvdev->vdev.dma_dev = &mdev->pdev->dev;
	err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
+1 −0
Original line number Diff line number Diff line
@@ -2216,6 +2216,7 @@ static void vduse_exit(void)
	cdev_del(&vduse_ctrl_cdev);
	unregister_chrdev_region(vduse_major, VDUSE_DEV_MAX);
	class_unregister(&vduse_class);
	idr_destroy(&vduse_idr);
}
module_exit(vduse_exit);

+18 −0
Original line number Diff line number Diff line
@@ -95,4 +95,22 @@ config VHOST_CROSS_ENDIAN_LEGACY

	  If unsure, say "N".

config VHOST_ENABLE_FORK_OWNER_CONTROL
	bool "Enable VHOST_ENABLE_FORK_OWNER_CONTROL"
	default y
	help
	  This option enables two IOCTLs: VHOST_SET_FORK_FROM_OWNER and
	  VHOST_GET_FORK_FROM_OWNER. These allow userspace applications
	  to modify the vhost worker mode for vhost devices.

	  Also expose module parameter 'fork_from_owner_default' to allow users
	  to configure the default mode for vhost workers.

	  By default, `VHOST_ENABLE_FORK_OWNER_CONTROL` is set to `y`,
	  users can change the worker thread mode as needed.
	  If this config is disabled (n),the related IOCTLs and parameters will
	  be unavailable.

	  If unsure, say "Y".

endif
Loading