From ed74f973da7bef5a3c9b57e2b92999954d8a0d37 Mon Sep 17 00:00:00 2001 From: Chaitanya Pratapa Date: Mon, 20 Jul 2020 22:43:31 -0700 Subject: [PATCH] msm: ipa: Fix holb event log handling When we get a bad peripheral event from uC when there is a pending HOLB ADD/DEL command response from uC we will run into a deadlock if we try to acquire mutex as part of event log. Make a change to remove mutex lock when logging the events. Change-Id: I60ca3ecc4fe4d090278f745bdf2bb9e1bd09ca60 Signed-off-by: Chaitanya Pratapa --- drivers/platform/msm/ipa/ipa_v3/ipa_uc_holb_monitor.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_holb_monitor.c b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_holb_monitor.c index 2c4ab69bf3e3a..7fe800d57ea57 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_holb_monitor.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_holb_monitor.c @@ -218,11 +218,17 @@ void ipa3_uc_holb_event_log(uint16_t gsi_ch, bool enable, if (!ipa3_ctx->uc_ctx.ipa_use_uc_holb_monitor) return; - mutex_lock(&ipa3_ctx->uc_ctx.holb_monitor.uc_holb_lock); + /* HOLB client indexes are reused when a peripheral is + * disconnected and connected back. And so there is no + * need to acquire the lock here as we get the events from + * uC only after a channel is connected atleast once. Also + * if we acquire a lock here we will run into a deadlock + * as we can get uC holb events and a response to add/delete + * commands at the same time. + */ client_idx = ipa3_get_holb_client_idx_by_ch(gsi_ch); if (client_idx == -EINVAL) { IPAERR("Invalid client with GSI chan %d\n", gsi_ch); - mutex_unlock(&ipa3_ctx->uc_ctx.holb_monitor.uc_holb_lock); return; } holb_client = &(ipa3_ctx->uc_ctx.holb_monitor.client[client_idx]); @@ -237,5 +243,4 @@ void ipa3_uc_holb_event_log(uint16_t gsi_ch, bool enable, holb_client->disable_cnt++; holb_client->current_idx = (holb_client->current_idx + 1) % IPA_HOLB_EVENT_LOG_MAX; - mutex_unlock(&ipa3_ctx->uc_ctx.holb_monitor.uc_holb_lock); }