From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: Re: [PATCH 2/2] vhost: Avoid that vhost_work_flush() returns early Date: Wed, 14 Aug 2013 17:19:06 +0200 Message-ID: <520B9FEA.7090005@acm.org> References: <520B2B47.9040002@acm.org> <520B2BC0.3050807@acm.org> <20130814114640.GG5430@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Asias He , kvm-devel To: "Michael S. Tsirkin" Return-path: Received: from georges.telenet-ops.be ([195.130.137.68]:56384 "EHLO georges.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859Ab3HNPTK (ORCPT ); Wed, 14 Aug 2013 11:19:10 -0400 In-Reply-To: <20130814114640.GG5430@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/14/13 13:46, Michael S. Tsirkin wrote: > I'm confused by this explanation. > done_seq is set here: > if (work) { > work->done_seq = seq; > if (work->flushing) > wake_up_all(&work->done); > } > > and work is set here: > > if (!list_empty(&dev->work_list)) { > work = list_first_entry(&dev->work_list, > struct vhost_work, node); > list_del_init(&work->node); > seq = work->queue_seq; > } > > this work is processed on the next line: > > if (work) { > __set_current_state(TASK_RUNNING); > work->fn(work); > if (need_resched()) > schedule(); > } > > so how do we end up with a sequence of a work item > that isn't processed? I was wondering what would happen if a work item got requeued before done_seq is set. I think you are right and this should work fine. Bart.