Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp712320lqp; Wed, 12 Jun 2024 14:04:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXykRcCFRMrtcHGCM50MK0I71EngH3BDI4Jzs7tvinIA6XbeiDtszXvWX5qUk7d/1w0BfsuWosnJzrkbysKYv0y7frbJIxXkaQfi55t2w== X-Google-Smtp-Source: AGHT+IGN1jUeIZkhymsCHLMmQRFD3hAow/bsiLoRBpY+40Uv/jAEmMiFfaI/GwYf9UJTox30G0fN X-Received: by 2002:a17:903:41cd:b0:1f4:8bb9:924f with SMTP id d9443c01a7336-1f84dfbf245mr11947095ad.1.1718226242223; Wed, 12 Jun 2024 14:04:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718226242; cv=pass; d=google.com; s=arc-20160816; b=xLOpZhAX7EivOQLWG6Hh6tZOrhw83ARHtUIpmZ/7aCFYokVKkZ3x/r/DpX1/jEkx/A /7e5wkQKdrWlKy7lJpbMtvEaS+DuKl5xoO9AH88V/Hj8ZwgdtCwza6hdFBABuHMlp7oK fsVt+mDohWlEt4nOArRKWxYs7/8cFd3T3ish7MYWJVfiK6QptemqpsAUxR/M63FrGo+C nMAxQ9gvA+x2gEHg2Bw8xvuS4taI7BG2rlKTweb1CLRhMKW9FUId6ePJ+R2kLYvQGzhP 7CbOHctpEEph+HgfkxUIcxpqn7qES6OD5FitM12hyxept4wpZfrkbSzrdNBj5qErth02 FWfg== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=yCmrzEiID1d7fBr18T8wzcPvEeuHgKP/DqXaO8p4zIk=; fh=XTke9bXs1KKTtZdmdZQTxbn1HO0l+W6MLtriog7XjyI=; b=OyeSIr7upPbv+Ngr4d67GtdMmhuaDe0kjNT2dCRjzY+8O8NqvM6pQAFQVlqXXCESTo Kwp5TSfcPFlyUxASqSVDTqYXpOiLz1htrjOe1Cq4i3FvvGHOskJXgFggwq543frGTcPq ZdiANU7u7hhnw+d3H5y0RRuqcIBKpZXXA+GVQm4dto46F+cLRp5WuPmgowCAp6ZMdUaK tXSkPfF+ib17KlGNlcRX1zSB4l3LGt2J9Gq2Iyw6GJy2hTbZxbvG/YA4e8V0zmp7VB+V 0eerIZLASjI31vDczzgDIhqs/2vuqGBXQhoupJo08W4W9Cy/o32lk/H9h6ReKnypnrp3 5z9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samba.org header.s=42 header.b=coeMWT35; arc=pass (i=1 spf=pass spfdomain=samba.org dkim=pass dkdomain=samba.org dmarc=pass fromdomain=samba.org); spf=pass (google.com: domain of linux-kernel+bounces-212256-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=samba.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f718f48390si58772615ad.270.2024.06.12.14.04.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 14:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212256-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@samba.org header.s=42 header.b=coeMWT35; arc=pass (i=1 spf=pass spfdomain=samba.org dkim=pass dkdomain=samba.org dmarc=pass fromdomain=samba.org); spf=pass (google.com: domain of linux-kernel+bounces-212256-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=samba.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C7FD12855DC for ; Wed, 12 Jun 2024 21:03:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A104B12C477; Wed, 12 Jun 2024 21:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (3072-bit key) header.d=samba.org header.i=@samba.org header.b="coeMWT35" Received: from hr2.samba.org (hr2.samba.org [144.76.82.148]) (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 355244315D for ; Wed, 12 Jun 2024 21:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=144.76.82.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718226169; cv=none; b=X4HxX4MPdVpDr/tdpe+gxwcubl8OvQYC5ldlqpa3L3DQfMkj1NUJRn59y82NP1tCYV+QdHpqIlIgnQJjxB78/aiJcpX9VWkJqbZIVl8VxRehB1OVSTq5IITbmLg52rpWYxXR7AE3Bmd39pHz0uMHN46MujBQIdHEVno8wVJeg7E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718226169; c=relaxed/simple; bh=ZGi6j70z+U+okCcP86mNO61UTOQpTQZu7f8h0MPMOXU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z6JqcrCOWocnu0xBsnplLiAhxlPgiMk+UwCu+dhmC3nT2UIO+4s1xGmEYKItDVn8haWHOtEsATGB/QCril9d4db8PZwm0IrSDqgluun060pcwTArNPiLU5IP2ns6xbvXYiLU4gLbu27MG15/9l7WPLOBJL/q5hQVhaxnxL/trRk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=samba.org; spf=pass smtp.mailfrom=samba.org; dkim=pass (3072-bit key) header.d=samba.org header.i=@samba.org header.b=coeMWT35; arc=none smtp.client-ip=144.76.82.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=samba.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samba.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-ID:Cc:To:From:Date; bh=yCmrzEiID1d7fBr18T8wzcPvEeuHgKP/DqXaO8p4zIk=; b=coeMWT35Qu08XTWOoQwC2CiT11 1HeWCiXRYDFbGznhbzKp65msZI05WtPgkv9vd+4NyBaTLkx47jw+GhKSTKvHQWcozbWC8Dan0X+GK sqn0oK5QHVgZGT/qf7YMl7N4YWnSDs/1IBTL+ANYV0yncGbaf1e/8KYPlCckYctX5wM4Zmh9yuksK q4U1pqDGkB9/EWWpz1DzLAYNmV4wNVRdGXPSRPlr+7nHT4osgVZQ0i0CSQFoyTMfr2MGx4kRE3IRq rTP+1lBSdNozBziO203EdDG2yLEmXARsuoWvHxazcddNvPJX0hkc9lJwnMbOGWBRuHg6S5oyU0SNW h38fH1pGm4SiCK45Tnvjw1OQ8OaSkuvDm+kClklcyHla8csgCcYdBGv3nBMDkDFZfwQb0B2ng8qT2 9pNlhxSvJstgtV8bs2IHR086esQgOGPiYcgqYJOv4bRj2bOf4t0NT7LlEuPIi8JgsHvUIJnm4eAFX /f8D4F9oYOZMiI55lI8bB3Mj; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__ECDSA_SECP256R1_SHA256__CHACHA20_POLY1305:256) (Exim) id 1sHV75-00GPm2-2u; Wed, 12 Jun 2024 21:02:36 +0000 Date: Wed, 12 Jun 2024 14:02:31 -0700 From: Jeremy Allison To: Keith Busch Cc: Stuart Hayes , 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: Reply-To: Jeremy Allison 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; format=flowed Content-Disposition: inline In-Reply-To: On Wed, Jun 12, 2024 at 02:55:11PM -0600, Keith Busch wrote: >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. Yes, I have tested this patch on my systems and am greatly in favour of this instead of the two-pass version I was trying to make work. It is easy to understand and fixes the problem for my NVME issue. Jeremy.