rpmsg: glink: Wait for intent, not just request ack
authorBjorn Andersson <quic_bjorande@quicinc.com>
Mon, 27 Mar 2023 14:46:17 +0000 (07:46 -0700)
committerBjorn Andersson <andersson@kernel.org>
Wed, 19 Apr 2023 19:43:19 +0000 (12:43 -0700)
commitc05dfce0b89e3b58043805b6f4bdf30e3561d867
tree837e31a4b31aef9f96e7532b75e8542484746542
parent0a7eee89e79eb8b97d46e1e0001b9e2709795af5
rpmsg: glink: Wait for intent, not just request ack

In some implementations of the remote firmware, an intent request
acknowledgment is sent when it's determined if the intent allocation
will be fulfilled, but then the intent is queued after the
acknowledgment.

The result is that upon receiving a granted allocation request, the
search for the newly allocated intent will fail and an additional
request will be made. This will at best waste memory, but if the second
request is rejected the transaction will be incorrectly rejected.

Take the incoming intent into account in the wait to mitigate this
problem.

The above scenario can still happen, in the case that, on that same
channel, an unrelated intent is delivered prior to the request
acknowledgment and a separate process enters the send path and picks up
the intent. Given that there's no relationship between the
acknowledgment and the delivered (or to be delivered intent), there
doesn't seem to be a solution to this problem.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Chris Lew <quic_clew@quicinc.com>
[bjorn: Fixed spelling issues pointed out by checkpatch in commit message]
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230327144617.3134175-3-quic_bjorande@quicinc.com
drivers/rpmsg/qcom_glink_native.c