On Tue, 17 Nov 2026 15:09:47 +0530, Anandu Krishnan E wrote:
> The same unreachable-orphan problem exists for a timed-out kernel
> invoke (-ETIMEDOUT, only possible when kernel=true): the bail: path
> used to unconditionally unlink the context from fl->pending before
> dropping its reference, even though the DSP may still answer later.
> Leave it linked on fl->pending in that case instead, so
> fastrpc_notify_users() can still find and release it if the channel
> is torn down before that answer arrives.

I am new to this driver, so please treat this as an observation rather
than a review. I applied 1/3 and 2/3 to char-misc-next (917fcbf03) and
read 3/3 against that tree.

The -ETIMEDOUT claim does check out: fastrpc_wait_for_response() only
returns it from the kernel branch's wait_for_completion_timeout(), the
user branch uses wait_for_completion_interruptible(), and
poll_for_remote_response() converts its own timeout into -EIO.

My question is what then happens to such a context at fd close.

Once 1/3 removes the loop in fastrpc_user_free(), no path drains
fl->pending any more: fastrpc_notify_users() completes the contexts on
it but neither unlinks them nor drops a reference, and the drain 3/3
adds to fastrpc_device_release() covers fl->interrupted only. A
timed-out kernel invoke therefore keeps its worker reference, stays
linked on fl->pending, and through the fastrpc_user_get() taken in
fastrpc_context_alloc() keeps fl alive until an SSR runs
fastrpc_notify_users(). If no SSR ever arrives, nothing releases it.

The reasoning you already apply to fl->interrupted seems to cover this
case as well: if fastrpc_release_current_dsp_process() succeeded then
the DSP is done with the whole process, so a context sitting on
fl->pending should be equally safe to release. Would it make sense to
use release_err for both lists?

What made me look was that fastrpc_release_current_dsp_process() is
itself a kernel invoke, so it can be the call that times out. In that
case release_err is non-zero, the fl->interrupted drain deliberately
keeps the worker references, and that call's own context is also left
behind on fl->pending -- so fl, its maps and its mmaps all stay
allocated while fastrpc_session_free() has already marked the session
reusable.

That looks close to the behaviour RenĂª de Souza Pinto reports on
QCS8275 after an adsprpcd init failure, in a thread where he has since
offered to test this series on that board:

  
https://lore.kernel.org/linux-arm-msm/[email protected]/

If that offer stands, an adsprpcd init failure followed by closing the
fd might be a useful case to try, since it is exactly the path where
release_err is non-zero.

I built 1/3 and 2/3 on char-misc-next with COMPILE_TEST=y under W=1
with no new warnings. I have not applied 3/3 itself, and I have no
Qualcomm hardware, so none of this is tested -- it is from reading the
code only.

Thanks,
Murali Krishna

Reply via email to