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 fixes from Michael Tsirkin:
"A couple of fixes that seem important enough to pick at the last
moment"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
virtio-ring: fix DMA metadata flags
vduse: Fix race condition between resetting and irq injecting
vduse: Disallow injecting interrupt before DRIVER_OK is set

+26 -5
+25 -4
drivers/vdpa/vdpa_user/vduse_dev.c
··· 80 80 struct vdpa_callback config_cb; 81 81 struct work_struct inject; 82 82 spinlock_t irq_lock; 83 + struct rw_semaphore rwsem; 83 84 int minor; 84 85 bool broken; 85 86 bool connected; ··· 411 410 if (domain->bounce_map) 412 411 vduse_domain_reset_bounce_map(domain); 413 412 413 + down_write(&dev->rwsem); 414 + 414 415 dev->status = 0; 415 416 dev->driver_features = 0; 416 417 dev->generation++; ··· 446 443 flush_work(&vq->inject); 447 444 flush_work(&vq->kick); 448 445 } 446 + 447 + up_write(&dev->rwsem); 449 448 } 450 449 451 450 static int vduse_vdpa_set_vq_address(struct vdpa_device *vdpa, u16 idx, ··· 890 885 spin_unlock_irq(&vq->irq_lock); 891 886 } 892 887 888 + static int vduse_dev_queue_irq_work(struct vduse_dev *dev, 889 + struct work_struct *irq_work) 890 + { 891 + int ret = -EINVAL; 892 + 893 + down_read(&dev->rwsem); 894 + if (!(dev->status & VIRTIO_CONFIG_S_DRIVER_OK)) 895 + goto unlock; 896 + 897 + ret = 0; 898 + queue_work(vduse_irq_wq, irq_work); 899 + unlock: 900 + up_read(&dev->rwsem); 901 + 902 + return ret; 903 + } 904 + 893 905 static long vduse_dev_ioctl(struct file *file, unsigned int cmd, 894 906 unsigned long arg) 895 907 { ··· 988 966 break; 989 967 } 990 968 case VDUSE_DEV_INJECT_CONFIG_IRQ: 991 - ret = 0; 992 - queue_work(vduse_irq_wq, &dev->inject); 969 + ret = vduse_dev_queue_irq_work(dev, &dev->inject); 993 970 break; 994 971 case VDUSE_VQ_SETUP: { 995 972 struct vduse_vq_config config; ··· 1074 1053 if (index >= dev->vq_num) 1075 1054 break; 1076 1055 1077 - ret = 0; 1078 1056 index = array_index_nospec(index, dev->vq_num); 1079 - queue_work(vduse_irq_wq, &dev->vqs[index].inject); 1057 + ret = vduse_dev_queue_irq_work(dev, &dev->vqs[index].inject); 1080 1058 break; 1081 1059 } 1082 1060 default: ··· 1156 1136 INIT_LIST_HEAD(&dev->send_list); 1157 1137 INIT_LIST_HEAD(&dev->recv_list); 1158 1138 spin_lock_init(&dev->irq_lock); 1139 + init_rwsem(&dev->rwsem); 1159 1140 1160 1141 INIT_WORK(&dev->inject, vduse_dev_irq_inject); 1161 1142 init_waitqueue_head(&dev->waitq);
+1 -1
drivers/virtio/virtio_ring.c
··· 576 576 /* Last one doesn't continue. */ 577 577 desc[prev].flags &= cpu_to_virtio16(_vq->vdev, ~VRING_DESC_F_NEXT); 578 578 if (!indirect && vq->use_dma_api) 579 - vq->split.desc_extra[prev & (vq->split.vring.num - 1)].flags = 579 + vq->split.desc_extra[prev & (vq->split.vring.num - 1)].flags &= 580 580 ~VRING_DESC_F_NEXT; 581 581 582 582 if (indirect) {