summaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2017-12-12 18:58:57 -0500
committerBjorn Andersson <bjorn.andersson@linaro.org>2017-12-19 00:50:11 -0500
commit178f3f75bb4ef7a29bf5c175eb33794ac9ae9bce (patch)
tree94be99cacee7751b464d0046331904558e61be4d /drivers/rpmsg
parentb2c932e7991ca7e3995457463b72fc34e64477a0 (diff)
rpmsg: smd: Don't hold the tx lock during wait
Holding the tx lock while waiting for tx-drain events from the remote side blocks try_send requests from failing quickly, so temporarily drop the tx lock while waiting. While this allows try_send to fail quickly it also could allow a subsequent send to succeed putting a smaller packet in the FIFO while we're waiting for room for our large packet. But as this lock is per channel we expect that clients with ordering concerns implements their own ordering mechanism. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r--drivers/rpmsg/qcom_smd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index ed167ab52a68..10870189c0c8 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -752,12 +752,19 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,
752 752
753 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0); 753 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 0);
754 754
755 /* Wait without holding the tx_lock */
756 mutex_unlock(&channel->tx_lock);
757
755 ret = wait_event_interruptible(channel->fblockread_event, 758 ret = wait_event_interruptible(channel->fblockread_event,
756 qcom_smd_get_tx_avail(channel) >= tlen || 759 qcom_smd_get_tx_avail(channel) >= tlen ||
757 channel->state != SMD_CHANNEL_OPENED); 760 channel->state != SMD_CHANNEL_OPENED);
758 if (ret) 761 if (ret)
759 goto out; 762 goto out;
760 763
764 ret = mutex_lock_interruptible(&channel->tx_lock);
765 if (ret)
766 goto out;
767
761 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1); 768 SET_TX_CHANNEL_FLAG(channel, fBLOCKREADINTR, 1);
762 } 769 }
763 770