Re: [PATCH v5 12/19] rust: drm: Add RegistrationGuard for drm_dev_enter/exit critical sections

"Alexandre Courbot" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Sun Jun 28, 2026 at 11:53 PM JST, Danilo Krummrich wrote:
> DRM ioctls do not guarantee that the parent bus device is still bound.
> However, since DRM device registration is managed through Devres, using
> drm_dev_unplug() on unregistration ensures that between drm_dev_enter()
> and drm_dev_exit() the parent device must be bound.
>
> Add RegistrationGuard, a guard object representing a drm_dev_enter/exit
> SRCU critical section that dereferences to &Device<T, Registered>. The
> guard is obtained from Device<T, Ioctl> and proves at runtime that the
> device is still registered.
>
> Switch Registration::drop from drm_dev_unregister() to drm_dev_unplug()
> to provide the SRCU barrier that RegistrationGuard's safety argument
> relies on.
>
> Reviewed-by: Lyude Paul <[email protected]>
> Signed-off-by: Danilo Krummrich <[email protected]>

Reviewed-by: Alexandre Courbot <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.