File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 30
30
#include <linux/sched/signal.h>
31
31
#include <linux/interval_tree_generic.h>
32
32
#include <linux/nospec.h>
33
+ #include <linux/kcov.h>
33
34
34
35
#include "vhost.h"
35
36
@@ -357,7 +358,9 @@ static int vhost_worker(void *data)
357
358
llist_for_each_entry_safe (work , work_next , node , node ) {
358
359
clear_bit (VHOST_WORK_QUEUED , & work -> flags );
359
360
__set_current_state (TASK_RUNNING );
361
+ kcov_remote_start_common (dev -> kcov_handle );
360
362
work -> fn (work );
363
+ kcov_remote_stop ();
361
364
if (need_resched ())
362
365
schedule ();
363
366
}
@@ -546,6 +549,7 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
546
549
547
550
/* No owner, become one */
548
551
dev -> mm = get_task_mm (current );
552
+ dev -> kcov_handle = kcov_common_handle ();
549
553
worker = kthread_create (vhost_worker , dev , "vhost-%d" , current -> pid );
550
554
if (IS_ERR (worker )) {
551
555
err = PTR_ERR (worker );
@@ -571,6 +575,7 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
571
575
if (dev -> mm )
572
576
mmput (dev -> mm );
573
577
dev -> mm = NULL ;
578
+ dev -> kcov_handle = 0 ;
574
579
err_mm :
575
580
return err ;
576
581
}
@@ -682,6 +687,7 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
682
687
if (dev -> worker ) {
683
688
kthread_stop (dev -> worker );
684
689
dev -> worker = NULL ;
690
+ dev -> kcov_handle = 0 ;
685
691
}
686
692
if (dev -> mm )
687
693
mmput (dev -> mm );
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ struct vhost_dev {
173
173
int iov_limit ;
174
174
int weight ;
175
175
int byte_weight ;
176
+ u64 kcov_handle ;
176
177
};
177
178
178
179
bool vhost_exceeds_weight (struct vhost_virtqueue * vq , int pkts , int total_len );
You can’t perform that action at this time.
0 commit comments