Skip to content

Commit fb23b97

Browse files
quic-bjorandeandersson
authored andcommitted
rpmsg: glink: Cancel pending intent requests at removal
During removal of the glink edge interrupts are disabled and no more incoming messages are being serviced. In addition to the remote endpoint being defunct that means that any outstanding requests for intents will not be serviced, and qcom_glink_request_intent() will blindly wait for up to 10 seconds. Mark the intent request as not granted and complete the intent request completion to fail the waiting client immediately. Once the current intent request is failed, any potential clients waiting for the intent request mutex will not enter the same wait, as the qcom_glink_tx() call will fail fast. Reviewed-by: Chris Lew <quic_clew@quicinc.com> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230213155215.1237059-7-quic_bjorande@quicinc.com
1 parent 9c96bac commit fb23b97

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/rpmsg/qcom_glink_native.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ static void qcom_glink_handle_intent_req_ack(struct qcom_glink *glink,
423423
complete(&channel->intent_req_comp);
424424
}
425425

426+
static void qcom_glink_intent_req_abort(struct glink_channel *channel)
427+
{
428+
channel->intent_req_result = 0;
429+
complete(&channel->intent_req_comp);
430+
}
431+
426432
/**
427433
* qcom_glink_send_open_req() - send a RPM_CMD_OPEN request to the remote
428434
* @glink: Ptr to the glink edge
@@ -1788,6 +1794,12 @@ void qcom_glink_native_remove(struct qcom_glink *glink)
17881794
wake_up_all(&glink->tx_avail_notify);
17891795
spin_unlock_irqrestore(&glink->tx_lock, flags);
17901796

1797+
/* Abort any senders waiting for intent requests */
1798+
spin_lock_irqsave(&glink->idr_lock, flags);
1799+
idr_for_each_entry(&glink->lcids, channel, cid)
1800+
qcom_glink_intent_req_abort(channel);
1801+
spin_unlock_irqrestore(&glink->idr_lock, flags);
1802+
17911803
ret = device_for_each_child(glink->dev, NULL, qcom_glink_remove_device);
17921804
if (ret)
17931805
dev_warn(glink->dev, "Can't remove GLINK devices: %d\n", ret);

0 commit comments

Comments
 (0)