{"id":2225196,"url":"http://patchwork.ozlabs.org/api/1.1/covers/2225196/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/cover/20260420152608.6244-1-djeffery@redhat.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.1/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260420152608.6244-1-djeffery@redhat.com>","date":"2026-04-20T15:26:03","name":"[v14,0/5] shut down devices asynchronously","submitter":{"id":24471,"url":"http://patchwork.ozlabs.org/api/1.1/people/24471/?format=json","name":"David Jeffery","email":"djeffery@redhat.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-pci/cover/20260420152608.6244-1-djeffery@redhat.com/mbox/","series":[{"id":500621,"url":"http://patchwork.ozlabs.org/api/1.1/series/500621/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500621","date":"2026-04-20T15:26:04","name":"shut down devices asynchronously","version":1,"mbox":"http://patchwork.ozlabs.org/series/500621/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2225196/comments/","headers":{"Return-Path":"\n <linux-pci+bounces-52784-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=KWpTIzkJ;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-pci+bounces-52784-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=\"KWpTIzkJ\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=170.10.133.124","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=redhat.com"],"Received":["from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzqK44PWwz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 01:34:00 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 53DD53033269\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 15:26:46 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5343C2D77E5;\n\tMon, 20 Apr 2026 15:26:40 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id DBCA42C11D9\n\tfor <linux-pci@vger.kernel.org>; Mon, 20 Apr 2026 15:26:38 +0000 (UTC)","from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-364-CVNq0MEWMuu2_Wzq3ktIgg-1; Mon,\n 20 Apr 2026 11:26:30 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id B2DA71800366;\n\tMon, 20 Apr 2026 15:26:23 +0000 (UTC)","from fedora-work.redhat.com (unknown [10.22.65.236])\n\tby mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id F090819560AB;\n\tMon, 20 Apr 2026 15:26:18 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776698800; cv=none;\n b=C6C/hEcCWKTjRFuNXj0LTyrjquZPsFgGaF4wOOvcDqd5FGpv01yfdY1wPhCuhEtVDV77V2IxNws9d7XQot8eMaySlH0Q2LVsWc5zgFRR0m9dmfqSOefBsgEAf/yR0HUdbTfVUGNKXOB6e47hTj1UagVvrhf+a1xDfkqVYJIg3u0=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776698800; c=relaxed/simple;\n\tbh=+Cq1sqvTOS+dn3I/AurHo27xH9tp+UMbnP/C6p5tTHk=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=B7dMQj2mUl4zG2i7fGGUQYnov7uwrPNOMqW63QzFuDlEyinTwdSya06VgI7zY+JT+Bvafa8U24FHKAXkR3y2kJHuuYIqFKAPXIkIEeOIzH9xH6YhWMjvm49RCngSRxW310/sD4yfzD9LqmEIXCCvBm/ifqYYwbWaOaYimEOrQIM=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com;\n spf=pass smtp.mailfrom=redhat.com;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=KWpTIzkJ; arc=none smtp.client-ip=170.10.133.124","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1776698798;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding;\n\tbh=alBhCJlwXd25yWVNysS6+j2LQThJIl7ZSL5DLQ6duKo=;\n\tb=KWpTIzkJ6VTJUvFGcEiYFJPzE9nAKz5SDxTpBuFe/COZ5W5602yLmHe04qvjKckU8hD2vh\n\tx7hs1ZJVV9+qFYYxEwxdd0tRBmU+92dC6cn0M8pYEjIjkXvsaYwX9ddit3U3kHoGOgFfxu\n\t1SjI9+64iFLRym5WKH1hyIfhVrDLufE=","X-MC-Unique":"CVNq0MEWMuu2_Wzq3ktIgg-1","X-Mimecast-MFC-AGG-ID":"CVNq0MEWMuu2_Wzq3ktIgg_1776698784","From":"David Jeffery <djeffery@redhat.com>","To":"linux-kernel@vger.kernel.org,\n\tdriver-core@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tlinux-scsi@vger.kernel.org,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\t\"Rafael J. Wysocki\" <rafael@kernel.org>,\n\tDanilo Krummrich <dakr@kernel.org>","Cc":"Tarun Sahu <tarunsahu@google.com>, Pasha Tatashin <tatashin@google.com>,\n\t=?utf-8?b?TWljaGHFgiBDxYJhcGnFhHNraQ==?= <mclapinski@google.com>,\n Jordan Richards <jordanrichards@google.com>, Ewan Milne <emilne@redhat.com>,\n John Meneghini <jmeneghi@redhat.com>, \"Lombardi,\n Maurizio\" <mlombard@redhat.com>, Stuart Hayes <stuart.w.hayes@gmail.com>,\n Laurence Oberman <loberman@redhat.com>, Bart Van Assche <bvanassche@acm.org>,\n Bjorn Helgaas <helgaas@kernel.org>,\n \"Martin K . Petersen\" <martin.petersen@oracle.com>,\n John Garry <john.g.garry@oracle.com>, David Jeffery <djeffery@redhat.com>","Subject":"[PATCH v14 0/5] shut down devices asynchronously","Date":"Mon, 20 Apr 2026 11:26:03 -0400","Message-ID":"<20260420152608.6244-1-djeffery@redhat.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12"},"content":"This patchset allows the kernel to shutdown devices asynchronously and\nunrelated async devices to be shut down in parallel to each other.\n\nOnly devices which explicitly enable it are shut down asynchronously. The\ndefault is for a device to be shut down from the synchronous shutdown loop.\n\nThis can dramatically reduce system shutdown/reboot time on systems that\nhave multiple devices that take many seconds to shut down (like certain\nNVMe drives). On one system tested, the shutdown time went from 11 minutes\nwithout this patch to 55 seconds with the patch. And on another system from\n80 seconds to 11.\n\nChanges from V13:\n\nRemove duplicate flagging of async shutdown on scsi hosts/targets/devices\n\nChanges from V12:\n\nOnly acquire a parent reference if acquiring the parent's lock\ndevice_enable_async_shutdown should return void\nMinor comment and description cleanups\n\nChanges from V11:\n\n  * Swap the order of the first two patches\n  * Rework conditional parent locking so that lock and unlock no longer use\n    separate conditional checks\n  * Remove an used variable\n  * Comment and description text cleanups\n\nChanges from V10:\n\nReworked to more closely match the design used for async suspend\n  * No longer uses async subsystem cookies for synchronization\n  * Minimized changes to struct device\n  * Enable async shutdown for pci and scsi devices which support async suspend\n\nChanges from V9:\n\nAddress resource and timing issues when spawning a unique async thread\nfor every device during shutdown:\n  * Make the asynchronous threads able to shut down multiple devices,\n    instead of spawning a unique thread for every device.\n  * Modify core kernel async code with a custom wake function so it\n    doesn't wake up a thread waiting to synchronize on a cookie until\n    the cookie has reached the desired value, instead of waking up\n    every waiting thread to check the cookie every time an async thread\n    ends.\n\nChanges from V8:\n\nDeal with shutdown hangs resulting when a parent/supplier device is\n  later in the devices_kset list than its children/consumers:\n  * Ignore sync_state_only devlinks for shutdown dependencies\n  * Ignore shutdown_after for devices that don't want async shutdown\n  * Add a sanity check to revert to sync shutdown for any device that\n    would otherwise wait for a child/consumer shutdown that hasn't\n    already been scheduled\n\nChanges from V7:\n\nDo not expose driver async_shutdown_enable in sysfs.\nWrapped a long line.\n\nChanges from V6:\n\nRemoved a sysfs attribute that allowed the async device shutdown to be\n\"on\" (with driver opt-out), \"safe\" (driver opt-in), or \"off\"... what was\npreviously \"safe\" is now the only behavior, so drivers now only need to\nhave the option to enable or disable async shutdown.\n\nChanges from V5:\n\nSeparated into multiple patches to make review easier.\nReworked some code to make it more readable\nMade devices wait for consumers to shut down, not just children\n  (suggested by David Jeffery)\n\nChanges from V4:\n\nChange code to use cookies for synchronization rather than async domains\nAllow async shutdown to be disabled via sysfs, and allow driver opt-in or\n  opt-out of async shutdown (when not disabled), with ability to control\n  driver opt-in/opt-out via sysfs\n  \nChanges from V3:\n\nBug fix (used \"parent\" not \"dev->parent\" in device_shutdown)\n \nChanges from V2:\n \nRemoved recursive functions to schedule children to be shutdown before\n  parents, since existing device_shutdown loop will already do this\n \nChanges from V1:\n\nRewritten using kernel async code (suggested by Lukas Wunner)\n\n\nStuart Hayes (2):\n  driver core: separate function to shutdown one device\n  driver core: do not always lock parent in shutdown\n\nDavid Jeffery (3):\n  driver core: async device shutdown infrastructure\n  PCI: Enable async shutdown support\n  scsi: Enable async shutdown support\n\n drivers/base/base.h       |   2 +\n drivers/base/core.c       | 180 ++++++++++++++++++++++++++++++--------\n drivers/pci/probe.c       |   2 +\n drivers/scsi/hosts.c      |   2 +\n drivers/scsi/scsi_sysfs.c |   3 +\n include/linux/device.h    |  13 +++\n 6 files changed, 166 insertions(+), 36 deletions(-)"}