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 44D77EF0702 for ; Tue, 10 Feb 2026 11:40:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8454E10E558; Tue, 10 Feb 2026 11:40:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ylOlWMUb"; dkim-atps=neutral Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 992ED10E558 for ; Tue, 10 Feb 2026 11:40:17 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-435ab907109so4070532f8f.3 for ; Tue, 10 Feb 2026 03:40:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770723616; x=1771328416; darn=lists.freedesktop.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=BL/Brk5QbdNFqoBa7MV+E1OKdJabyWc32ZkmSjvJq90=; b=ylOlWMUbpSBbA7H6QJ4uPxy9Z30nG8GZzSj+IiLoc4el34cqH9rW7Nt8ZcitYyZTVE Rjm35xrsPc/Xfti2lK7w0psEs1QlVcZ4BGykXDPDg1ZZcERrli/fS96UTD7PiVQK/lp/ 6grOrQ3wTgSN127dwHGVP7Ue2frZOjalZqUGyiJh6JF4aYb1tO3cXlgDnNWEsvNyYTIX V59bKVYkhtEXTrQI6/0rNwW/WatHBdwzFjmLGqGxwE9m5VKuoBUY50YqmbFtZd6hgoo9 vWzYKJW9tQfOHXynUBpy6k1zWepn6ySpukqEdd8p01P5hXsd/ocLQPssCof2T7/cuM5i 4A8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770723616; x=1771328416; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=BL/Brk5QbdNFqoBa7MV+E1OKdJabyWc32ZkmSjvJq90=; b=SzsOPNAhOZjEjQi8/w3WPiqvlRdbCgUeZQ9JFFzwQtIgmTIHHqHA0uZl5YaKMtrPQK NDNeRjmf7FVDPGgfVANo0nfyb3r7/EC59/v8p2GEygQXsoj8Y2LWRWSkqAT/cUvPvikC XuiwsHB9kTC6j86NAh4y0g5FECjtzOU+7v066l2vBM1MHbJuvmlhmuSPfYEr/U3JmRSk Y78n7g9kVgLbfpCFh3Xhhn0f3HCrVrGPldtppTpjcfNp+8EnOm5uv3+t31ai//HahKHZ vTWCmcddzYJrARfI70qkH97GkNTbL+DFx/ygDQqJ59xvsoeskmb4ASojTaQgOn7XO2E5 4M7Q== X-Forwarded-Encrypted: i=1; AJvYcCV5YBEIbmUE4xhS6/vVlmpwcnE7pUyry0itHRxnydUiM8vDvjo03uRlvLFzh2OoOvAtM9oxmGR8r2o=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxHozrwPuoKzVHhdWUhh10T7ufVNlzh+TPPN1+JRva8KUcyfP9F RWD3Y3L6SjuHSzSEGvzLVTwdOCxRznNmTAWf00kffy32qc7hTaYyEUXQgSMjw4U+dkOOdtYXTTa lNxw1fUVfWu5tTQJc2w== X-Received: from wrbee12.prod.google.com ([2002:a05:6000:210c:b0:436:24d0:695f]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2507:b0:436:1872:63d0 with SMTP id ffacd0b85a97d-43629651e21mr19897651f8f.2.1770723616117; Tue, 10 Feb 2026 03:40:16 -0800 (PST) Date: Tue, 10 Feb 2026 11:40:14 +0000 In-Reply-To: <4e84306c-5cec-4048-a7eb-a364788baa89@amd.com> Mime-Version: 1.0 References: <20260205095727.4c3e2941@fedora> <20260209155843.725dcfe1@fedora> <20260210101525.7fb85f25@fedora> <4e84306c-5cec-4048-a7eb-a364788baa89@amd.com> Message-ID: Subject: Re: [RFC PATCH 2/4] rust: sync: Add dma_fence abstractions From: Alice Ryhl To: "Christian =?utf-8?B?S8O2bmln?=" Cc: Danilo Krummrich , Boris Brezillon , Philipp Stanner , phasta@kernel.org, David Airlie , Simona Vetter , Gary Guo , Benno Lossin , Daniel Almeida , Joel Fernandes , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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:46:44AM +0100, Christian K=C3=B6nig wrote: > On 2/10/26 11:36, Danilo Krummrich wrote: > > 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 so= me > >> 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. > >=20 > > 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= used. > >=20 > > In the C GPU scheduler the driver can pass its own workqueue to the sch= eduler, > > 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. > >=20 > > Or in other words, there must be no more than wq->max_active - 1 works = that > > execute code violating the DMA fence signalling rules. Ouch, is that really the best way to do that? Why not two workqueues? > *And* the workqueue must be created with WQ_MEM_RECLAIM so that work > items can also start under memory pressure and not potentially cycle > back into the memory management to wait for a dma_fence to signal. >=20 > But apart from that your explanation is perfectly correct, yes. Ah, interesting point. Alice