search for: kcov_handle

Displaying 20 results from an estimated 21 matches for "kcov_handle".

2019 Oct 23
0
[PATCH 3/3] vhost, kcov: collect coverage from vhost_worker
...ost_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); > + kcov_remote_start(dev->kcov_handle); > work->fn(work); > + kcov_remote_stop(); > if (need_resched()) > schedule(); > } > @@ -546,6 +549,7 @@ long vhost_dev_set_owner(struct vhost_dev *dev) > &...
2019 Oct 23
0
[PATCH 3/3] vhost, kcov: collect coverage from vhost_worker
...llist_for_each_entry_safe(work, work_next, node, node) { > > > clear_bit(VHOST_WORK_QUEUED, &work->flags); > > > __set_current_state(TASK_RUNNING); > > > + kcov_remote_start(dev->kcov_handle); > > > work->fn(work); > > > + kcov_remote_stop(); > > > if (need_resched()) > > > schedule(); > > > } > > > @@ -546,6 +549...
2019 Oct 17
0
[PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
.../vhost.c > @@ -357,7 +357,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 Shouldn't you hide these #ifdefs in a .h file? This is not a "normal" kernel coding style at all. > work->fn(work); > +#ifdef CONFIG_KCOV > + kcov_remote_stop(); > +#endif > if (need_resched()) > schedule(); > } > @@ -546,...
2023 Jun 05
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
...- if (!worker) + if (!dev->worker.vtsk) return; - dev->worker = NULL; - WARN_ON(!llist_empty(&worker->work_list)); - vhost_task_stop(worker->vtsk); - kfree(worker); + WARN_ON(!llist_empty(&dev->worker.work_list)); + vhost_task_stop(dev->worker.vtsk); + dev->worker.kcov_handle = 0; + dev->worker.vtsk = NULL; } static int vhost_worker_create(struct vhost_dev *dev) { - struct vhost_worker *worker; struct vhost_task *vtsk; char name[TASK_COMM_LEN]; - int ret; - - worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT); - if (!worker) - return -ENOMEM; - dev-&gt...
2023 Jun 05
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
...- if (!worker) + if (!dev->worker.vtsk) return; - dev->worker = NULL; - WARN_ON(!llist_empty(&worker->work_list)); - vhost_task_stop(worker->vtsk); - kfree(worker); + WARN_ON(!llist_empty(&dev->worker.work_list)); + vhost_task_stop(dev->worker.vtsk); + dev->worker.kcov_handle = 0; + dev->worker.vtsk = NULL; } static int vhost_worker_create(struct vhost_dev *dev) { - struct vhost_worker *worker; struct vhost_task *vtsk; char name[TASK_COMM_LEN]; - int ret; - - worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT); - if (!worker) - return -ENOMEM; - dev-&gt...
2023 Jun 01
1
[syzbot] [kvm?] [net?] [virt?] general protection fault in vhost_work_queue
...t vhost_dev *dev) > { >- struct vhost_worker *worker; > struct vhost_task *vtsk; > char name[TASK_COMM_LEN]; > int ret; > >- worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT); >- if (!worker) >- return -ENOMEM; >- >- dev->worker = worker; >- worker->kcov_handle = kcov_common_handle(); >- init_llist_head(&worker->work_list); >+ dev->worker.kcov_handle = kcov_common_handle(); >+ init_llist_head(&dev->worker.work_list); > snprintf(name, sizeof(name), "vhost-%d", current->pid); > >- vtsk = vhost_task_create(vho...
2023 Jun 06
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
...er.vtsk) > return; > >- dev->worker = NULL; >- WARN_ON(!llist_empty(&worker->work_list)); >- vhost_task_stop(worker->vtsk); >- kfree(worker); >+ WARN_ON(!llist_empty(&dev->worker.work_list)); >+ vhost_task_stop(dev->worker.vtsk); >+ dev->worker.kcov_handle = 0; >+ dev->worker.vtsk = NULL; > } > > static int vhost_worker_create(struct vhost_dev *dev) > { >- struct vhost_worker *worker; > struct vhost_task *vtsk; > char name[TASK_COMM_LEN]; >- int ret; >- >- worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT); &g...
2019 Oct 23
0
[PATCH v2 1/3] kcov: remote coverage support
...ocal background threads spawned from different > userspace processes, we can't use a single global handle per annotation. > Instead, the userspace process passes a non-zero handle through the > common_handle field of the kcov_remote_arg struct. This common handle gets > saved to the kcov_handle field in the current task_struct and needs to be > passed to the newly spawned threads via custom annotations. Those threads > should in turn be annotated with kcov_remote_start()/kcov_remote_stop(). > > Internally kcov stores handles as u64 integers. The top byte of a handle > is u...
2023 May 31
1
[syzbot] [kvm?] [net?] [virt?] general protection fault in vhost_work_queue
...LL); } static int vhost_worker_create(struct vhost_dev *dev) { - struct vhost_worker *worker; struct vhost_task *vtsk; char name[TASK_COMM_LEN]; int ret; - worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT); - if (!worker) - return -ENOMEM; - - dev->worker = worker; - worker->kcov_handle = kcov_common_handle(); - init_llist_head(&worker->work_list); + dev->worker.kcov_handle = kcov_common_handle(); + init_llist_head(&dev->worker.work_list); snprintf(name, sizeof(name), "vhost-%d", current->pid); - vtsk = vhost_task_create(vhost_worker, worker, name...
2019 Oct 21
0
[PATCH RFC 1/3] kcov: remote coverage support
...> Since there might be many local background threads spawned from different > userspace processes, we can't use a single global id per annotation. > Instead, the userspace process passes an id through the common_handle > field of the kcov_remote_arg struct. This id gets saved to the kcov_handle > field in the current task_struct and needs to be passed to the newly > spawned threads via custom annotations. Those threads should be in turn > annotated with kcov_remote_start/kcov_remote_stop. > > Signed-off-by: Andrey Konovalov <andreyknvl at google.com> > --- > Do...
2019 Oct 17
0
[PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
...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 > > > > Shouldn't you hide these #ifdefs in a .h file? This is not a "normal" > > kernel coding style at all. > > Well, if it's acceptable to add a kcov_handle field into vhost_dev > even when CONFIG_KCOV is not enabled, then w...
2023 Jun 06
2
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
...+d0d442c22fa8db45ff0e at syzkaller.appspotmail.com Ok. Will do. >> -??? } >> +??? vtsk = vhost_task_create(vhost_worker, &dev->worker, name); >> +??? if (!vtsk) >> +??????? return -ENOMEM; >> >> -??? worker->vtsk = vtsk; >> +??? dev->worker.kcov_handle = kcov_common_handle(); >> +??? dev->worker.vtsk = vtsk; > > vhost_work_queue() is called by vhost_transport_send_pkt() without > holding vhost_dev.mutex (like vhost_poll_queue() in several places). > > If vhost_work_queue() finds dev->worker.vtsk not NULL, how can we &...
2020 May 29
0
[PATCH 1/6] vhost: allow device that does not depend on vhost worker
...ev->use_worker = use_worker; dev->msg_handler = msg_handler; init_llist_head(&dev->work_list); init_waitqueue_head(&dev->wait); @@ -549,18 +556,21 @@ long vhost_dev_set_owner(struct vhost_dev *dev) /* No owner, become one */ dev->mm = get_task_mm(current); dev->kcov_handle = kcov_common_handle(); - worker = kthread_create(vhost_worker, dev, "vhost-%d", current->pid); - if (IS_ERR(worker)) { - err = PTR_ERR(worker); - goto err_worker; - } + if (dev->use_worker) { + worker = kthread_create(vhost_worker, dev, + "vhost-%d", current->pi...
2023 Jun 06
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
...; > Ok. Will do. > > > >> -??? } > >> +??? vtsk = vhost_task_create(vhost_worker, &dev->worker, name); > >> +??? if (!vtsk) > >> +??????? return -ENOMEM; > >> > >> -??? worker->vtsk = vtsk; > >> +??? dev->worker.kcov_handle = kcov_common_handle(); > >> +??? dev->worker.vtsk = vtsk; > > > > vhost_work_queue() is called by vhost_transport_send_pkt() without > > holding vhost_dev.mutex (like vhost_poll_queue() in several places). > > > > If vhost_work_queue() finds dev->work...
2023 Mar 28
1
[PATCH v6 11/11] vhost: allow userspace to create workers
...vhost_worker *vhost_worker_create(struct vhost_dev *dev) { struct vhost_worker *worker; struct vhost_task *vtsk; char name[TASK_COMM_LEN]; + int ret; + u32 id; worker = kzalloc(sizeof(*worker), GFP_KERNEL_ACCOUNT); if (!worker) return NULL; - dev->worker = worker; worker->kcov_handle = kcov_common_handle(); init_llist_head(&worker->work_list); + /* + * We increase the refcount for the initial creation and then + * later each time it's attached to a virtqueue. + */ + refcount_set(&worker->refcount, 1); snprintf(name, sizeof(name), "vhost-%d", c...
2020 May 29
12
[PATCH 0/6] vDPA: doorbell mapping
Hi all: This series introduce basic functionality of doorbell mapping support for vhost-vDPA. Userspace program may use mmap() to map a the doorbell of a specific virtqueue into its address space. This is help to reudce the syscall or vmexit overhead. A new vdpa_config_ops was introduced to report the location of the doorbell, vhost_vdpa may then choose to map the doorbell when: - The doorbell
2020 May 29
12
[PATCH 0/6] vDPA: doorbell mapping
Hi all: This series introduce basic functionality of doorbell mapping support for vhost-vDPA. Userspace program may use mmap() to map a the doorbell of a specific virtqueue into its address space. This is help to reudce the syscall or vmexit overhead. A new vdpa_config_ops was introduced to report the location of the doorbell, vhost_vdpa may then choose to map the doorbell when: - The doorbell
2023 Jun 01
4
[PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...node) { node = llist_reverse_order(node); /* make sure flag is seen after deletion */ smp_wmb(); llist_for_each_entry_safe(work, work_next, node, node) { clear_bit(VHOST_WORK_QUEUED, &work->flags); - __set_current_state(TASK_RUNNING); kcov_remote_start_common(worker->kcov_handle); work->fn(work); kcov_remote_stop(); @@ -365,7 +353,7 @@ static int vhost_worker(void *data) } } - return 0; + return !!node; } static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) diff --git a/fs/coredump.c b/fs/coredump.c index ece7badf701b..88740c51b942 100644 ---...
2023 Mar 28
12
[PATCH v6 00/11] vhost: multiple worker support
The following patches were built over linux-next which contains various vhost patches in mst's tree and the vhost_task patchset in Christian Brauner's tree: git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git kernel.user_worker branch: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=kernel.user_worker The latter patchset handles the review comment
2020 Sep 24
30
[RFC PATCH 00/24] Control VQ support in vDPA
Hi All: This series tries to add the support for control virtqueue in vDPA. Control virtqueue is used by networking device for accepting various commands from the driver. It's a must to support multiqueue and other configurations. When used by vhost-vDPA bus driver for VM, the control virtqueue should be shadowed via userspace VMM (Qemu) instead of being assigned directly to Guest. This is