From bfa1736351c20c982971d5b83a6c75726c979f13 Mon Sep 17 00:00:00 2001 From: Rajesh Devaraj Date: Thu, 16 Apr 2020 20:40:54 +0530 Subject: [PATCH] gpu: nvgpu: update bug() to print function name This patch updates BUG() to print the name of the function that triggered it. In addition, it also prints the line number in which BUG() is present in the function that triggered SW quiecese. This will aid in finding the function due to which SW quiesce has been triggered. Bug 2919887 Change-Id: Ie63d9e5f1ba128da54ddc18bd259659d634b60cb Signed-off-by: Rajesh Devaraj Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2329796 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Shashank Singh Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/include/nvgpu/posix/bug.h | 8 ++++---- drivers/gpu/nvgpu/os/posix/bug.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h b/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h index 4cfd7ef7b..00c46168e 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h @@ -33,7 +33,7 @@ * Implementation is specific to OS. For QNX and Posix implementation * refer to nvgpu_posix_bug. */ -#define BUG() nvgpu_posix_bug("") +#define BUG() nvgpu_posix_bug(__func__, __LINE__) /** Macro to handle a buggy code only upon meeting the condition. */ #define BUG_ON(cond) \ @@ -72,12 +72,12 @@ void dump_stack(void); /** * @brief Bug. * - * @param fmt [in] Format of variable argument list. - * @param ... [in] Variable length arguments. + * @param msg [in] Message to be printed in log. + * @param line_no [in] Line number. * * Function to be invoked upon identifying bug in the code. */ -void nvgpu_posix_bug(const char *fmt, ...) __attribute__ ((noreturn)); +void nvgpu_posix_bug(const char *msg, int line_no) __attribute__ ((noreturn)); /** * @brief Issues Warning. diff --git a/drivers/gpu/nvgpu/os/posix/bug.c b/drivers/gpu/nvgpu/os/posix/bug.c index 09ec71d42..807ef8ff1 100644 --- a/drivers/gpu/nvgpu/os/posix/bug.c +++ b/drivers/gpu/nvgpu/os/posix/bug.c @@ -126,12 +126,12 @@ void nvgpu_bug_unregister_cb(struct nvgpu_bug_cb *cb) /* * Ahhh! A bug! */ -void nvgpu_posix_bug(const char *fmt, ...) +void nvgpu_posix_bug(const char *msg, int line_no) { int err; struct nvgpu_bug_cb *cb; - nvgpu_err(NULL, "BUG detected!"); + nvgpu_err(NULL, "%s:%d BUG detected!", msg, line_no); #ifndef __NVGPU_UNIT_TEST__ dump_stack(); #endif