From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 252EB606A332 for ; Wed, 2 Dec 2026 11:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T9Gt58V9 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8897D11212C; Wed, 2 Dec 2026 11:40:04 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7FD0D11213D for ; Wed, 2 Dec 2026 11:39:58 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 8C04F6127C; Wed, 2 Dec 2026 11:39:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 615111F00893; Wed, 2 Dec 2026 11:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796211597; bh=Z8dLufOVE6vTZURxYv973etMhtsJAjTdWaPFfXD5Bp8=; h=From:To:Cc:Subject:Date; b=T9Gt58V96zFBk1J8joDQBWfJNx4K69ux096WIUbsuTvk8j6rYy2VxMhGQgrlEvo/d 2INTpJP158gwZYAO17MRuLb2xesRvWQH54kIMgBoE8+bW0YwDIJsnWFU5p/2fOG17l wPpXTMIuzktB6srA3EGTOkePNl4SjYGm60qzDD9LOeZn4pzf2nzI/nqAu96PNVfJxl eySH2/9A/Hob1uPPxmTKZwG5esgv8z55lx/fIIzqH3efUGRaaM8+k7+JD+hHRpB2xJ CE1qJecf7XcVwMfUF0TM3uYh/uWORbVfdCUnbe1xf++RgwIvSUsza8Znh1IebRbfJ+ 4y2u8OiPk4svA== From: Philipp Stanner To: Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?UTF-8?q?Onur=20=C3=96zkan?= , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Philipp Stanner , Matthew Brost , David Airlie , Simona Vetter , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Lyude Paul , "Joel Fernandes (NVIDIA)" , Boris Brezillon , Yuvan Shen Cc: rust-for-linux@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, rcu@vger.kernel.org Subject: [PATCH v3 0/9] rust: Add drm::JobQueue Date: Wed, 2 Dec 2026 12:39:06 +0100 Message-ID: <20261202113914.1660411-2-phasta@kernel.org> X-Mailer: git-send-email 2.56.0 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Changes in v3: - Add and use RcuState, an RCU grace period identifier and waiter. (Gary) - Use task::Poll for the fence status. (Gary) - Use jq.park() in jq::drop(). - Update docu and commit messages to reflect the handling of dependency errors. - Add TODO for dependency errors. Changes in v2: - Fence: - Use cond_synchronize_rcu() to speed up fence dropping. (Gary) - status(): Don't lock anymore, since I fixed the misordering in C [1]. - JQ: - In v1, jobs could be forgotten without being submitted, causing UAF. Fixed it by incrementing the atomic by 1, decremented then later in submit. - Fix bug where I was holding the lock while dropping stuff. (Younes) - Add support for park() and unpark() for Tyr. - Do not check for parked (revoked) in DropWorker, so that a park()ed JQ can continue to drop. Is safe thx to drop order. - Use our own workqueues, with MEM_RECLAIM flag set for the submit workqueue. - Rename SubmitWorker consistently to RunWorker. Now, submit always means job.submit(), and run always means run_job(). - Add max_capacity, so you can never submit jobs that are too expensive. - Dependency fences: - Do not kill the JQ anymore if dependencies got signaled with an error. Just run these jobs anyways, like drm_sched. (Boris) - Thus, remove the kill() callback. - In a future extension, we can pass the error codes through a suitable data structure to the driver in run_job(). - Why was this done? To be discussed in detail, but implementing it like this allows us for centralizing dep error handling in run_job(), *if* drivers should care. As far as can be seen in the DRM drivers, they don't. And if they do we would have to come to a common position about fences' errors' meaning. So the proposal is to upstream it like this for now to unblock Tyr. Dependency error checking can then be added once our discussions reached a common ground. - Fix CLIPPY warnings. - Update the docu to reflect the points above. - Update the doctest examples accordingly. Changes since RFCv7: - Write a bunch of documentation, mostly about the kill() backend_ops. - Add creations of own work_queues (requires some work with the life times still; last relevant TODO AFAICS). [1] https://lore.kernel.org/dri-devel/20261120111615.2940647-2-phasta@kernel.org/ Depends on the workqueue series: https://lore.kernel.org/rust-for-linux/20261020-rust-workqueue-v3-0-ea7c74d02068@google.com/ Last RFC: https://lore.kernel.org/dri-devel/20261103153138.1087330-2-phasta@kernel.org/ Repo: https://gitlab.freedesktop.org/pstanner/linux-drm-work/-/tree/jobqueue-jobqueue-v3?ref_type=heads Philipp Stanner (9): rust: rcu: Add RcuState rust: DmaFence: Implement Deref for FenceContext rust: DmaFence: Add ID accessor for FenceContext rust: DmaFence: Don't drop on signal rust: DmaFence: Replace call_rcu() with RcuState rust: DmaFence: Replace is_signaled() with status() rust: DmaFence: Pass result in callbacks rust: drm: Add JobQueue MAINTAINERS: Add drm::JobQueue to drm_sched's entry MAINTAINERS | 1 + rust/helpers/rcu.c | 5 + rust/kernel/dma_buf/dma_fence.rs | 254 ++++----- rust/kernel/drm/job_queue.rs | 864 +++++++++++++++++++++++++++++++ rust/kernel/drm/mod.rs | 4 + rust/kernel/sync/rcu.rs | 35 ++ 6 files changed, 1041 insertions(+), 122 deletions(-) create mode 100644 rust/kernel/drm/job_queue.rs -- 2.56.0