gpu: nvgpu: uniform approach for both quiesce state exit and BUG()

- We are using exit() API to exit the process when gpu goes to
  quiesce state, but MISRA not allowing to use exit() API.

JIRA NVGPU-7056

Signed-off-by: srajum <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2588005
(cherry picked from commit 219c172da5b6ae330121009765f7eb090b87e054)
Change-Id: Id5b927693cc684931bd4aa56e66543b673d0c493
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2674411
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
srajum
2021-09-02 16:18:01 +05:30
committed by mobile promotions
parent ee670a0afd
commit ad74b20cca
4 changed files with 14 additions and 10 deletions

View File

@@ -116,7 +116,7 @@ static int nvgpu_sw_quiesce_thread(void *data)
nvgpu_disable_irqs(g);
nvgpu_channel_sw_quiesce(g);
nvgpu_bug_exit(1);
nvgpu_bug_exit();
done:
nvgpu_log_info(g, "done");

View File

@@ -110,7 +110,7 @@ nvgpu_bug_cb_from_node(struct nvgpu_list_node *node)
};
#ifdef __KERNEL__
static inline void nvgpu_bug_exit(int status) { }
static inline void nvgpu_bug_exit(void) { }
static inline void nvgpu_bug_register_cb(struct nvgpu_bug_cb *cb) { }
static inline void nvgpu_bug_unregister_cb(struct nvgpu_bug_cb *cb) { }
#endif

View File

@@ -147,12 +147,10 @@ struct nvgpu_bug_cb;
* @brief Exit current process
*
* This function is used during the handling of a bug to exit the calling
* program. Uses the library function #exit with \a status as parameter.
* Function does not perform any validation of the parameter.
*
* @param status [in] Exit status to be used for the program.
* program, a SIGSEGV is raised using library function #raise to terminate
* the process.
*/
void nvgpu_bug_exit(int status);
void nvgpu_bug_exit(void);
/**
* @brief Register callback to be invoked on BUG()

View File

@@ -101,12 +101,18 @@ static void nvgpu_bug_init(void)
}
#endif
void nvgpu_bug_exit(int status)
void nvgpu_bug_exit(void)
{
(void)status;
#ifndef __NVGPU_UNIT_TEST__
int err;
nvgpu_err(NULL, "SW quiesce done. Exiting.");
exit(status);
while ((err = raise(SIGSEGV)) != 0) {
/*
* Make sure that SIGSEGV signal is raised.
*/
}
pthread_exit(NULL);
#endif
}