From 9934cfdd728cb8aa3e78801a442bcc7a9907b28b Mon Sep 17 00:00:00 2001 From: Nicolas Benech Date: Fri, 5 Oct 2018 12:02:38 -0400 Subject: [PATCH] gpu: nvgpu: posix: Change BUG() to raise signal BUG() was causing a hang which would cause issues in automated tests. Instead now BUG() will raise a signal and kill the thread that called BUG(). JIRA NVGPU-1254 Change-Id: I74a7c74ee3c392a330fdaf49f3e1447f53c2b688 Signed-off-by: Nicolas Benech Reviewed-on: https://git-master.nvidia.com/r/1920220 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/posix/bug.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/nvgpu/os/posix/bug.c b/drivers/gpu/nvgpu/os/posix/bug.c index 64f4a6f63..cf5b36bc1 100644 --- a/drivers/gpu/nvgpu/os/posix/bug.c +++ b/drivers/gpu/nvgpu/os/posix/bug.c @@ -21,17 +21,9 @@ */ #include - #include - -__attribute__ ((noreturn)) -static void __hang(void) -{ - nvgpu_err(NULL, "Hanging!"); - - while (1) - ; -} +#include +#include static void __dump_stack(unsigned int skip_frames) { @@ -50,7 +42,9 @@ void __bug(const char *fmt, ...) { nvgpu_err(NULL, "BUG detected!"); - __hang(); + /* Raise a bad system call signal and kill the thread */ + (void) raise(SIGSEGV); + pthread_exit(NULL); } bool __warn(bool cond, const char *fmt, ...)