From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: rust: add ordered workqueue wrapper
Date: Sat, 14 Mar 2026 07:15:47 +1000 [thread overview]
Message-ID: <review-patch3-20260313091646.16938-4-work@onurozkan.dev> (raw)
In-Reply-To: <20260313091646.16938-4-work@onurozkan.dev>
Patch Review
**Concerns about the helper and API design.**
The C helper:
```c
+rust_helper_alloc_ordered_workqueue(const char *name, unsigned int flags)
+{
+ return alloc_ordered_workqueue("%s", flags, name);
+}
```
This correctly avoids format string issues by using `"%s"` as the format. Good.
The `OrderedQueue` type:
```rust
+pub struct OrderedQueue(NonNull<bindings::workqueue_struct>);
```
1. **`enqueue` uses `Queue::from_raw`**: The `enqueue` method does:
```rust
+ pub fn enqueue<W, const ID: u64>(&self, w: W) -> W::EnqueueOutput
+ where
+ W: RawWorkItem<ID> + Send + 'static,
+ {
+ // SAFETY: `self.0` is valid while `self` is alive.
+ unsafe { Queue::from_raw(self.0.as_ptr()) }.enqueue(w)
+ }
```
This creates a temporary `Queue` reference from the raw pointer just to call `enqueue`. This works but means `OrderedQueue` doesn't expose other `Queue` methods (like `try_spawn`). This is fine for the current use case but you might consider providing an `as_queue(&self) -> &Queue` method or implementing `Deref<Target=Queue>` for more general use. That said, keeping the API minimal is also reasonable for now.
2. **Drop safety comment**: The drop impl says:
```rust
+ // - `OrderedQueue` does not expose delayed scheduling API.
```
This safety comment seems tangential — the key invariant for `destroy_workqueue` is that the workqueue was allocated by `alloc_ordered_workqueue` and is being destroyed exactly once, which is guaranteed by `NonNull` ownership semantics.
3. **No `flush_workqueue` method**: Before destruction, `destroy_workqueue` in C already drains pending work. This is fine, but callers using `disable_work_sync` (patch 2) before dropping individual work items should be aware of the ordering — which patch 4 handles correctly.
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-13 21:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 9:16 [PATCH v1 RESEND 0/4] drm/tyr: implement GPU reset API Onur Özkan
2026-03-13 9:16 ` [PATCH v1 RESEND 1/4] drm/tyr: clear reset IRQ before soft reset Onur Özkan
2026-03-13 21:15 ` Claude review: " Claude Code Review Bot
2026-03-13 9:16 ` [PATCH v1 RESEND 2/4] rust: add Work::disable_sync Onur Özkan
2026-03-13 12:00 ` Alice Ryhl
2026-03-13 21:15 ` Claude review: " Claude Code Review Bot
2026-03-13 9:16 ` [PATCH v1 RESEND 3/4] rust: add ordered workqueue wrapper Onur Özkan
2026-03-13 21:15 ` Claude Code Review Bot [this message]
2026-03-13 9:16 ` [PATCH v1 RESEND 4/4] drm/tyr: add GPU reset handling Onur Özkan
2026-03-13 14:56 ` Daniel Almeida
2026-03-13 21:15 ` Claude review: " Claude Code Review Bot
2026-03-13 9:52 ` [PATCH v1 RESEND 0/4] drm/tyr: implement GPU reset API Alice Ryhl
2026-03-13 11:12 ` Onur Özkan
2026-03-13 11:26 ` Alice Ryhl
2026-03-13 21:15 ` Claude review: " Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=review-patch3-20260313091646.16938-4-work@onurozkan.dev \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox