From mboxrd@z Thu Jan 1 00:00:00 1970 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 C8432369992; Fri, 6 Mar 2026 04:08:44 +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=1772770124; cv=none; b=sisoCdxOtCL1ifnyGVFWmExGmevZ/y35B2x1Lq8l8odr1dCNul2ZQZP8NcyYz1xtXidVfQldDFyp+2gYx6gP/fTvSU0aQOrLx/i0WIj+5INJHwrnDx6UOPhWZ/+ACdluwG6f5Sq5iFf54Yq81W2CTeNxmyq0I8obL1G52i0wBKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772770124; c=relaxed/simple; bh=2PV8N8MDNTOIV9r2E8N///4zaacKBlEGosc7fKjx3Ks=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=s9johSnYA8dEtGmYUeApgoeeQp9dGus9/kuk9DA0q4PRp5jLFK0quefh84qtH7l7WPOCW3r2pCkm8l6X5IxnuV+7fqeM/+Ew5nfU434TrU6olMXfJMDOO8QCwx7nndGo+9IMbz2grgpqv1ZAVPGDvoAF4nSAUCIXgJ1u8RqHivk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tmxtOwOh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tmxtOwOh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27164C4CEF7; Fri, 6 Mar 2026 04:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772770124; bh=2PV8N8MDNTOIV9r2E8N///4zaacKBlEGosc7fKjx3Ks=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tmxtOwOhkKzMEj+l4kjbSGSuOg7q9bHOnXBu+LsMBBRZo8TYzqttB3ZNEaxUX6m28 igTKTyxj3cQRvmuvLaRvYHJw+nt5jnTp7wXY0m0QnUm8yu091nD34pKpvnSAIgAccP uGSdwoFTKF/uACYkjMzjVw6CB1kQiTp6zQpGjdX/pX/SAiO6clV+uztpVXo+ZntuvP agHB0e4n7vRHhepIRQFJ6LpOgMB2Be8yKcppfPk6Jvp/CpYr9ZeC46kfu4CB73QFsA XOow38xou8xbkFJRc/SM44AAtfsLR94yXX8ZlwSrgYBRZWXksYlLpcZSRrXYMwN8DN J+X+j28Gsr7mQ== Date: Thu, 5 Mar 2026 18:08:43 -1000 From: Tejun Heo To: Krzysztof Kozlowski Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Jonathan Corbet , Shuah Khan , Lai Jiangshan , Tobias Schrammm , Sebastian Reichel , Andy Shevchenko , Dan Carpenter , Krzysztof Kozlowski , Lee Jones , Dzmitry Sankouski , Matthias Brugger , AngeloGioacchino Del Regno , Benson Leung , Tzung-Bi Shih , Matti Vaittinen , driver-core@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, chrome-platform@lists.linux.dev Subject: Re: [PATCH v2 01/10] workqueue: devres: Add device-managed allocate workqueue Message-ID: References: <20260305-workqueue-devm-v2-0-66a38741c652@oss.qualcomm.com> <20260305-workqueue-devm-v2-1-66a38741c652@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-doc@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: <20260305-workqueue-devm-v2-1-66a38741c652@oss.qualcomm.com> On Thu, Mar 05, 2026 at 10:45:40PM +0100, Krzysztof Kozlowski wrote: > Add a Resource-managed version of alloc_workqueue() to fix common > problem of drivers mixing devm() calls with destroy_workqueue. Such > naive and discouraged driver approach leads to difficult to debug bugs > when the driver: > > 1. Allocates workqueue in standard way and destroys it in driver > remove() callback, > 2. Sets work struct with devm_work_autocancel(), > 3. Registers interrupt handler with devm_request_threaded_irq(). > > Which leads to following unbind/removal path: > > 1. destroy_workqueue() via driver remove(), > Any interrupt coming now would still execute the interrupt handler, > which queues work on destroyed workqueue. > 2. devm_irq_release(), > 3. devm_work_drop() -> cancel_work_sync() on destroyed workqueue. > > devm_alloc_workqueue() has two benefits: > 1. Solves above problem of mix-and-match devres and non-devres code in > driver, > 2. Simplify any sane drivers which were correctly using > alloc_workqueue() + devm_add_action_or_reset(). > > Signed-off-by: Krzysztof Kozlowski Acked-by: Tejun Heo Please let me know how you wanna route the patch. Thanks. -- tejun