Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

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

+21 -13
+4 -3
drivers/net/virtio_net.c
··· 5758 5758 disable_rx_mode_work(vi); 5759 5759 flush_work(&vi->rx_mode_work); 5760 5760 5761 - netif_tx_lock_bh(vi->dev); 5762 - netif_device_detach(vi->dev); 5763 - netif_tx_unlock_bh(vi->dev); 5764 5761 if (netif_running(vi->dev)) { 5765 5762 rtnl_lock(); 5766 5763 virtnet_close(vi->dev); 5767 5764 rtnl_unlock(); 5768 5765 } 5766 + 5767 + netif_tx_lock_bh(vi->dev); 5768 + netif_device_detach(vi->dev); 5769 + netif_tx_unlock_bh(vi->dev); 5769 5770 } 5770 5771 5771 5772 static int init_vqs(struct virtnet_info *vi);
+7 -2
drivers/vhost/net.c
··· 99 99 atomic_t refcount; 100 100 wait_queue_head_t wait; 101 101 struct vhost_virtqueue *vq; 102 + struct rcu_head rcu; 102 103 }; 103 104 104 105 #define VHOST_NET_BATCH 64 ··· 251 250 252 251 static int vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs) 253 252 { 254 - int r = atomic_sub_return(1, &ubufs->refcount); 253 + int r; 254 + 255 + rcu_read_lock(); 256 + r = atomic_sub_return(1, &ubufs->refcount); 255 257 if (unlikely(!r)) 256 258 wake_up(&ubufs->wait); 259 + rcu_read_unlock(); 257 260 return r; 258 261 } 259 262 ··· 270 265 static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs) 271 266 { 272 267 vhost_net_ubuf_put_and_wait(ubufs); 273 - kfree(ubufs); 268 + kfree_rcu(ubufs, rcu); 274 269 } 275 270 276 271 static void vhost_net_clear_ubuf_info(struct vhost_net *n)
+4
drivers/virtio/virtio_input.c
··· 360 360 { 361 361 struct virtio_input *vi = vdev->priv; 362 362 unsigned long flags; 363 + void *buf; 363 364 364 365 spin_lock_irqsave(&vi->lock, flags); 365 366 vi->ready = false; 366 367 spin_unlock_irqrestore(&vi->lock, flags); 367 368 369 + virtio_reset_device(vdev); 370 + while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL) 371 + kfree(buf); 368 372 vdev->config->del_vqs(vdev); 369 373 return 0; 370 374 }
+2 -2
drivers/virtio/virtio_pci_legacy_dev.c
··· 140 140 * vp_legacy_queue_vector - set the MSIX vector for a specific virtqueue 141 141 * @ldev: the legacy virtio-pci device 142 142 * @index: queue index 143 - * @vector: the config vector 143 + * @vector: the queue vector 144 144 * 145 - * Returns the config vector read from the device 145 + * Returns the queue vector read from the device 146 146 */ 147 147 u16 vp_legacy_queue_vector(struct virtio_pci_legacy_device *ldev, 148 148 u16 index, u16 vector)
+2 -2
drivers/virtio/virtio_pci_modern_dev.c
··· 546 546 * vp_modern_queue_vector - set the MSIX vector for a specific virtqueue 547 547 * @mdev: the modern virtio-pci device 548 548 * @index: queue index 549 - * @vector: the config vector 549 + * @vector: the queue vector 550 550 * 551 - * Returns the config vector read from the device 551 + * Returns the queue vector read from the device 552 552 */ 553 553 u16 vp_modern_queue_vector(struct virtio_pci_modern_device *mdev, 554 554 u16 index, u16 vector)
-2
include/linux/virtio_config.h
··· 328 328 bool virtio_get_shm_region(struct virtio_device *vdev, 329 329 struct virtio_shm_region *region, u8 id) 330 330 { 331 - if (!region->len) 332 - return false; 333 331 if (!vdev->config->get_shm_region) 334 332 return false; 335 333 return vdev->config->get_shm_region(vdev, region, id);
+2 -2
include/uapi/linux/vhost.h
··· 260 260 * When fork_owner is set to VHOST_FORK_OWNER_KTHREAD: 261 261 * - Vhost will create vhost workers as kernel threads. 262 262 */ 263 - #define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x83, __u8) 263 + #define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x84, __u8) 264 264 265 265 /** 266 266 * VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device. ··· 268 268 * 269 269 * @return: An 8-bit value indicating the current thread mode. 270 270 */ 271 - #define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x84, __u8) 271 + #define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x85, __u8) 272 272 273 273 #endif