search for: llist_for_each_entry_saf

Displaying 20 results from an estimated 22 matches for "llist_for_each_entry_saf".

2023 May 31
1
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...om> wrote: > > > > On 05/31, Jason Wang wrote: > > > > > > ? 2023/5/23 20:15, Oleg Nesterov ??: > > > > > > > > /* 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); > > > > > > > >I am not sure about smp_wmb + clear_bit. Once we clear VHOST_WORK_QUEUED, > > > >vhost_work_queue() can add this work again a...
2023 May 23
4
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...ker->work_list); if (!node) schedule(); node = llist_reverse_order(node); ... process works ... To me this looks a bit confusing. Shouldn't we do if (!node) { schedule(); continue; } just to make the code a bit more clear? If node == NULL then llist_reverse_order() and llist_for_each_entry_safe() will do nothing. But this is minor. /* 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); I am not sure about smp_wmb + clear_bit. Once we clear VHOST_WORK_QUEUED, vhost_work...
2023 Jun 01
1
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...gt; On 05/31, Jason Wang wrote: > > > > > > > > ? 2023/5/23 20:15, Oleg Nesterov ??: > > > > > > > > > > /* 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); > > > > > > > > > >I am not sure about smp_wmb + clear_bit. Once we clear VHOST_WORK_QUEUED, > > > > >vhost_work_queue() can a...
2023 May 22
1
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
On 05/22, Mike Christie wrote: > > On 5/22/23 7:30 AM, Oleg Nesterov wrote: > >> + /* > >> + * When we get a SIGKILL our release function will > >> + * be called. That will stop new IOs from being queued > >> + * and check for outstanding cmd responses. It will then > >> + * call vhost_task_stop to tell us to return and exit. >
2017 Nov 09
2
[PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
...struct se_cmd *se_cmd; struct iov_iter iov_iter; @@ -527,7 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) bitmap_zero(signal, VHOST_SCSI_MAX_VQ); llnode = llist_del_all(&vs->vs_completion_list); - llist_for_each_entry(cmd, llnode, tvc_completion_list) { + llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) { se_cmd = &cmd->tvc_se_cmd; pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__, -- 1.9.1
2017 Nov 09
2
[PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
...struct se_cmd *se_cmd; struct iov_iter iov_iter; @@ -527,7 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) bitmap_zero(signal, VHOST_SCSI_MAX_VQ); llnode = llist_del_all(&vs->vs_completion_list); - llist_for_each_entry(cmd, llnode, tvc_completion_list) { + llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) { se_cmd = &cmd->tvc_se_cmd; pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__, -- 1.9.1
2023 May 23
2
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...ode = llist_reverse_order(node); > ... process works ... > > To me this looks a bit confusing. Shouldn't we do > > if (!node) { > schedule(); > continue; > } > > just to make the code a bit more clear? If node == NULL then > llist_reverse_order() and llist_for_each_entry_safe() will do nothing. > But this is minor. > > > > /* 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); > > I am not sure about smp_wmb + clear_bi...
2016 Apr 26
2
[PATCH 1/2] vhost: simplify work flushing
We used to implement the work flushing through tracking queued seq, done seq, and the number of flushing. This patch simplify this by just implement work flushing through another kind of vhost work with completion. This will be used by lockless enqueuing patch. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/vhost.c | 53
2016 Apr 26
2
[PATCH 1/2] vhost: simplify work flushing
We used to implement the work flushing through tracking queued seq, done seq, and the number of flushing. This patch simplify this by just implement work flushing through another kind of vhost work with completion. This will be used by lockless enqueuing patch. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/vhost.c | 53
2017 Nov 16
0
[PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
...@@ -527,7 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) > > > > bitmap_zero(signal, VHOST_SCSI_MAX_VQ); > > llnode = llist_del_all(&vs->vs_completion_list); > > - llist_for_each_entry(cmd, llnode, tvc_completion_list) { > > + llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) { > > se_cmd = &cmd->tvc_se_cmd; > > > > pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__, > > -- > > 1.9.1
2019 Oct 17
0
[PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
...| 3 +++ > 2 files changed, 18 insertions(+) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index 36ca2cf419bf..71a349f6b352 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/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 "nor...
2019 Oct 17
0
[PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
...iff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > > > index 36ca2cf419bf..71a349f6b352 100644 > > > --- a/drivers/vhost/vhost.c > > > +++ b/drivers/vhost/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_hand...
2019 Oct 23
0
[PATCH 3/3] vhost, kcov: collect coverage from vhost_worker
...@ > #include <linux/sched/signal.h> > #include <linux/interval_tree_generic.h> > #include <linux/nospec.h> > +#include <linux/kcov.h> > > #include "vhost.h" > > @@ -357,7 +358,9 @@ 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); > + kcov_remote_start(dev->kcov_handle); > work->fn(work); > +...
2017 Nov 15
1
[PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
...t iov_iter iov_iter; > @@ -527,7 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) > > bitmap_zero(signal, VHOST_SCSI_MAX_VQ); > llnode = llist_del_all(&vs->vs_completion_list); > - llist_for_each_entry(cmd, llnode, tvc_completion_list) { > + llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) { > se_cmd = &cmd->tvc_se_cmd; > > pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__, > -- > 1.9.1
2019 Oct 23
0
[PATCH 3/3] vhost, kcov: collect coverage from vhost_worker
.../interval_tree_generic.h> > > > #include <linux/nospec.h> > > > +#include <linux/kcov.h> > > > > > > #include "vhost.h" > > > > > > @@ -357,7 +358,9 @@ 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); > > > + kcov_remote_start(dev->kcov_handle); > > >...
2016 Apr 26
0
[PATCH 2/2] vhost: lockless enqueuing
...del_init(&work->node); - } else - work = NULL; - spin_unlock_irq(&dev->work_lock); - if (work) { + node = llist_del_all(&dev->work_list); + if (!node) + schedule(); + + 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); work->fn(work); if (need_resched()) schedule(); - } else - schedule(); - + } } unuse_mm(dev->mm); set_fs(oldfs); @@ -398,9 +396,9 @@ void vhost_...
2016 Apr 26
2
[PATCH 2/2] vhost: lockless enqueuing
...>work_lock); > > - if (work) { > + node = llist_del_all(&dev->work_list); > + if (!node) > + schedule(); > + > + node = llist_reverse_order(node); Can we avoid llist reverse here? > + /* 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); > work->fn(work); > if (need_resched()) > schedule(); > - } else > - schedule(); > - > + } > } > unuse_mm(dev-&g...
2016 Apr 26
2
[PATCH 2/2] vhost: lockless enqueuing
...>work_lock); > > - if (work) { > + node = llist_del_all(&dev->work_list); > + if (!node) > + schedule(); > + > + node = llist_reverse_order(node); Can we avoid llist reverse here? > + /* 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); > work->fn(work); > if (need_resched()) > schedule(); > - } else > - schedule(); > - > + } > } > unuse_mm(dev-&g...
2023 Jun 01
4
[PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...et_current_state(TASK_RUNNING); - break; - } - - node = llist_del_all(&worker->work_list); - if (!node) - schedule(); - + node = llist_del_all(&worker->work_list); + if (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) } } - ret...
2018 Nov 02
0
[PATCH 1/1] Add vhost_blk driver
...ret; > +} > + > +static void vhost_blk_io_done_work(struct vhost_work *w) > +{ > + struct vhost_blk_queue *q = container_of(w, struct vhost_blk_queue, w); > + struct llist_node *node; > + struct vhost_blk_req *req, *tmp; > + > + node = llist_del_all(&q->wl); > + llist_for_each_entry_safe(req, tmp, node, list) { > + vhost_blk_req_done(req, req->res); > + } > + vhost_signal(&q->blk->dev, &q->vq); > +} > + > +static void vhost_blk_iocb_complete(struct kiocb *iocb, long ret, long ret2) > +{ > + struct vhost_blk_req *req = container_of(iocb,...