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: Prasadarao Durvasula <pdurvasu@codeaurora.org> Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
This commit is contained in:
parent
42c4658522
commit
c26e58ce77
@ -702,6 +702,24 @@ static struct msm_rpm_driver_data msm_rpm_data = {
|
|||||||
.smd_open = COMPLETION_INITIALIZER(msm_rpm_data.smd_open),
|
.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)
|
static int msm_rpm_flush_requests(bool print)
|
||||||
{
|
{
|
||||||
struct rb_node *t;
|
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());
|
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);
|
WARN_ON(ret != 0);
|
||||||
trace_rpm_smd_send_sleep_set(get_msg_id(s->buf), type, id);
|
trace_rpm_smd_send_sleep_set(get_msg_id(s->buf), type, id);
|
||||||
|
Loading…
Reference in New Issue
Block a user