Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20b3ac8b authored by Prasadarao Durvasula's avatar Prasadarao Durvasula Committed by Raghavendra Kakarla
Browse files

drivers: rpmsg: fix to avoid dump stack in rpm-smd driver



While rpm driver flushing messages in lpm mode, use
rpmsg_trysend instead of rpmsg_send to avoid the dump stack.
qcom_smd driver is going to sleep when tx ring buffer is full
if rpmsg_send is used while flushing. rpm-smd is using spinlock
while flushing the messages. Under spinlock it should not go to sleep.
dump stack is shown because of this. Use rpmsg_trysend to avoid
showing dump stack.

Change-Id: I02ac6c273d49bbfd329c1be9820c53f637052b41
Signed-off-by: default avatarPrasadarao Durvasula <pdurvasu@codeaurora.org>
Signed-off-by: default avatarSivasri Kumar Vanka <sivasri@codeaurora.org>
parent 9cc9f7b8
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -702,6 +702,24 @@ static struct msm_rpm_driver_data msm_rpm_data = {
	.smd_open = COMPLETION_INITIALIZER(msm_rpm_data.smd_open),
};

static int trysend_count = 20;
module_param(trysend_count, int, 0664);
static int msm_rpm_trysend_smd_buffer(char *buf, uint32_t size)
{
	int ret;
	int count = 0;

	do {
		ret = rpmsg_trysend(rpm->rpm_channel, buf, size);
		if (!ret)
			break;
		udelay(10);
		count++;
	} while (count < trysend_count);

	return ret;
}

static int msm_rpm_flush_requests(bool print)
{
	struct rb_node *t;
@@ -719,7 +737,7 @@ static int msm_rpm_flush_requests(bool print)

		set_msg_id(s->buf, msm_rpm_get_next_msg_id());

		ret = rpmsg_send(rpm->rpm_channel, s->buf, get_buf_len(s->buf));
		ret = msm_rpm_trysend_smd_buffer(s->buf, get_buf_len(s->buf));

		WARN_ON(ret != 0);
		trace_rpm_smd_send_sleep_set(get_msg_id(s->buf), type, id);