Commit 39f90c19 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio/vhost fixes from Michael Tsirkin:
 "More small fixes. Most notably this fixes a messed up ioctl number,
  and a regression in shmem affecting drm users"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio_net: adjust the execution order of function `virtnet_close` during freeze
  virtio_input: Improve freeze handling
  vhost: Fix ioctl # for VHOST_[GS]ET_FORK_FROM_OWNER
  Revert "virtio: reject shm region if length is zero"
  vhost/net: Protect ubufs with rcu read lock in vhost_net_ubuf_put()
  virtio_pci: Fix misleading comment for queue vector
parents 518b21ba 45d8ef63
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -5758,14 +5758,15 @@ static void virtnet_freeze_down(struct virtio_device *vdev)
	disable_rx_mode_work(vi);
	flush_work(&vi->rx_mode_work);

	netif_tx_lock_bh(vi->dev);
	netif_device_detach(vi->dev);
	netif_tx_unlock_bh(vi->dev);
	if (netif_running(vi->dev)) {
		rtnl_lock();
		virtnet_close(vi->dev);
		rtnl_unlock();
	}

	netif_tx_lock_bh(vi->dev);
	netif_device_detach(vi->dev);
	netif_tx_unlock_bh(vi->dev);
}

static int init_vqs(struct virtnet_info *vi);
+7 −2
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ struct vhost_net_ubuf_ref {
	atomic_t refcount;
	wait_queue_head_t wait;
	struct vhost_virtqueue *vq;
	struct rcu_head rcu;
};

#define VHOST_NET_BATCH 64
@@ -250,9 +251,13 @@ vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy)

static int vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs)
{
	int r = atomic_sub_return(1, &ubufs->refcount);
	int r;

	rcu_read_lock();
	r = atomic_sub_return(1, &ubufs->refcount);
	if (unlikely(!r))
		wake_up(&ubufs->wait);
	rcu_read_unlock();
	return r;
}

@@ -265,7 +270,7 @@ static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs)
static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs)
{
	vhost_net_ubuf_put_and_wait(ubufs);
	kfree(ubufs);
	kfree_rcu(ubufs, rcu);
}

static void vhost_net_clear_ubuf_info(struct vhost_net *n)
+4 −0
Original line number Diff line number Diff line
@@ -360,11 +360,15 @@ static int virtinput_freeze(struct virtio_device *vdev)
{
	struct virtio_input *vi = vdev->priv;
	unsigned long flags;
	void *buf;

	spin_lock_irqsave(&vi->lock, flags);
	vi->ready = false;
	spin_unlock_irqrestore(&vi->lock, flags);

	virtio_reset_device(vdev);
	while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
		kfree(buf);
	vdev->config->del_vqs(vdev);
	return 0;
}
+2 −2
Original line number Diff line number Diff line
@@ -140,9 +140,9 @@ EXPORT_SYMBOL_GPL(vp_legacy_set_status);
 * vp_legacy_queue_vector - set the MSIX vector for a specific virtqueue
 * @ldev: the legacy virtio-pci device
 * @index: queue index
 * @vector: the config vector
 * @vector: the queue vector
 *
 * Returns the config vector read from the device
 * Returns the queue vector read from the device
 */
u16 vp_legacy_queue_vector(struct virtio_pci_legacy_device *ldev,
			   u16 index, u16 vector)
+2 −2
Original line number Diff line number Diff line
@@ -546,9 +546,9 @@ EXPORT_SYMBOL_GPL(vp_modern_set_queue_reset);
 * vp_modern_queue_vector - set the MSIX vector for a specific virtqueue
 * @mdev: the modern virtio-pci device
 * @index: queue index
 * @vector: the config vector
 * @vector: the queue vector
 *
 * Returns the config vector read from the device
 * Returns the queue vector read from the device
 */
u16 vp_modern_queue_vector(struct virtio_pci_modern_device *mdev,
			   u16 index, u16 vector)
Loading