Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp708422lqp; Wed, 12 Jun 2024 13:56:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkWYdBBRzodxmT3mg8d/t+hTrmhoAhUBRJI0sGksFYN31M6eWVlA+X+ZqHUX3KVFtij/oM8C1dDA/bUeFxd5eV4ljWNSR30p2AfnmXLw== X-Google-Smtp-Source: AGHT+IFueCXf6vNx73p0N4fyS1SPCiwYg5I1NRHUmIbaweb5aLtZE+3AU3urGgCbczoaB+gRpMx8 X-Received: by 2002:a17:902:e74e:b0:1f7:1d78:db3b with SMTP id d9443c01a7336-1f83b6090e1mr32044525ad.38.1718225806293; Wed, 12 Jun 2024 13:56:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718225806; cv=pass; d=google.com; s=arc-20160816; b=EminHy03WT+o1HvmBEa+L7e5nZBTrwgDtu0tKS+rF0qb8dpqvg+90jWqe1nvA+Z2GL FnblIT48Ed2G5DJeq5mJPfaENqj6sSZurZ+G+BQB6Gp2d3boobZ12PqmIj1EUS0sm15e Ykyj1zfYNNBZ2IvsC8Q9s+Ld2NyDasVv4hBaAuakJPjacChc8GzvLnW7BHrtvSvTDNDC mnCD7s1WUnQlPLT5vjJj/cJwQrrdniXBOvhLX4sJBIa5u8+lhPJKSIfkHre2OVj+doAj Zxt6bAun59o8JoInHbSUs0tNBJGNmBrHsiHdn/WJwlF5BTPTjA5r6VPCa1wBfwkW5Fxf 6bFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7hVwnRMoSBMJPWcJy7RzH5XrD2/fHAC4H1l7q6/ESG8=; fh=gns7shvyVFsyZadmFalOuFnbSnoD0tZSc/JQQibUg4g=; b=tgd+S2mHNYhNKDVbSKvGmLbSeOVWd8Uxf3IivKpfcpmti/wLY/gUgD2XUhCXeSCn+q ni5qfKKnwyTLrDwN52uHYYD4aCxsLlJm0GXEoEQev4qllA7UgcuAhMBkbS0WwmBOQhIv qhjC+Wy5u6J6jqhcaoGyx9S+eUZaa1U1Q/u+ZeyRbWfBDva0EQRCV5sQe5WTfSpe1QRc KGDl7owpc7RqbQSHq0nmlwk+gwijZr+1gdgOcOo0dk2hPdIj8oAEEA1Qnp46xju2yTx8 9URbcaIJaHa0IIt7zFdfXrbi99cc4KL5e21qTeprghVkjte/DURYt6IQNd1t3aFcM6nI LfqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cxj/s95x"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-212246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7f3103si116739355ad.454.2024.06.12.13.56.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 13:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cxj/s95x"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-212246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D5AB3B23766 for ; Wed, 12 Jun 2024 20:56:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 680C385656; Wed, 12 Jun 2024 20:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cxj/s95x" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CB1085298 for ; Wed, 12 Jun 2024 20:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718225715; cv=none; b=O73WnjjrYzzlmUHwBfgzjEwHhGDiIJq4pTesmlXnXRLDeXnGNK/8eMwSnKuEjdfZ0ZK8kJh45rj/lX8hlUqtG9hGMbxeJ1jNGBpgECrRmjpHbuuXiwhidS1T/S8aMExA7qJP3NFLpvG7pmizjUnDJ5aAN5kTYgk0s6HjsomXZdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718225715; c=relaxed/simple; bh=vtyWHnXG1p3yyQvY7vBy4X4sTbiCW7OZDwJn2nOC4hM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q5K/3eJeHEKKd6TM5xOq+oI6IkZo8g9xjjWYz5WUjeVfIfB8Wzyn0ytbDh9wso3JDwBpC5XCpyhp2te5sHLMcmSE3FGrS3W3lQ5sylxYz+6VCrKylYNCMv17IFHqkNQW1G/hC72jlDcIGHsnH+/0GiSKJaB5tONUhBQI79Ryi30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cxj/s95x; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C4AAC116B1; Wed, 12 Jun 2024 20:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718225715; bh=vtyWHnXG1p3yyQvY7vBy4X4sTbiCW7OZDwJn2nOC4hM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cxj/s95xv3glfSecT6BZP98WWPduof/lIMq4LzAnx+gsENNyq1OZE+bzjQcSRImUe GZEJrLRd3hMmXRYAfhlqPMOM7E9pz4sfHIElIZno7wqUKgQllosOVxlXeGkl2xjADS hOWG30s4dUfq7IqiSBaPPOCd4R6QOd3r3ruc5iirQUS//afFkppnDWdJ4lXiq5phDJ PHxH4/No+mxfybSPxNPv42tGz0eiWXlfTyR67RJBsQ8uYmUlRQGEmisXI8Z6yvNFeP SadQ9IOm8jdyYEFIifm+VFBK6bcm6DYWCtWTZGEBPJFSzhG7jMFmeMOWmvT8Gi9W+g vBU93sGE5l3sQ== Date: Wed, 12 Jun 2024 14:55:11 -0600 From: Keith Busch To: Stuart Hayes Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J . Wysocki" , Tanjore Suresh , Martin Belanger , Oliver O'Halloran , Daniel Wagner , Lukas Wunner , David Jeffery , Jeremy Allison , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org Subject: Re: [PATCH v6 3/4] driver core: shut down devices asynchronously Message-ID: References: <20240516154920.221445-1-stuart.w.hayes@gmail.com> <20240516154920.221445-4-stuart.w.hayes@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240516154920.221445-4-stuart.w.hayes@gmail.com> On Thu, May 16, 2024 at 10:49:19AM -0500, Stuart Hayes wrote: > Add code to shut down devices asynchronously, while ensuring that each > device is shut down before its parents & suppliers, and allowing devices > that share a driver to be shutdown one at a time if necessary. > > Add /sys/kernel/async_shutdown to allow user control of this feature: > > safe: shut down all devices synchronously, unless driver prefers async > shutdown (driver opt-in) (default) > on: shut down all devices asynchronously, unless disabled by the driver > (driver opt-out) > off: shut down all devices synchronously > > Add async_shutdown to struct device_driver, and expose it via sysfs. > This will be used to view or change driver opt-in/opt-out of asynchronous > shutdown, if it is globally enabled. > > async: driver opt-in to async device shutdown (devices will be shut down > asynchronously if async_shutdown is "on" or "safe") > sync: driver opt-out of async device shutdown (devices will always be > shut down synchronously) > default: devices will be shutdown asynchronously if async_shutdown is "on" > > This can dramatically reduce system shutdown/reboot time on systems that > have multiple devices that take many seconds to shut down (like certain > NVMe drives). On one system tested, the shutdown time went from 11 minutes > without this patch to 55 seconds with the patch. I've successfully tested this out on a few systems, and noticing a very decent shutdown time on my nvme systems. I also like the current solution here, as the two-pass method was harder to follow. So I think just remove the extra options that Christoph mentioned and always use the driver's preferred shutdown method, then this would all look good to me.