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 <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2329796
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Rajesh Devaraj
2020-04-16 20:40:54 +05:30
committed by Alex Waterman
parent dd2fb50a1a
commit bfa1736351
2 changed files with 6 additions and 6 deletions

View File

@@ -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.

View File

@@ -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