Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1802244rdb; Thu, 17 Aug 2023 02:26:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPo3Bx/6F0vjd/CBeBJc1BIuMpk8fydFAYhTzi19QN4+d1Hi61QdXCOPh7WA31wZKLFZS5 X-Received: by 2002:aca:1015:0:b0:3a7:36f9:51aa with SMTP id 21-20020aca1015000000b003a736f951aamr4408551oiq.17.1692264413821; Thu, 17 Aug 2023 02:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692264413; cv=none; d=google.com; s=arc-20160816; b=e0cvgMoH04nfyrkjAslwucBuELBgEu97XTue3YMeAh7JJCAaqu+QVBYuOKq1lygH9J Vnl4VC9M7zSD/7NVNUYG5a1TjpSlUBJ3NnKK43DaFm4vLmDKh9kP3TjORIod69D5L70U d6GGrETuLRlwvc5kaidcUgL6B/qNnM6Y3OT0beB7y4jXsMhJqv9JfnYedCoE7C5rgqEU swLTWTyQcKdMvYgv+sLbihxyI2nXCxX2LN9mRz6HVQ1DYoopdDc7XlG4lUAoY8wK90xo N031xXIGEu5aDvCuDSVLf1IVnIvxQRVVkFvg5wxfQlfhxR1ioZaFlw3Idb+Ndx3jdAqy 9Paw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=5P4ybMI9P1NSa77b6FhaXsJ+swD6TOKyDST1+QDN81A=; fh=8OoIzgPzM9Wb9+MfxNid7JK/lE5q8F5HzUlrv6vtf1s=; b=DWYtpIcp3+R8Dp2/DjYDHAP6FbmFOxMDe7TXtDZQ8eYaMXYpe5mFPRuUYWtdZut1OT PZhukix3E7sjS8S0qOsPFGUInMGzXNCvdhd6xQermaRVclB2qMiqAm/OSKR7TRlFD3XB MShkdi5kmh4QwcWwaAhAh87DUc21YajKnym4Lfnmir4pj8zwPb58sBs9L+NjgzW5kKnQ QRZ0ewfRvyVQSCxHLSHxvzCujgONfrbHrvnIdbF5GEu0RQJH2CNs+P05v8OT/8sJTLRj IsaByA41hJM3q8hSpR7OUhmstP5E49lBet+XXrOYwVl0KkmRswwGbZQFwHLLj5PJSYl0 8lPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a17090a348600b002636d222400si1181879pjb.14.2023.08.17.02.26.40; Thu, 17 Aug 2023 02:26:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343880AbjHPPzU (ORCPT + 99 others); Wed, 16 Aug 2023 11:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234219AbjHPPyl (ORCPT ); Wed, 16 Aug 2023 11:54:41 -0400 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB220DF for ; Wed, 16 Aug 2023 08:54:38 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id B5943100D943F; Wed, 16 Aug 2023 17:54:35 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 8B34D5D2FF; Wed, 16 Aug 2023 17:54:35 +0200 (CEST) Date: Wed, 16 Aug 2023 17:54:35 +0200 From: Lukas Wunner To: Stuart Hayes Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J . Wysocki" , Tanjore Suresh , Martin Belanger , Oliver O'Halloran , Daniel Wagner , Keith Busch Subject: Re: [PATCH] driver core: shut down devices asynchronously Message-ID: <20230816155435.GA18922@wunner.de> References: <20230816154518.3487-1-stuart.w.hayes@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230816154518.3487-1-stuart.w.hayes@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE autolearn=no 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 Wed, Aug 16, 2023 at 10:45:18AM -0500, Stuart Hayes wrote: > Attempt to shut down devices asynchronously, by making a tree of devices with > associated work and completion structs, to ensure that child devices are shut > down before parents. > > This can dramatically reduce system shutdown/reboot time on systems that have > devices that take many seconds to shut down, such as some NVMe drives. On once > system tested, the shutdown time went from 11 minutes before the patch to 55 > seconds with the patch. > > The code could be simplified by adding the work and completion structs to > struct device, but it may make more sense to not burden it with that when there > is likely enough memory to allocate this at shutdown time, and if there isn???t, > it just falls back to the current synchronous shutdown. Please wrap the commit message at 72 chars. Is there a particular reason why you're not using the infrastructure provided by kernel/async.c and , such as async_schedule()? It wraps all the work_struct plumbing and also has helpers to await completion. I imagine using that might reduce LoC in this patch. Thanks, Lukas