From 7da4c92f797f721884f44afadc3cc4127b013e0d Mon Sep 17 00:00:00 2001 From: Ansa Ahmed Date: Wed, 24 May 2023 16:24:16 +0530 Subject: [PATCH] Avoid waiting for pending dma invoke in spinlock Currently, spinlock is acquired and wait state is entered for dma_invoke to complete. This scenario leads to watchdog bark for threads waiting to acquire spinlock. This change is to avoid waiting for dma_invoke completion after acquiring spinlock. Change-Id: I9443fd8bfda77194103a871e4ad0295f79cf3034 Signed-off-by: Ansa Ahmed --- dsp/adsprpc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dsp/adsprpc.c b/dsp/adsprpc.c index 3f2dba1445..f18a42f724 100644 --- a/dsp/adsprpc.c +++ b/dsp/adsprpc.c @@ -5782,8 +5782,17 @@ static int fastrpc_file_free(struct fastrpc_file *fl) spin_lock_irqsave(&fl->apps->hlock, irq_flags); is_locked = true; - if (fl->is_dma_invoke_pend) - wait_for_completion(&fl->dma_invoke); + if (!fl->is_dma_invoke_pend) + goto skip_dmainvoke_wait; + is_locked = false; + spin_unlock_irqrestore(&fl->apps->hlock, irq_flags); + wait_for_completion(&fl->dma_invoke); + +skip_dmainvoke_wait: + if (!is_locked) { + spin_lock_irqsave(&fl->apps->hlock, irq_flags); + is_locked = true; + } if (!fl->is_ramdump_pend) goto skip_dump_wait; is_locked = false;