Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp501553rdh; Wed, 7 Feb 2024 10:47:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUwa7U4Jm1nWikGSVHL+rQgJd8GMuvLUS+tMgmUCZ3ncxrF88dWlzPv2UhfCWaDFSK/0KdcIdmawZRdayvs2ty0bvwx3Fb+hfU3DA8MaQ== X-Google-Smtp-Source: AGHT+IHWMcNveHIK340yKC3aCohnlZQbylKrde7B5+xQwaPfQT+ueyrxoryhT7HHQtFaDeoLy2eo X-Received: by 2002:a17:903:110f:b0:1d9:626b:ae3d with SMTP id n15-20020a170903110f00b001d9626bae3dmr7383217plh.18.1707331625599; Wed, 07 Feb 2024 10:47:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707331625; cv=pass; d=google.com; s=arc-20160816; b=QaBV0NSwSeodcTSbUyUbUhcsND1t/guK5h7Q5AkFNxWMtBsnjAxRaKNSVO0FTsN2cp MtPBc49I76oYGHrOSKmZ3JUot6W1RjwnVLdSIH8V1iDNQR2FwIlaao5wDmo55AxnaUAv lREqmfQrX0/12DRt9y/1KIbXc6JIQSTwwV/sL+PIk2Zb8euhtEYdN92oN9qDwurwf5vk Ub4H+PlMaYXld4m6kazX5hrThP7rdSKE48yh+N0N9uaZrZpRzU5raf+3hM9RKrZBeIS4 dT+c3UzofkU0BVYP4OTob+2uDDlP/bfcPaZQX7rMt1jr8y2hJSqZ1qBH1Z/XtIPhtDHX J+wA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=uzhXO96uioYuw+s+CgtOuyqJZRewhrPzSOw58rzbztg=; fh=q57SbuwxREeVyTas2y1CYpIEnnfnL1YWdeqq/LzPABM=; b=bykHbsK24GVg0JFHyG8lLgS9sTUFD+rhDyR6VIJaZc4IG71bftUOBZ39WR08phzORH 0W53uQj9YezRf1+hUSZbWbIsLpwyl4hqiJCOcL2xEJFZRHA7zvzTOZCru6eWuNmoDy5m eA2FG9dZACKoTl2nVDFz+Iod6qH58se5QV5MZ1vWCAndTJySIwvw05cbINoZ1hWI6gwb KiT3DW0Kfr36a5hhcYKwQAMo3MCEJr+Nvi1ImFg8QJEVNRzfU1y8e2UqHwHmW+taTeSC QLoaqa5T/GX7ApIxxvzmy9jCqQjvuQc5rhJ6fyybFW9bHEY3ZcAOHR0JaJKP2QlrKjW9 56eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SgoxrTrh; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-56916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCXu/X4Tlp1zKuB3Hs4KNB2x529fRh+nPOVFKTSHYwMztxyECkr5ECoHqDsuRZ1w6fCcA/7HucXUHy6Z+nWvmlVAWVxD3StPNL3bviMvyA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q17-20020a170902e31100b001d9773a1990si2089259plc.400.2024.02.07.10.47.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 10:47:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56916-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=@redhat.com header.s=mimecast20190719 header.b=SgoxrTrh; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-56916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 DB1AFB265CF for ; Wed, 7 Feb 2024 18:42:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E2DF84A21; Wed, 7 Feb 2024 18:42:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SgoxrTrh" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 0052E83CBE for ; Wed, 7 Feb 2024 18:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707331339; cv=none; b=jQ2pWbO91+9P0/Sw+ah6MWQoqRdP7B5Me0MA1d7H/cdsAZDkSVgDnXlaPQXPiHWLT53EEY7qUM0bwBL4CQb0pGQvQOX8gWDBJm0NE/er0Tg2Od7yq/9kMjukh/PYvBDUQ55tunOP3UYTP0nCBT+wZxr5TdQ2qDHprX0AzzKD/OY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707331339; c=relaxed/simple; bh=nYX20/aGyNT7+m3RqCINirH/BlFMdF3vqKDQqvuouqs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Am/TX4NbA3Lt/HUw6iIK23qaQcJwZ40E0FY5A45AKud1tzagIOS45qxmIeWiEK2g35aiJ3/kxjiKbvdSGFQ7W33S+WPl7tRZC8hiM7vtnw1Ow9KYa0/F59XTgl1QsYsHgx2Xt9QvSXl0hjDLzijqBmbNbdP/6UpsX7yHhoTmnhk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SgoxrTrh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707331337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=uzhXO96uioYuw+s+CgtOuyqJZRewhrPzSOw58rzbztg=; b=SgoxrTrhH4mVf1sXPVbcgeq5ckkRSnWexcRSFMO63+YENjH9R3paOwrLrV8J9xhta+9FoG RabOpbb/htf0lxbd+r0URkl/L8hM59dN8CgK3mosJhvsn2jUrtyG6VVg0eFhExrHcAM+la Z9rv5tbMYv4F66NjVbimMHxPsO8NyKI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-84-SOx90uyXOvy1n8fT4n9uqA-1; Wed, 07 Feb 2024 13:42:13 -0500 X-MC-Unique: SOx90uyXOvy1n8fT4n9uqA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3689A38212CF; Wed, 7 Feb 2024 18:42:13 +0000 (UTC) Received: from fedora-work.redhat.com (unknown [10.22.32.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADEB340C9444; Wed, 7 Feb 2024 18:42:12 +0000 (UTC) From: David Jeffery To: linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, Greg Kroah-Hartman , "Rafael J . Wysocki" , David Jeffery Subject: [RFC PATCH 0/6] async device shutdown support Date: Wed, 7 Feb 2024 13:40:54 -0500 Message-ID: <20240207184100.18066-1-djeffery@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 This is another attempt to implement an acceptable implementation of async device shutdown, inspired by a previous attempt by Tanjore Suresh. For systems with many disks, async shutdown can greatly reduce shutdown times from having slow operations run in parallel. The older patches were rejected, with this new implementation attempting to fix my understanding of the flaws in the older patches. Using similar interfaces and building off the ideas of the older patches, this patchset creates an async shutdown implementation which follows the basic ordering of the shutdown list, ensuring the shutdown of any children devices complete whether synchronous or asynchronous before performing shutdown on a parent device. In addition to an implementation for asynchronous pci nvme shutdown, this patchset also adds support for async shutdown of sd devices for cache flush. As an example of the effects of the patch, one system with a large amount of disks went from over 30 seconds to shut down to less than 5. The specific driver changes are the roughest part of this patchset. But the acceptability of the core async functionality is critical. Any feedback on flaws or improvements is appreciated. David Jeffery (6): minimal async shutdown infrastructure Improve ability to perform async shutdown in parallel pci bus async shutdown support pci nvme async shutdown support scsi mid layer support for async command submit sd: async cache flush on shutdown drivers/base/base.h | 1 + drivers/base/core.c | 149 +++++++++++++++++++++++++++++++++- drivers/nvme/host/core.c | 26 ++++-- drivers/nvme/host/nvme.h | 2 + drivers/nvme/host/pci.c | 53 +++++++++++- drivers/pci/pci-driver.c | 24 +++++- drivers/scsi/scsi_lib.c | 138 ++++++++++++++++++++++++------- drivers/scsi/sd.c | 66 +++++++++++++-- drivers/scsi/sd.h | 2 + include/linux/device/bus.h | 8 +- include/linux/device/driver.h | 7 ++ include/linux/pci.h | 4 + include/scsi/scsi_device.h | 8 ++ 13 files changed, 439 insertions(+), 49 deletions(-) -- 2.43.0