Skip to content

Commit

Permalink
vhost, kcov: annotate vhost_worker
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
  • Loading branch information
xairy committed Apr 24, 2019
1 parent 160e35f commit fe2a85b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/vhost/vhost.c
Expand Up @@ -359,7 +359,13 @@ static int vhost_worker(void *data)
llist_for_each_entry_safe(work, work_next, node, node) {
clear_bit(VHOST_WORK_QUEUED, &work->flags);
__set_current_state(TASK_RUNNING);
#ifdef CONFIG_KCOV
kcov_remote_start(dev->kcov_handle);
#endif
work->fn(work);
#ifdef CONFIG_KCOV
kcov_remote_stop();
#endif
if (need_resched())
schedule();
}
Expand Down Expand Up @@ -504,6 +510,9 @@ long vhost_dev_set_owner(struct vhost_dev *dev)

/* No owner, become one */
dev->mm = get_task_mm(current);
#ifdef CONFIG_KCOV
dev->kcov_handle = current->kcov_handle;
#endif
worker = kthread_create(vhost_worker, dev, "vhost-%d", current->pid);
if (IS_ERR(worker)) {
err = PTR_ERR(worker);
Expand All @@ -529,6 +538,9 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
if (dev->mm)
mmput(dev->mm);
dev->mm = NULL;
#ifdef CONFIG_KCOV
dev->kcov_handle = 0;
#endif
err_mm:
return err;
}
Expand Down Expand Up @@ -640,6 +652,9 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
if (dev->worker) {
kthread_stop(dev->worker);
dev->worker = NULL;
#ifdef CONFIG_KCOV
dev->kcov_handle = 0;
#endif
}
if (dev->mm)
mmput(dev->mm);
Expand Down
3 changes: 3 additions & 0 deletions drivers/vhost/vhost.h
Expand Up @@ -171,6 +171,9 @@ struct vhost_dev {
struct list_head pending_list;
wait_queue_head_t wait;
int iov_limit;
#ifdef CONFIG_KCOV
u64 kcov_handle;
#endif
};

void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs,
Expand Down

0 comments on commit fe2a85b

Please sign in to comment.