From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792500770; b=FUtkNpY9u+djBgDvggmdH1pj7b62Acorlv8ayB5V6aHe7l+cVTQIfTU7VpIizwQzksHh r8MDFubPTV9IfFyUnsxa/KqhN9If13+0NSLGivLe1UmDmVlbdDDCiyyMosQl4pP4Xn6Ro +MvMY2tm34G+FnjZ8W+H8eeQQp0MBr4+rZIThDSxqjxD31MjYMWPCWUfE3wauta010tYX P9WtLOxxSzFdQQIBD7gt7AsmCqQ+z/2d1u/6hYnUUSo8S+M6i3ZEXIZ5QpRigAaT7Kiw6 nEIyvyR3JnTvqtJ1eeQBplTl5tX7/A6btcuez3liUNbOz2ur/uoLD521ofVbMU/147g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792500770; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-B4-Tracking:X-Change-Id:X-Developer-Key:X-Developer-Signature: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=h4dSeWA0TZhH/a30MaXIOvSiMoTtdnOH3PXIJsbEBS0=; b=Gzcew/cFNa5WdoMbcyckdY6zPhK7X/ZTfegEWRHgyfCFbEXK6ZTC5IC8xCAtoV8mD2cn ZOCtqWaZo85Afu3UUwE6JzH0ybLd9t/hgser5P86QQgbLnl1b1tUPDbi2JLmGvwJl5ruC S5EEZpqRDJEbhKeht+nwkH8sfo+EA5nktO179zu7+KVs9zKu24F3g44mrD6RlHdgjuz/E 2xv8SO2LDUkgn2HAN2a8t4Wmt09btTGJb+pdaGFZY6P2WJr84ujSV6cdbPyfYQE8aE9l2 Fkr6FJn49GZux2urW8i5RGLa/G2i5HQINZlj2vWm/hlCefc7QhD2CgkaUSh7jWwoFuQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=Hb+sXrL1; arc=none smtp.remote-ip=209.85.221.69 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB1A1606A321 for ; Tue, 20 Oct 2026 12:52:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB1A1606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=Hb+sXrL1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48dfa054f26so2521309f8f.2 for ; Tue, 20 Oct 2026 05:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1792500768; x=1793105568; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=h4dSeWA0TZhH/a30MaXIOvSiMoTtdnOH3PXIJsbEBS0=; b=Hb+sXrL1A3qp3CXvy3N9jCrBC5c3n2L0LCYOi4aQCCOwzOBOLLKtI+Cb+2wEAJic7q z4Eh88dX83J1XOnNYjkokMHB7EtKTFAbmD5nU4Qz0aWWoF5bhAXteoCiHccPTbxAkHqu r8ypT+pIzoxy8JjciI2kd1H2ZNblq/U/WiwinrBi49ydTZeBdqLJrkY1t5RiKWYq+VYp 3rJudVa24glVh17W9LujSWf0DbUSMyBwAFjsMccAqdX6inVKWATsYroU35IIWbOoNGyA fY2MqmIQ0pghdDSQjuNPwxYlvPA7cmr467yR8eGxjYn2HHlSAhT7syN6C546thNm0y7t RsXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792500768; x=1793105568; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=h4dSeWA0TZhH/a30MaXIOvSiMoTtdnOH3PXIJsbEBS0=; b=k/H0N8T4/5W+2DsymVKQ4NlyACKoO1xAvsCGR0jQ1+gW4usQMP94DXdCvL8qmtz1lX VXyq5ZCWau5/Cu1iONn0gkobbS/gMm9I1MsQEwF3nNSe0u2/r/7kWPk7aNK7OMXvvspX 3+81F3Hg699aIUjxyAL7AcyE6MQhqGLDeUuiVcOZYRIFvPUt6KwqRODErXVFQb3DTrON 2OHrAupw8BoIVwd4mv6px0/NF9eUbiLN8ICQLMOx6Lp3wbACZbXXCKcOlsuRYDoijyTB 1ytZgqaFhHlWiW2dvzGoFpHbdn2AyxHZ+lUsOrBPJrtGdffeYLA1D8YIL7xN61NBHOXx XMxQ== X-Forwarded-Encrypted: i=1; AKwUvBw5N/MAIKQSRAkflIWzL7DcFhVSknRGfstX2oPBGriRqVwjRrBoyu+ehzBAPghzUywxDXpqDwNydjARa3c=@vger.kernel.org X-Gm-Message-State: AFq9FYJ7jKF+3W5hHHZTQ6LLt3lwcBVZP2LTkbtq1I59/rOSfOOwUFBI I3oJpg9NDco5+VrUVDf4nfRf+zkw+1xzCwQtnRQWx38jXoubW+N+w4cKQot3abKLQ9Sj+awwyAY rMd97bJxSNfwF3lJWzQ== X-Received: from wraz5.prod.google.com ([2002:a05:6000:4685:b0:48d:f161:cdaf]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:4694:b0:487:b4a:3f54 with SMTP id ffacd0b85a97d-48e07f9da3amr16892672f8f.29.1792500767961; Tue, 20 Oct 2026 05:52:47 -0700 (PDT) Date: Tue, 20 Oct 2026 12:52:35 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIABNk12oC/z3OSw6CMBSF4a2Qjr2kLfYhI/dhHCC9QINSuaVqQ ti7jSEO/8H5clYWkTxGVhcrI3z56MOUozoUrB2aqUfwLjeTXGrBhQRKcYF3oHFOmBC0sq3j3Q2 N4SyPnoSd//zAyzV3R+EBy0DY/BluuRFaSSXLyh5P1igQ4JqRziPShPcyUL9ThHPKl5bd27Yvw 3h11rAAAAA= X-Change-Id: 20261012-rust-workqueue-658cd0fbe770 X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=3393; i=aliceryhl@google.com; h=from:subject:message-id; bh=YrUDzBvba3x+3LL60N6o4S9VKs85idwu0qTHG71exFU=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBq12QZrkSDCsbkM2IX5DEGwRjx/zHb9Od523ya1 3XI8gry9hSJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCatdkGQAKCRAEWL7uWMY5 RoBfEACiWD0gE1O0ceXwL9CpqVv8XFZCxtiaC8q3opv8DXffNsmlHiTwX9t3gu1d2PnsimZiX/J xRXEmLvsTQihvJRGkI8BLiw+MB+EGfpWbp8bVlmS9UkHLnY4OoNH41NEsV4RKz5RVglf5DXV4m+ I2RQTDrB7EdjbWHR/Pf4KHVHkwSFNkG+KlFb1RLTwmUDMOFo0OhT/CpX/1z5Ody6yYVLGuuBgn6 xvrsiFWPN2xW18EJ/ZE+IzfeSvTLHPKx3ypx9bA6qUc2EvxvEy6gLKTzt3Eza3Sv3oTdaUNl6Em z0N+Y5R7KU3Zy7W7sxKPCyFldpmqgo+2NkA0lzXgSyTd4PGgsZDUDXpyNTKupCQO5Hlc1xqiw1k XZWD8xYbYnfzK3V9Ysh++FH3YI6Bdfbqq9ZX8dijM+S70wCC4Biy11xB1rQcm7nOI3qfGaWIxtT jflXXxPY6hueGgZY26K9ClhXjpGoETj/KVFnY4kbDcD/azMte5yrux6XpqtP+9mzyDLyKB38x3D u2WVj53xlkxHxAcBJqHfpQkZInayArnmGke2Ghl2k89avYmneMftOltaeASHkMjPX46zeqG8NrV k5gVY6oqgYLa8sq9vnGaOM1jatiaZ8yKit/grQGO9nkZBH2h/Ay469VwgjejNx6avmzxGw7FRIc m0nsqlMabHT3GoA== X-Mailer: b4 0.14.3 Message-ID: <20261020-rust-workqueue-v3-0-ea7c74d02068@google.com> Subject: [PATCH v3 0/4] workqueue: OwnedQueue and ScopedWork From: Alice Ryhl To: Tejun Heo , Lai Jiangshan , Danilo Krummrich Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , "=?utf-8?q?Onur_=C3=96zkan?=" , John Hubbard , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, Alice Ryhl , stable@vger.kernel.org Content-Type: text/plain; charset="utf-8" This series extends the Rust workqueue bindings with the ability to create custom workqueues (OwnedQueue), and introduces ScopedWork, a work item type that cancels synchronously on drop, allowing drivers to use workqueues with lifetime-bound data. This is a continuation of Danilo's v2 [4], which picked up my earlier series [1] and Onur's ScopedQueue work [2]. Patch 1/6 of v2, "rust: workqueue: replace deprecated system_wq with system_{percpu,dfl}_wq", is a fix and has been sent separately [3]. This series no longer depends on it. [1] https://lore.kernel.org/all/20260312-create-workqueue-v4-0-ea39c351c38f@google.com [2] https://lore.kernel.org/all/20260617144645.253444-1-work@onurozkan.dev [3] https://lore.kernel.org/all/20261014-rust-workqueue-system-fix-v2-1-c018b8f870f9@google.com [4] https://lore.kernel.org/all/20260807165252.3849875-1-dakr@kernel.org Changes in v3: - Rebase on v7.3-rc7 - Split out the system_wq patch and send it separately as a fix [3]; this series no longer depends on it - Drop ScopedQueue: with the ScopedWork changes below it is no longer needed to enqueue non-'static work items, and it has no other user - ScopedWork: make ScopedWork::new() unsafe instead of Queue::enqueue_scoped(), which is now a safe method accepting &ScopedWork on any queue - ScopedWork: drop the WorkItem/WorkItemPointer/HasWork impls and the public ScopedWorkRef type; embed the work_struct directly with a dedicated callback, and keep the Opaque-wrapped payload private - ScopedWork: drop T on drop (Opaque does not run destructors) - ScopedWork: propagate the initializer's error type from new() - Builder: new_power_efficient() uses WQ_PERCPU | WQ_POWER_EFFICIENT; remove the now pointless percpu() modifier - Pick up Reviewed-by tags from Daniel - Link to v2: https://lore.kernel.org/all/20260807165252.3849875-1-dakr@kernel.org Changes in v2: - Merge scoped_work.rs and scoped_queue.rs into scoped.rs - Introduce ScopedWorkRef and wrap it in Opaque inside ScopedWork to avoid &mut aliasing in drop - Pass &ScopedWorkRef to ScopedWorkItem::run to enable self-re-enqueue - Add Deref for ScopedQueue; remove duplicate enqueue_scoped() - Add Send + Sync for OwnedQueue - Fix stale workqueue::system() references in docs - Drop Work::cancel_work_sync() - Make sysfs() available on ordered workqueues - Add #[inline] annotations throughout Signed-off-by: Alice Ryhl --- Alice Ryhl (3): rust: workqueue: restrict delayed work to global wqs rust: workqueue: create workqueue subdirectory rust: workqueue: add creation of workqueues Danilo Krummrich (1): rust: workqueue: add ScopedWork for non-'static work items MAINTAINERS | 1 + rust/helpers/workqueue.c | 7 + rust/kernel/workqueue/builder.rs | 370 +++++++++++++++++++++++++ rust/kernel/{workqueue.rs => workqueue/mod.rs} | 108 +++++++- rust/kernel/workqueue/scoped.rs | 342 +++++++++++++++++++++++ 5 files changed, 823 insertions(+), 5 deletions(-) --- base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907 change-id: 20261012-rust-workqueue-658cd0fbe770 Best regards, -- Alice Ryhl