Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1146095rwd; Thu, 18 May 2023 08:29:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nYsvrxSQY++T+y7BQ1vLc8JUee61UjAUOY4loALziPEe4T4NOX7RpHqPUz5Uw4BL9UFOA X-Received: by 2002:a05:6a00:21c2:b0:645:ac97:52a4 with SMTP id t2-20020a056a0021c200b00645ac9752a4mr5073543pfj.8.1684423771274; Thu, 18 May 2023 08:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684423771; cv=none; d=google.com; s=arc-20160816; b=0W/jVCYzDjY8geJGeb436fWf0f22ijXStLkqYt4IsylpQGCJBFipiCt9xIceL2VmUN L+v2BXNCRtS7Qmo1wJpulfDA4pmZXSuTv/Z06h0lUqYvYyvXxCTZbXjt2k/cJHH+Y1Oh 1FtouxJniVrwFXA9nJGhPCyC+/o1RtlJHu0BlARUVchH6bVfXTu09kc/w0k425OH+gG7 vnYywN8swo+Ec2v8iOcwFxR68YxwCE+ZGpWyD8/Kb0hSijA03TpRYu83ovMGp60regZm hihqVhYRxJ2MijIkh7XxRmSuEZm4zzLvWweDJVQjUkYCBYxrkHh4SWgOZG1WWub4hkr+ K2QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UdU9+WdFvxqL89xXnef+JEuWU1j1nqd4VLn4Q2BQg3U=; b=CIwd+dk1Q+T6xUAZaAsvAfL77G1got/sjfKZd/9bAXD5+LN2B/TN1u3dr2BPBhWMh3 ilXeYcS7L/MhxgC5LjM80ty2XCa1fHnSIv1EFiy1ZnhPewhmKAy4D8xaezUHG5j3glJa yt5mv6SSnEYgfOmyamujcVHbSfvXZnf9oBuQ02bowGkRirlQm88Os3FBzDlLdf0ByLDp rgk6j1FCExz0GdqXunDElwcoEF/f7mvuFJQ6ANjv3zeub8PQCziNaRRdAES1jHLvzPMp JZRjNRsX1JZIQXffQfaVsd7wdFW3Bf+xhRGFWzcDNFCHlrxE6awDxc1wWCljDGphYUyv LLbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Q6C47hM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y26-20020aa79afa000000b006434add87dasi1793555pfp.161.2023.05.18.08.29.16; Thu, 18 May 2023 08:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Q6C47hM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231348AbjERPJV (ORCPT + 99 others); Thu, 18 May 2023 11:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjERPJU (ORCPT ); Thu, 18 May 2023 11:09:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ED39106 for ; Thu, 18 May 2023 08:09:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24CA464FBD for ; Thu, 18 May 2023 15:09:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8136BC433D2; Thu, 18 May 2023 15:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684422557; bh=K/icPAo+rTpBT6kDoqfe9ZZ+3w7CthvJJutgxZaRnu4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q6C47hM/hIWfl//J4vv69OMrNfzUIbVMKkAIXaMZ8AerXxuQikVVRPWYPQE5nBSJg EDQcEaDGamPxeNI5XRdESjG067MBx7of7xF1J4hyG3q+uy3PoTU7jPPuCwsAG5HH8q Zpsppx2xq8eBKuBD7YsQdI2B9ZUUh2FuVbJeRP92KWlSo7nrLtdevViyvQbZlMWxpE 7cLd/nFPa2Gp5/5FRPrjI6qrae/faaGfgoe2nEyYUzfhVl/D2MnqPcAM9nYDTL5UBG OJpwHAfPv5BXNEsX9CipLTFqPtcpSmlFjJE5NZSGKsBflZi60JhnvzXnWbZRCGONhv qH1DmEwbxwTPg== Date: Thu, 18 May 2023 17:09:11 +0200 From: Christian Brauner To: Mike Christie Cc: oleg@redhat.com, linux@leemhuis.info, nicolas.dichtel@6wind.com, axboe@kernel.dk, ebiederm@xmission.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, mst@redhat.com, sgarzare@redhat.com, jasowang@redhat.com, stefanha@redhat.com Subject: Re: [RFC PATCH 5/8] vhost: Add callback that stops new work and waits on running ones Message-ID: <20230518-tacker-ahnen-8eb944bed795@brauner> References: <20230518000920.191583-1-michael.christie@oracle.com> <20230518000920.191583-6-michael.christie@oracle.com> <20230518-lokomotive-aufziehen-dbc432136b76@brauner> <81e1a94d-531a-2e43-baee-da4b35644e87@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <81e1a94d-531a-2e43-baee-da4b35644e87@oracle.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 18, 2023 at 10:03:32AM -0500, Mike Christie wrote: > On 5/18/23 9:18 AM, Christian Brauner wrote: > >> @@ -352,12 +353,13 @@ static int vhost_worker(void *data) > >> if (!node) { > >> schedule(); > >> /* > >> - * 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 exit us. > >> + * When we get a SIGKILL we kick off a work to > >> + * run the driver's helper to stop new work and > >> + * handle completions. When they are done they will > >> + * call vhost_task_stop to tell us to exit. > >> */ > >> - vhost_task_get_signal(); > >> + if (vhost_task_get_signal()) > >> + schedule_work(&dev->destroy_worker); > >> } > > > > I'm pretty sure you still need to actually call exit here. Basically > > mirror what's done in io_worker_exit() minus the io specific bits. > > We do call do_exit(). Once destory_worker has flushed the device and > all outstanding IO has completed it call vhost_task_stop(). vhost_worker() > above then breaks out of the loop and returns and vhost_task_fn() does > do_exit(). Ah, that callchain wasn't obvious. Thanks.