From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796211597; b=OA/qG9FHUU1Atj5+Ue9TxM12WZGxQbAj8lWCfDHznTlqAfQq+SRXMPwp+Qz9D65RRCp0 NjvX/Ome5fKTlxz2XPnKRPASduEH8YmcXMk9FnMc6s411moxC0aCDz+SSwI4VDhfgtYcF Wn5xAkrG0HeBOGjQ2WKoGTLh8BSAPgCJFSa0j05OzT7d72cYKFBpQxkZT5K+s0xqfwBxD U2QVjcnobg9G5GCrzII9m8R4Xn7DJz2qaTBT2mhAK1BbOnhkuxs9+DVfNcn87Fpq89R3/ EB8q/CsghdaJpy7U/tw3+OZvJgKHd+syfJMTNB3R8FgusR2Bg5hJjmBMr9eRX7ktWzg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796211597; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=Z8dLufOVE6vTZURxYv973etMhtsJAjTdWaPFfXD5Bp8=; b=s1EuHeRH3TjA2rNNreqyklj8RamAtqTqNSYY+l/oe51fStUfV1kuosI1t5Ontg7aQmp8 qGsC0RFLtnHf0dlZFoSNSss3PkleFvRKBqRWW6qfn4wh0iz04UhG907cMp5uBOXTs9lLH UzDy5GcCvVyYfrOKzwzglWNIQO2VWcKr2a+HAhhgiZWvCSvXWd6HPi/CN8S/CWcBSZ3Hb 9lfr9zX26AW5bQMhdOix4yJPtdbE2EQssfu1aNY5cKxakcCHedxvaAgiZYMdAK+LV1OtT eeyIt9fYVRelo8xdbuawB6TWWDR3ZzQJBLU7JVN9z5ABbM1kMmJG5dhNW01WuIlFi3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=T9Gt58V9; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8D6B606A31A; Wed, 2 Dec 2026 11:39:57 +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: 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-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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