diff options
-rw-r--r-- | drivers/vhost/net.c | 2 | ||||
-rw-r--r-- | drivers/vhost/vhost.c | 11 | ||||
-rw-r--r-- | drivers/vhost/vhost.h | 2 | ||||
-rw-r--r-- | tools/virtio/linux/hrtimer.h | 0 | ||||
-rw-r--r-- | tools/virtio/linux/module.h | 0 | ||||
-rw-r--r-- | tools/virtio/linux/virtio.h | 3 |
6 files changed, 12 insertions, 6 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 9dab1f51dd43..f0da2c32fbde 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -588,7 +588,7 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
588 | 588 | ||
589 | vhost_net_stop(n, &tx_sock, &rx_sock); | 589 | vhost_net_stop(n, &tx_sock, &rx_sock); |
590 | vhost_net_flush(n); | 590 | vhost_net_flush(n); |
591 | vhost_dev_cleanup(&n->dev); | 591 | vhost_dev_cleanup(&n->dev, false); |
592 | if (tx_sock) | 592 | if (tx_sock) |
593 | fput(tx_sock->file); | 593 | fput(tx_sock->file); |
594 | if (rx_sock) | 594 | if (rx_sock) |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index bdb2d6436b2b..947f00d8e091 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -222,6 +222,8 @@ static int vhost_worker(void *data) | |||
222 | if (work) { | 222 | if (work) { |
223 | __set_current_state(TASK_RUNNING); | 223 | __set_current_state(TASK_RUNNING); |
224 | work->fn(work); | 224 | work->fn(work); |
225 | if (need_resched()) | ||
226 | schedule(); | ||
225 | } else | 227 | } else |
226 | schedule(); | 228 | schedule(); |
227 | 229 | ||
@@ -403,7 +405,7 @@ long vhost_dev_reset_owner(struct vhost_dev *dev) | |||
403 | if (!memory) | 405 | if (!memory) |
404 | return -ENOMEM; | 406 | return -ENOMEM; |
405 | 407 | ||
406 | vhost_dev_cleanup(dev); | 408 | vhost_dev_cleanup(dev, true); |
407 | 409 | ||
408 | memory->nregions = 0; | 410 | memory->nregions = 0; |
409 | RCU_INIT_POINTER(dev->memory, memory); | 411 | RCU_INIT_POINTER(dev->memory, memory); |
@@ -434,8 +436,8 @@ int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq) | |||
434 | return j; | 436 | return j; |
435 | } | 437 | } |
436 | 438 | ||
437 | /* Caller should have device mutex */ | 439 | /* Caller should have device mutex if and only if locked is set */ |
438 | void vhost_dev_cleanup(struct vhost_dev *dev) | 440 | void vhost_dev_cleanup(struct vhost_dev *dev, bool locked) |
439 | { | 441 | { |
440 | int i; | 442 | int i; |
441 | 443 | ||
@@ -472,7 +474,8 @@ void vhost_dev_cleanup(struct vhost_dev *dev) | |||
472 | dev->log_file = NULL; | 474 | dev->log_file = NULL; |
473 | /* No one will access memory at this point */ | 475 | /* No one will access memory at this point */ |
474 | kfree(rcu_dereference_protected(dev->memory, | 476 | kfree(rcu_dereference_protected(dev->memory, |
475 | lockdep_is_held(&dev->mutex))); | 477 | locked == |
478 | lockdep_is_held(&dev->mutex))); | ||
476 | RCU_INIT_POINTER(dev->memory, NULL); | 479 | RCU_INIT_POINTER(dev->memory, NULL); |
477 | WARN_ON(!list_empty(&dev->work_list)); | 480 | WARN_ON(!list_empty(&dev->work_list)); |
478 | if (dev->worker) { | 481 | if (dev->worker) { |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index a801e2821d03..8dcf4cca6bf2 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -163,7 +163,7 @@ struct vhost_dev { | |||
163 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs); | 163 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs); |
164 | long vhost_dev_check_owner(struct vhost_dev *); | 164 | long vhost_dev_check_owner(struct vhost_dev *); |
165 | long vhost_dev_reset_owner(struct vhost_dev *); | 165 | long vhost_dev_reset_owner(struct vhost_dev *); |
166 | void vhost_dev_cleanup(struct vhost_dev *); | 166 | void vhost_dev_cleanup(struct vhost_dev *, bool locked); |
167 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); | 167 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); |
168 | int vhost_vq_access_ok(struct vhost_virtqueue *vq); | 168 | int vhost_vq_access_ok(struct vhost_virtqueue *vq); |
169 | int vhost_log_access_ok(struct vhost_dev *); | 169 | int vhost_log_access_ok(struct vhost_dev *); |
diff --git a/tools/virtio/linux/hrtimer.h b/tools/virtio/linux/hrtimer.h new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/tools/virtio/linux/hrtimer.h | |||
diff --git a/tools/virtio/linux/module.h b/tools/virtio/linux/module.h new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/tools/virtio/linux/module.h | |||
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h index b4fbc91c41b4..7579f19e61e0 100644 --- a/tools/virtio/linux/virtio.h +++ b/tools/virtio/linux/virtio.h | |||
@@ -181,6 +181,9 @@ struct virtqueue { | |||
181 | #define smp_mb() mb() | 181 | #define smp_mb() mb() |
182 | # define smp_rmb() barrier() | 182 | # define smp_rmb() barrier() |
183 | # define smp_wmb() barrier() | 183 | # define smp_wmb() barrier() |
184 | /* Weak barriers should be used. If not - it's a bug */ | ||
185 | # define rmb() abort() | ||
186 | # define wmb() abort() | ||
184 | #else | 187 | #else |
185 | #error Please fill in barrier macros | 188 | #error Please fill in barrier macros |
186 | #endif | 189 | #endif |