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 0AEDAEA3F36 for ; Tue, 10 Feb 2026 10:36:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CB9410E545; Tue, 10 Feb 2026 10:36:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="tP59ZqOH"; 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 039D710E545 for ; Tue, 10 Feb 2026 10:36:24 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id BD15E440DE; Tue, 10 Feb 2026 10:36:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11500C116C6; Tue, 10 Feb 2026 10:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770719783; bh=SfmA4ZiVN6LIhoVXum4PX+xUpxUjguH2l1RyRHiivl8=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=tP59ZqOH0iLnItxQDS3kUMfVmS4uTupibp3LKjgV9QlaF5acqrAT5gX6hfmoQxooP ccaiPZJb+YWf03KF/0h6KlW1zEydiq1UcFTEWWA+43Ba/+eqKeVEpCdfU2+dNZZEd7 /VFzKi6h10xbOctuwyUqMiCX42KcRTz64HmPSuujZOdVKkMgekTt6qTZ82ul/I2tO1 95s9CYeoBdBxnF35coMRiXJa8rFQhnYS1Ids5g7zN/nPC1ZJa3a+iYabyy82n3P//g 38GKx357NL2RVEfw4JVqD6/yAkDTKd7MeJ63pr4vQPjmoT3BaNVx5F9WrI+NItLSuk 9HXJLsPjCkVDQ== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Feb 2026 11:36:19 +0100 Message-Id: Subject: Re: [RFC PATCH 2/4] rust: sync: Add dma_fence abstractions Cc: "Boris Brezillon" , =?utf-8?q?Christian_K=C3=B6nig?= , "Philipp Stanner" , , "David Airlie" , "Simona Vetter" , "Gary Guo" , "Benno Lossin" , "Daniel Almeida" , "Joel Fernandes" , , , To: "Alice Ryhl" From: "Danilo Krummrich" References: <20260203081403.68733-2-phasta@kernel.org> <20260203081403.68733-4-phasta@kernel.org> <20260205095727.4c3e2941@fedora> <20260209155843.725dcfe1@fedora> <20260210101525.7fb85f25@fedora> 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 Tue Feb 10, 2026 at 11:15 AM CET, Alice Ryhl wrote: > One way you can see this is by looking at what we require of the > workqueue. For all this to work, it's pretty important that we never > schedule anything on the workqueue that's not signalling safe, since > otherwise you could have a deadlock where the workqueue is executes some > random job calling kmalloc(GFP_KERNEL) and then blocks on our fence, > meaning that the VM_BIND job never gets scheduled since the workqueue > is never freed up. Deadlock. Yes, I also pointed this out multiple times in the past in the context of C= GPU scheduler discussions. It really depends on the workqueue and how it is use= d. In the C GPU scheduler the driver can pass its own workqueue to the schedul= er, which means that the driver has to ensure that at least one out of the wq->max_active works is free for the scheduler to make progress on the scheduler's run and free job work. Or in other words, there must be no more than wq->max_active - 1 works that execute code violating the DMA fence signalling rules. This is also why the JobQ needs its own workqueue and relying on the system= WQ is unsound. In case of an ordered workqueue, it is always a potential deadlock to sched= ule work that does non-atomic allocations or takes a lock that is used elsewher= e for non-atomic allocations of course.