From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45773C5B543 for ; Wed, 4 Jun 2025 16:53:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A021110E035; Wed, 4 Jun 2025 16:53:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="WXT6NWtA"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB85710E788 for ; Wed, 4 Jun 2025 16:53:49 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id D1BA94A06A; Wed, 4 Jun 2025 16:53:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8F77C4CEE4; Wed, 4 Jun 2025 16:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749056028; bh=hhaoHECGZqzEpU9MTiy2t7cqLq5LWg93CmxEmAbN2pM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WXT6NWtAmVdO6YCKYmBq1oxfVRkO/uSH6SnVzBZ9qhEGoHV3lrl4Jx8S+qcptwIK+ Jur1H7p5sTLycJzMoZkbRM6r91ygI3u/LdNCS+r7jOOZFKrVF2iX8OADTmL7YRXbqI RBYvJtHKr2U7FrsWXRo7ajPyntQ0ic276AXO2okaHqaufPnVMpuVNuT90qqJyH14eF uWxGA259OB44qflNK5oQnKvnd1AR2vnoGaXmK4FAQEgAMbC/KupBpbMCGzNl2qQVfc dn0OII6WNP5UCHsQJU2kTp/IOQCG0R52C8VCfGA4d+JvOSKm7gBnogf8CfuUwqhARt 5j4NlWpwaoqFg== Date: Wed, 4 Jun 2025 18:53:44 +0200 From: Danilo Krummrich To: Matthew Brost Cc: Simona Vetter , Christian =?iso-8859-1?Q?K=F6nig?= , Philipp Stanner , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/sched: Discourage usage of separate workqueues Message-ID: References: <20250604081657.124453-2-phasta@kernel.org> <7a09c357-2d28-4dd6-b637-4387cc430938@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Jun 04, 2025 at 09:45:00AM -0700, Matthew Brost wrote: > On Wed, Jun 04, 2025 at 05:07:15PM +0200, Simona Vetter wrote: > > We should definitely document this trick better though, I didn't find any > > place where that was documented. > > This is a good idea. I think - and I also mentioned this a few times in the patch series that added the workqueue support - we should also really document the pitfalls of this. If the scheduler shares a workqueue with the driver, the driver needs to take special care when submitting work that it's not possible to prevent run_job and free_job work from running by doing this. For instance, if it's a single threaded workqueue and the driver submits work that allocates with GFP_KERNEL, this is a deadlock condition. More generally, if the driver submits N work that, for instance allocates with GFP_KERNEL, it's also a deadlock condition if N == max_active.