From: "Heiko Stübner" <heiko@sntech.de>
To: Tomeu Vizoso <tomeu@tomeuvizoso.net>,
Igor Paunovic <royalnet026@gmail.com>
Cc: Oded Gabbay <ogabbay@kernel.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-rockchip@lists.infradead.org,
Guangshuo Li <lgs201920130244@gmail.com>,
Jiaxing Hu <gahing@gahingwoo.com>,
Igor Paunovic <royalnet026@gmail.com>
Subject: Re: [PATCH v2 1/2] accel/rocket: release the shared device's devres on teardown
Date: Wed, 04 Nov 2026 11:16:37 +0100 [thread overview]
Message-ID: <1888503.5KxKD5qtyk@diego> (raw)
In-Reply-To: <20260731064933.12548-2-royalnet026@gmail.com>
Am Freitag, 31. Juli 2026, 08:49:32 Mitteleuropäische Normalzeit schrieb Igor Paunovic:
> rocket_device_init() attaches its allocations to the shared "rknn"
> platform device via devres: devm_drm_dev_alloc(), devm_kcalloc() for
> the cores array and devm_mutex_init(). That device is registered at
> module init, never binds to a driver, and is only unregistered at
> module exit - so its devres list is not released for as long as the
> module is loaded.
>
> rocket_device_fini() only calls drm_dev_unregister(): it does not run
> the drm_dev_put() devres action or free any of the other entries.
> Every fini/re-init cycle therefore leaks the previous rocket_device
> (with its embedded drm_device and all drmm state, including the accel
> minor number), the cores array and the mutex devres node. The cycle is
> easy to trigger: unbind the last bound core and bind one again, or
> fail the first core's probe (-EPROBE_DEFER retries included).
>
> Observable symptom, RK3588 (Orange Pi 5 Plus): each unbind/rebind
> cycle of all three cores moves the accel node forward -
> /dev/accel/accel0 comes back as accel1, then accel2 - because every
> leaked drm_device keeps its minor pinned.
>
> Wrap the initialization in a devres group and release exactly that
> group wherever the device is torn down: on the rocket_device_init()
> error path, when the first core's rocket_core_init() fails, and when
> the last core is removed. Each fini now frees what the matching init
> allocated, and the accel minor is reusable again.
>
> Fixes: ed98261b4168 ("accel/rocket: Add a new driver for Rockchip's NPU")
> Signed-off-by: Igor Paunovic <royalnet026@gmail.com>
not to self: patch 2 became part of the dvfs series
this one (patch1) still seems relevant
next prev parent reply other threads:[~2026-11-04 10:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 6:49 [PATCH v2 0/2] accel/rocket: fix shared-device lifecycle on probe failure and unbind Igor Paunovic
2026-07-31 6:49 ` [PATCH v2 1/2] accel/rocket: release the shared device's devres on teardown Igor Paunovic
2026-11-04 10:16 ` Heiko Stübner [this message]
2026-07-31 6:49 ` [PATCH v2 2/2] accel/rocket: keep core slots stable across unbind and rebind Igor Paunovic
2026-08-01 3:36 ` Jiaxing Hu
2026-08-12 13:03 ` [PATCH v2 0/2] accel/rocket: fix shared-device lifecycle on probe failure and unbind Igor Paunovic
2026-09-22 8:12 ` Igor Paunovic
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=1888503.5KxKD5qtyk@diego \
--to=heiko@sntech.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gahing@gahingwoo.com \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=ogabbay@kernel.org \
--cc=royalnet026@gmail.com \
--cc=tomeu@tomeuvizoso.net \
/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®