search for: vhost_work

Displaying 20 results from an estimated 566 matches for "vhost_work".

2016 Apr 26
2
[PATCH 1/2] vhost: simplify work flushing
...rs/vhost/vhost.c b/drivers/vhost/vhost.c index 669fef1..73dd16d 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -131,6 +131,19 @@ static void vhost_reset_is_le(struct vhost_virtqueue *vq) vq->is_le = virtio_legacy_is_little_endian(); } +struct vhost_flush_struct { + struct vhost_work work; + struct completion wait_event; +}; + +static void vhost_flush_work(struct vhost_work *work) +{ + struct vhost_flush_struct *s; + + s = container_of(work, struct vhost_flush_struct, work); + complete(&s->wait_event); +} + static void vhost_poll_func(struct file *file, wait_queue_head_...
2016 Apr 26
2
[PATCH 1/2] vhost: simplify work flushing
...rs/vhost/vhost.c b/drivers/vhost/vhost.c index 669fef1..73dd16d 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -131,6 +131,19 @@ static void vhost_reset_is_le(struct vhost_virtqueue *vq) vq->is_le = virtio_legacy_is_little_endian(); } +struct vhost_flush_struct { + struct vhost_work work; + struct completion wait_event; +}; + +static void vhost_flush_work(struct vhost_work *work) +{ + struct vhost_flush_struct *s; + + s = container_of(work, struct vhost_flush_struct, work); + complete(&s->wait_event); +} + static void vhost_poll_func(struct file *file, wait_queue_head_...
2023 Mar 28
1
[PATCH v6 11/11] vhost: allow userspace to create workers
...insertions(+), 14 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 1fa5e9a49092..e40699e83c6d 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -271,7 +271,11 @@ EXPORT_SYMBOL_GPL(vhost_vq_work_queue); void vhost_dev_flush(struct vhost_dev *dev) { - vhost_work_flush_on(dev->worker); + struct vhost_worker *worker; + unsigned long i; + + xa_for_each(&dev->worker_xa, i, worker) + vhost_work_flush_on(worker); } EXPORT_SYMBOL_GPL(vhost_dev_flush); @@ -489,7 +493,6 @@ void vhost_dev_init(struct vhost_dev *dev, dev->umem = NULL; dev->io...
2010 Jul 29
1
[PATCH] vhost: locking/rcu cleanup
...vhost_net *net) +static void handle_rx(struct vhost_dev *dev) { + struct vhost_net *net = container_of(dev, struct vhost_net, dev); if (vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF)) handle_rx_mergeable(net); else handle_rx_big(net); } -static void handle_tx_kick(struct vhost_work *work) -{ - struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, - poll.work); - struct vhost_net *net = container_of(vq->dev, struct vhost_net, dev); - - handle_tx(net); -} - -static void handle_rx_kick(struct vhost_work *work) -{ - struct vhost_virtqueue *vq = contain...
2010 Jul 29
1
[PATCH] vhost: locking/rcu cleanup
...vhost_net *net) +static void handle_rx(struct vhost_dev *dev) { + struct vhost_net *net = container_of(dev, struct vhost_net, dev); if (vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF)) handle_rx_mergeable(net); else handle_rx_big(net); } -static void handle_tx_kick(struct vhost_work *work) -{ - struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, - poll.work); - struct vhost_net *net = container_of(vq->dev, struct vhost_net, dev); - - handle_tx(net); -} - -static void handle_rx_kick(struct vhost_work *work) -{ - struct vhost_virtqueue *vq = contain...
2023 Jun 05
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
If userspace does VHOST_VSOCK_SET_GUEST_CID before VHOST_SET_OWNER we can race where: 1. thread0 calls vhost_transport_send_pkt -> vhost_work_queue 2. thread1 does VHOST_SET_OWNER which calls vhost_worker_create. 3. vhost_worker_create will set the dev->worker pointer before setting the worker->vtsk pointer. 4. thread0's vhost_work_queue will see the dev->worker pointer is set and try to call vhost_task_wake using not yet se...
2023 Jun 05
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
If userspace does VHOST_VSOCK_SET_GUEST_CID before VHOST_SET_OWNER we can race where: 1. thread0 calls vhost_transport_send_pkt -> vhost_work_queue 2. thread1 does VHOST_SET_OWNER which calls vhost_worker_create. 3. vhost_worker_create will set the dev->worker pointer before setting the worker->vtsk pointer. 4. thread0's vhost_work_queue will see the dev->worker pointer is set and try to call vhost_task_wake using not yet se...
2023 Mar 28
12
[PATCH v6 00/11] vhost: multiple worker support
...as a bottleneck at around 12 vqs/jobs. 2. Because we have a hard limit of 1024 cmds, if the num jobs * iodepth was greater than 1024, I would decrease iodepth. So 12 jobs used 85 cmds, and 16 used 64. 3. The perf issue above at 2 jobs is because when we only have 1 worker we execute more cmds per vhost_work due to all vqs funneling to one worker. This results in less context switches and better batching without having to tweak any settings. I'm working on patches to add back batching during lio completion and do polling on the submission side. We will still want the threading patches, because if...
2023 May 31
1
[syzbot] [kvm?] [net?] [virt?] general protection fault in vhost_work_queue
...f08e7864..03fd47a22a73 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -235,7 +235,7 @@ void vhost_dev_flush(struct vhost_dev *dev) { struct vhost_flush_struct flush; - if (dev->worker) { + if (READ_ONCE(dev->worker.vtsk)) { init_completion(&flush.wait_event); vhost_work_init(&flush.work, vhost_flush_work); @@ -247,7 +247,9 @@ EXPORT_SYMBOL_GPL(vhost_dev_flush); void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) { - if (!dev->worker) + struct vhost_task *vtsk = READ_ONCE(dev->worker.vtsk); + + if (!vtsk) return; if (!test_a...
2019 Oct 17
0
[PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
On Thu, Oct 17, 2019 at 07:44:15PM +0200, Andrey Konovalov wrote: > This patch adds kcov_remote_start/kcov_remote_stop annotations to the > vhost_worker function, which is responsible for processing vhost works. > Since vhost_worker is spawned when a vhost device instance is created, > the common kcov handle is used for kcov_remote_start/stop annotations. > > Signed-off-by: Andrey Konovalov <andreyknvl at google.com> > --- &...
2019 Oct 23
0
[PATCH 3/3] vhost, kcov: collect coverage from vhost_worker
On Tue, Oct 22, 2019 at 6:46 PM Andrey Konovalov <andreyknvl at google.com> wrote: > > This patch adds kcov_remote_start()/kcov_remote_stop() annotations to the > vhost_worker() function, which is responsible for processing vhost works. > Since vhost_worker() threads are spawned per vhost device instance > the common kcov handle is used for kcov_remote_start()/stop() annotations > (see Documentation/dev-tools/kcov.rst for details). As the result kcov can >...
2016 Apr 26
0
[PATCH 2/2] vhost: lockless enqueuing
...2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 73dd16d..0061a7b 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -168,7 +168,7 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync, void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn) { - INIT_LIST_HEAD(&work->node); + clear_bit(VHOST_WORK_QUEUED, &work->flags); work->fn = fn; init_waitqueue_head(&work->done); } @@ -246,15 +246,16 @@ EXPORT_SYMBOL_GPL(vhost_poll_flush); void vhost_work_queue(struc...
2019 Oct 23
0
[PATCH 3/3] vhost, kcov: collect coverage from vhost_worker
...23, 2019 at 10:36 AM Dmitry Vyukov <dvyukov at google.com> wrote: > > > > On Tue, Oct 22, 2019 at 6:46 PM Andrey Konovalov <andreyknvl at google.com> wrote: > > > > > > This patch adds kcov_remote_start()/kcov_remote_stop() annotations to the > > > vhost_worker() function, which is responsible for processing vhost works. > > > Since vhost_worker() threads are spawned per vhost device instance > > > the common kcov handle is used for kcov_remote_start()/stop() annotations > > > (see Documentation/dev-tools/kcov.rst for details)...
2019 Oct 17
0
[PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
...wrote: > On Thu, Oct 17, 2019 at 8:18 PM Greg Kroah-Hartman > <gregkh at linuxfoundation.org> wrote: > > > > On Thu, Oct 17, 2019 at 07:44:15PM +0200, Andrey Konovalov wrote: > > > This patch adds kcov_remote_start/kcov_remote_stop annotations to the > > > vhost_worker function, which is responsible for processing vhost works. > > > Since vhost_worker is spawned when a vhost device instance is created, > > > the common kcov handle is used for kcov_remote_start/stop annotations. > > > > > > Signed-off-by: Andrey Konovalov <...
2010 Nov 29
1
[PATCH] vhost: fix typos in comment
...ock_hlen, in); msg.msg_iovlen = in; err = sock->ops->recvmsg(NULL, sock, &msg, diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 073d06a..2af44b7 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -102,7 +102,7 @@ struct vhost_virtqueue { * flush the vhost_work instead of synchronize_rcu. Therefore readers do * not need to call rcu_read_lock/rcu_read_unlock: the beginning of * vhost_work execution acts instead of rcu_read_lock() and the end of - * vhost_work execution acts instead of rcu_read_lock(). + * vhost_work execution acts instead of rcu_re...
2010 Nov 29
1
[PATCH] vhost: fix typos in comment
...ock_hlen, in); msg.msg_iovlen = in; err = sock->ops->recvmsg(NULL, sock, &msg, diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 073d06a..2af44b7 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -102,7 +102,7 @@ struct vhost_virtqueue { * flush the vhost_work instead of synchronize_rcu. Therefore readers do * not need to call rcu_read_lock/rcu_read_unlock: the beginning of * vhost_work execution acts instead of rcu_read_lock() and the end of - * vhost_work execution acts instead of rcu_read_lock(). + * vhost_work execution acts instead of rcu_re...
2023 Jun 01
4
[PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...d not incorrectly detect the vhost task as another process. 2. kthreads disabled freeze by setting PF_NOFREEZE, but vhost tasks's didn't disable or add support for them. To fix both bugs, this switches the vhost task to be thread in the process that does the VHOST_SET_OWNER ioctl, and has vhost_worker call get_signal to support SIGKILL/SIGSTOP and freeze signals. Note that SIGKILL/STOP support is required because CLONE_THREAD requires CLONE_SIGHAND which requires those 2 signals to be supported. This is a modified version of the patch written by Mike Christie <michael.christie at oracle.co...
2023 Jun 06
1
[PATCH 1/1] vhost: Fix crash during early vhost_transport_send_pkt calls
On Mon, Jun 05, 2023 at 01:57:30PM -0500, Mike Christie wrote: >If userspace does VHOST_VSOCK_SET_GUEST_CID before VHOST_SET_OWNER we >can race where: >1. thread0 calls vhost_transport_send_pkt -> vhost_work_queue >2. thread1 does VHOST_SET_OWNER which calls vhost_worker_create. >3. vhost_worker_create will set the dev->worker pointer before setting >the worker->vtsk pointer. >4. thread0's vhost_work_queue will see the dev->worker pointer is >set and try to call vhost_task_w...
2023 Jun 01
1
[syzbot] [kvm?] [net?] [virt?] general protection fault in vhost_work_queue
.../drivers/vhost/vhost.c >+++ b/drivers/vhost/vhost.c >@@ -235,7 +235,7 @@ void vhost_dev_flush(struct vhost_dev *dev) > { > struct vhost_flush_struct flush; > >- if (dev->worker) { >+ if (READ_ONCE(dev->worker.vtsk)) { > init_completion(&flush.wait_event); > vhost_work_init(&flush.work, vhost_flush_work); > >@@ -247,7 +247,9 @@ EXPORT_SYMBOL_GPL(vhost_dev_flush); > > void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) > { >- if (!dev->worker) >+ struct vhost_task *vtsk = READ_ONCE(dev->worker.vtsk); >+ >+ if...
2023 Jan 26
1
[PATCH 2/2] vhost: check for pending livepatches from vhost worker kthreads
...transition indefinitely. We've > > > > > seen this happen fairly often with busy vhost kthreads. > > > > > > > > > --- a/drivers/vhost/vhost.c > > > > > +++ b/drivers/vhost/vhost.c > > > > > @@ -366,6 +367,9 @@ static int vhost_worker(void *data) > > > > > if (need_resched()) > > > > > schedule(); > > > > > } > > > > > + > > > > > + if (unlikely(klp_patch_pending(current))) > > > > > + klp_switch_current(); > > > &...