From: Alice Ryhl <aliceryhl@google.com>
To: "Onur Özkan" <work@onurozkan.dev>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
dri-devel@lists.freedesktop.org, dakr@kernel.org,
daniel.almeida@collabora.com, airlied@gmail.com,
simona@ffwll.ch, ojeda@kernel.org, boqun@kernel.org,
gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, tmgross@umich.edu,
boris.brezillon@collabora.com
Subject: Re: [PATCH v8 2/3] drm/tyr: add GPU reset infrastructure
Date: Wed, 18 Nov 2026 12:10:37 +0000 [thread overview]
Message-ID: <av2VvS0bRJYVwdUz@google.com> (raw)
In-Reply-To: <20261113-tyr-reset-impl-v8-2-2ee298ac9808@onurozkan.dev>
On Fri, Nov 13, 2026 at 05:32:27PM +0300, Onur Özkan wrote:
> + /// Processes one scheduled reset request.
> + ///
> + /// If the pending reset cannot be claimed, the worker returns immediately.
> + ///
> + /// It first claims [`ResetState::Pending`], then waits for earlier hardware
> + /// accesses to complete before issuing the reset and returning the worker
> + /// state to [`ResetState::Idle`].
> + ///
> + /// Panthor reference:
> + /// - drivers/gpu/drm/panthor/panthor_device.c::panthor_device_reset_work()
> + fn reset_work(&self) {
> + if !self.try_transition(ResetState::Pending, ResetState::InProgress) {
> + return;
> + }
> +
> + dev_dbg!(self.pdev, "Starting GPU reset.\n");
> +
> + // Wait for current hardware accesses to finish before resetting.
> + let reset_guard = self.hw.close();
> + let reset_result = run_reset(self.pdev.as_ref(), &self.iomem);
> + drop(reset_guard);
> +
> + if let Err(e) = reset_result {
> + dev_err!(self.pdev, "GPU reset failed: {:?}\n", e);
> +
> + // TODO: Unplug the GPU.
> + // There is no API for unplugging the GPU and this is unreachable
> + // for now since there are no hardware users for reset API.
> + } else {
> + dev_dbg!(self.pdev, "GPU reset completed.\n");
> + }
> +
> + let _ = self.try_transition(ResetState::InProgress, ResetState::Idle);
I'm pretty sure this needs to happen before drop(reset_guard).
> + /// Creates [`ResetHandle`].
> + ///
> + /// # Safety
> + ///
> + /// The returned handle must not be leaked or otherwise prevented from
> + /// running [`Drop`], since it owns work that may borrow from `'reset`.
> + pub(crate) unsafe fn new(
> + pdev: &'reset platform::Device<Bound>,
> + iomem: ArcBorrow<'_, IoMem<'reset>>,
> + ) -> Result<impl PinInit<Self, Error>> {
> + let iomem = iomem.into();
> +
> + Ok(try_pin_init!(Self {
> + // SAFETY: The caller guarantees the handle is dropped.
> + controller <- unsafe {
> + kernel::new_scoped_work!("tyr::reset", Controller::new(pdev, iomem))
> + },
> + wq: Queue::new_ordered().build(c"tyr-reset-wq")?,
> + }))
The Result is not needed. This can simplify to:
) -> impl PinInit<Self, Error> {
let iomem = iomem.into();
try_pin_init!(Self {
// SAFETY: The caller guarantees the handle is dropped.
controller <- unsafe {
kernel::new_scoped_work!("tyr::reset", Controller::new(pdev, iomem))
},
wq: Queue::new_ordered().build(c"tyr-reset-wq")?,
})
> + }
> +
> + /// Schedules a GPU reset on the dedicated workqueue.
> + ///
> + /// If a reset is already pending or in progress the call is a no-op.
> + #[expect(dead_code)]
> + pub(crate) fn schedule(&'reset self) {
> + // TODO: Similar to `panthor_device_schedule_reset()` in Panthor, add a
> + // power management check once Tyr supports it.
> +
> + if self
> + .controller
> + .try_transition(ResetState::Idle, ResetState::Pending)
> + {
> + let _ = self.wq.enqueue_scoped(&self.controller);
> + }
Because this type is invariant over 'reset, it's impossible to call a
method that takes &'reset self.
I think you can just change this to &self.
Alice
next prev parent reply other threads:[~2026-11-18 12:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 14:32 [PATCH v8 0/3] drm/tyr: GPU reset infrastructure Onur Özkan
2026-11-13 14:32 ` [PATCH v8 1/3] drm/tyr: clear stale IRQ state before soft reset Onur Özkan
2026-11-13 14:40 ` sashiko-bot
2026-11-18 12:06 ` Alice Ryhl
2026-11-18 13:07 ` Daniel Almeida
2026-11-13 14:32 ` [PATCH v8 2/3] drm/tyr: add GPU reset infrastructure Onur Özkan
2026-11-13 14:47 ` sashiko-bot
2026-11-14 5:56 ` Onur Özkan
2026-11-15 23:07 ` kernel test robot
2026-11-18 12:10 ` Alice Ryhl [this message]
2026-11-13 14:32 ` [PATCH v8 3/3] drm/tyr: put iomem behind the hardware gate Onur Özkan
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=av2VvS0bRJYVwdUz@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=boris.brezillon@collabora.com \
--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=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.