media: venus: avoid multiple core dumps

Message ID 1709704406-22501-1-git-send-email-quic_dikshita@quicinc.com (mailing list archive)
State New
Delegated to: Stanimir Varbanov
Headers
Series media: venus: avoid multiple core dumps |

Commit Message

Dikshita Agarwal March 6, 2024, 5:53 a.m. UTC
  Core dump is generated whenever there is system error reported
by firmware. Right now, multiple such dumps are generated if
recovery fails in first attempt, since the sys error handler is
invoked again for every failed recovery.
To avoid it, add conditional check to generate core dump only
once during every system error notification from firmware.

Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
 drivers/media/platform/qcom/venus/core.c | 6 +++++-
 drivers/media/platform/qcom/venus/core.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Bryan O'Donoghue March 6, 2024, 11:39 a.m. UTC | #1
On 06/03/2024 05:53, Dikshita Agarwal wrote:
> Core dump is generated whenever there is system error reported
> by firmware. Right now, multiple such dumps are generated if
> recovery fails in first attempt, since the sys error handler is
> invoked again for every failed recovery.
> To avoid it, add conditional check to generate core dump only
> once during every system error notification from firmware.
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
  
Bryan O'Donoghue March 6, 2024, 11:40 a.m. UTC | #2
On 06/03/2024 05:53, Dikshita Agarwal wrote:
> Core dump is generated whenever there is system error reported
> by firmware. Right now, multiple such dumps are generated if
> recovery fails in first attempt, since the sys error handler is
> invoked again for every failed recovery.
> To avoid it, add conditional check to generate core dump only
> once during every system error notification from firmware.
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---

 From my non-filter mail addr

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
  

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index a712dd4..cc77900 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -67,6 +67,7 @@  static void venus_event_notify(struct venus_core *core, u32 event)
 
 	mutex_lock(&core->lock);
 	set_bit(0, &core->sys_error);
+	set_bit(0, &core->dump_core);
 	list_for_each_entry(inst, &core->instances, list)
 		inst->ops->event_notify(inst, EVT_SESSION_ERROR, NULL);
 	mutex_unlock(&core->lock);
@@ -109,7 +110,10 @@  static void venus_sys_error_handler(struct work_struct *work)
 
 	venus_shutdown(core);
 
-	venus_coredump(core);
+	if (test_bit(0, &core->dump_core)) {
+		venus_coredump(core);
+		clear_bit(0, &core->dump_core);
+	}
 
 	pm_runtime_put_sync(core->dev);
 
diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index 4a63326..c04ea62 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -233,6 +233,7 @@  struct venus_core {
 		u32 minor;
 		u32 rev;
 	} venus_ver;
+	unsigned long dump_core;
 };
 
 struct vdec_controls {