Re: [PATCH 5.10 079/126] drm/tegra: sor: Grab runtime PM reference across reset

Thierry Reding
2021-04-06T11:49:37Z

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

On Mon, Apr 05, 2021 at 05:42:21PM +0200, Pavel Machek wrote:
> Hi!
>
> > However, these functions alone don't provide any guarantees at the
> > system level. Drivers need to ensure that the only a single consumer has
> > access to the reset at the same time. In order for the SOR to be able to
> > exclusively access its reset, it must therefore ensure that the SOR
> > power domain is not powered off by holding on to a runtime PM reference
> > to that power domain across the reset assert/deassert operation.
>
> Yeah, but it should not leak the PM reference in the error handling.

True. However the only reason why the code could realistically fail
between pm_runtime_resume_and_get() and pm_runtime_put() is if we did
not take the runtime PM reference (which would cause the call to
reset_control_acquire() to fail).

So the chances of this actually leaking are practically zero, so I
didn't want to bloat this bugfix with what's essentially dead code. I
can queue up your fix below for v5.14, though, since it's obviously
more correct from a theoretical point of view.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]