Commit f1e84eb3bba3d6a5691ce1832ff7e550768560d8
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Showing 4 changed files Side-by-side Diff
drivers/vhost/net.c
drivers/vhost/vhost.c
... | ... | @@ -222,6 +222,8 @@ |
222 | 222 | if (work) { |
223 | 223 | __set_current_state(TASK_RUNNING); |
224 | 224 | work->fn(work); |
225 | + if (need_resched()) | |
226 | + schedule(); | |
225 | 227 | } else |
226 | 228 | schedule(); |
227 | 229 | |
... | ... | @@ -403,7 +405,7 @@ |
403 | 405 | if (!memory) |
404 | 406 | return -ENOMEM; |
405 | 407 | |
406 | - vhost_dev_cleanup(dev); | |
408 | + vhost_dev_cleanup(dev, true); | |
407 | 409 | |
408 | 410 | memory->nregions = 0; |
409 | 411 | RCU_INIT_POINTER(dev->memory, memory); |
... | ... | @@ -434,8 +436,8 @@ |
434 | 436 | return j; |
435 | 437 | } |
436 | 438 | |
437 | -/* Caller should have device mutex */ | |
438 | -void vhost_dev_cleanup(struct vhost_dev *dev) | |
439 | +/* Caller should have device mutex if and only if locked is set */ | |
440 | +void vhost_dev_cleanup(struct vhost_dev *dev, bool locked) | |
439 | 441 | { |
440 | 442 | int i; |
441 | 443 | |
... | ... | @@ -472,7 +474,8 @@ |
472 | 474 | dev->log_file = NULL; |
473 | 475 | /* No one will access memory at this point */ |
474 | 476 | kfree(rcu_dereference_protected(dev->memory, |
475 | - lockdep_is_held(&dev->mutex))); | |
477 | + locked == | |
478 | + lockdep_is_held(&dev->mutex))); | |
476 | 479 | RCU_INIT_POINTER(dev->memory, NULL); |
477 | 480 | WARN_ON(!list_empty(&dev->work_list)); |
478 | 481 | if (dev->worker) { |
drivers/vhost/vhost.h
... | ... | @@ -163,7 +163,7 @@ |
163 | 163 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs); |
164 | 164 | long vhost_dev_check_owner(struct vhost_dev *); |
165 | 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 | 167 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); |
168 | 168 | int vhost_vq_access_ok(struct vhost_virtqueue *vq); |
169 | 169 | int vhost_log_access_ok(struct vhost_dev *); |
tools/virtio/linux/virtio.h
... | ... | @@ -181,6 +181,9 @@ |
181 | 181 | #define smp_mb() mb() |
182 | 182 | # define smp_rmb() barrier() |
183 | 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 | 187 | #else |
185 | 188 | #error Please fill in barrier macros |
186 | 189 | #endif |