tegra: nvadsp: Timeout added on wait for app start

In cold boot stress test, it is observed that adsp OS
hung intermittently(1/276). Due to which
1) app init of adspff is not able to
complete as it does not receive start ack from adsp
2) wdt handler is triggered as adsp is hung for more
than 10 seconds.

When poweroff is issued in such case,
the alsactl save/restore job which is part of shutdown
sequence is hung as its unable to acquire lock held by
host adsp audio driver fn that initiated nvadsp_os_start.

Therefore, timeout is added while waiting for app init.
If app init fails to happen within timeout duration,
error status is received by nvadsp_os_start
which inturn is received by host side adsp audio driver.
This ensures that lock is released in case of adsff_init
failure in nvadsp_os_start function so that shutdown
can proceed without issue.

Bug 3391964

Change-Id: Ieca54fe9dd21bf9de70d781cfaceb5ffe83809ef
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2626892
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Asha Talambedu
2021-11-16 16:42:51 +05:30
committed by Laxman Dewangan
parent bb93b07676
commit f33770d313
2 changed files with 21 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
*
* ADSP OS App management
*
* Copyright (C) 2014-2018, NVIDIA Corporation. All rights reserved.
* Copyright (C) 2014-2021, NVIDIA Corporation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -32,6 +32,7 @@
#include "adsp_shared_struct.h"
#define DYN_APP_EXTN ".elf"
#define ADSP_APP_INIT_TIMEOUT 2000 /* in ms */
/*
* structure to hold the list of app binaries loaded and
@@ -616,7 +617,7 @@ nvadsp_app_info_t __must_check *nvadsp_app_init(nvadsp_app_handle_t handle,
nvadsp_app_info_t *app;
msgq_t *msgq_send;
int *state;
unsigned long flags;
unsigned long flags, ret = 0;
if (IS_ERR_OR_NULL(priv.pdev)) {
pr_err("ADSP Driver is not initialized\n");
@@ -661,7 +662,12 @@ nvadsp_app_info_t __must_check *nvadsp_app_init(nvadsp_app_handle_t handle,
nvadsp_mbox_send(&priv.mbox, 0, NVADSP_MBOX_SMSG, false, 0);
wait_for_completion(&app->wait_for_app_start);
ret = wait_for_completion_timeout(&app->wait_for_app_start,
msecs_to_jiffies(ADSP_APP_INIT_TIMEOUT));
if (!ret) {
delete_app_instance(app);
return NULL;
}
init_completion(&app->wait_for_app_start);
return app;
err: