From: Janne Grunau <j@jannau.net>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: drm: ioctl: return Result<i32> from ioctl handlers
Date: Mon, 30 Nov 2026 15:19:27 +0100 [thread overview]
Message-ID: <20261130141927.GC41778@robin.jannau.net> (raw)
In-Reply-To: <CAH5fLgjSH9nB7G-90HW97K-J0KuwSa6XpP0tVq67czNbYeCQnQ@mail.gmail.com>
On Mon, Nov 30, 2026 at 01:32:18PM +0100, Alice Ryhl wrote:
> On Mon, Nov 30, 2026 at 12:48 PM Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> wrote:
> >
> > On Mon, Nov 30, 2026 at 11:18 AM Alice Ryhl <aliceryhl@google.com> wrote:
> > >
> > > While teaching the Rust for Linux course,
> >
> > Without context, people will not know what course it means. Maybe add
> > the company name?
>
> Yeah I worded this "my" elsewhere but forgot to do so here.
>
> > > integer, so it's not clear what values about i32::MAX would mean.
> >
> > "above"
> >
> > > This means that there are two ways of returning a
> > > negative value to userspace (either Err(err) or Ok(-x)), and that
> > > userspace cannot distinguish whether the driver did one or the other.
> >
> > Yeah, I am not thrilled about having two ways that look different but
> > do the same.
>
> Well, I don't think the current behavior that has errornous behavior
> is great either. Perhaps we can just return Result<()>, but I am not
> sure if any DRM drivers actually need non-zero return value.
drm_ioctl() is annotated to return "Zero on success, negative error code
on failure." [1] so it should be safe to switch to Result<()>.
I verified that it's true for the asahi downstream driver. A quick
verification of panthor's (and nouveau's?) ioctl wouldn't hurt but I'd
be surprised if those return values other than 0 on success.
So it should be safe to return Result<()> at least for now but I
wouldn't expect this to change.
The drm_ioctl implementation had since forever (the git root commit in
2005) a debug log statement on non-zero ioctl return values.
Janne
Link: https://www.kernel.org/doc/html/v4.11/gpu/drm-internals.html#c.drm_ioctl [1]
next prev parent reply other threads:[~2026-11-30 14:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 10:17 [PATCH 0/2] rust: drm: ioctl: make DRM ioctls easier to understand Alice Ryhl
2026-11-30 10:17 ` [PATCH 1/2] rust: drm: ioctl: return Result<i32> from ioctl handlers Alice Ryhl
2026-11-30 11:43 ` Janne Grunau
2026-11-30 12:33 ` Alice Ryhl
2026-11-30 11:48 ` Miguel Ojeda
2026-11-30 12:32 ` Alice Ryhl
2026-11-30 14:19 ` Janne Grunau [this message]
2026-11-30 13:15 ` Gary Guo
2026-11-30 10:17 ` [PATCH 2/2] rust: drm: ioctl: document declare_drm_ioctls! arguments and assertions Alice Ryhl
2026-11-30 11:45 ` Janne Grunau
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=20261130141927.GC41778@robin.jannau.net \
--to=j@jannau.net \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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
all inboxes | Powered by JetHome®