mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: add support to print caller information
This patch updates nvgpu_assert as macro to print the information about the calling function. Specifically, to print the function name and the line number details. This patch introduces misra violations (misra_c_2012_rule_10_1_violation) in nvgpu_assert(). However, leaving misra violations unfixed has low safety impact since misra violations are coming after fatal error is hit where GPU driver is not expected to be serviceable thereafter. Further, this patch provides debug benefit in quickly finding the function that lead to the exit of NvGPU process. Bug 2964898 Change-Id: Iba85f4a9226742a0bb08b045bcbfa26949bbe746 Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2342086 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Ankur Kishore <ankkishore@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
077a07ff9f
commit
d4d81a6f8e
@@ -47,23 +47,16 @@
|
||||
#define nvgpu_assert(cond) ((void) WARN_ON(!(cond)))
|
||||
#else
|
||||
/*
|
||||
* A static inline for POSIX/QNX/etc so that we can hide the branch in BUG_ON()
|
||||
* from the branch analyzer. This prevents unit testing branch analysis from
|
||||
* marking this as an untested branch everywhere the nvgpu_assert() macro is
|
||||
* used. Similarly for MISRA this hides the messy BUG_ON() macro from users of
|
||||
* this function. This means the MISRA scanner will only trigger 1 issue for
|
||||
* this instead of 1 for every place it's used.
|
||||
*
|
||||
* When this assert fails the function will not return.
|
||||
* When this assert fails, the function will not return.
|
||||
*/
|
||||
static inline void nvgpu_assert(bool cond)
|
||||
{
|
||||
NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 14_4), "Bug 2277532")
|
||||
NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 15_6), "Bug 2277532")
|
||||
BUG_ON(!cond);
|
||||
NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 14_4))
|
||||
NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 15_6))
|
||||
}
|
||||
#define nvgpu_assert(cond) \
|
||||
({ \
|
||||
NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 14_4), "Bug 2277532") \
|
||||
NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 15_6), "Bug 2277532") \
|
||||
BUG_ON(!(cond)); \
|
||||
NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 14_4)) \
|
||||
NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 15_6)) \
|
||||
})
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -169,7 +169,7 @@ done:
|
||||
#endif
|
||||
while ((err = raise(SIGSEGV)) != 0) {
|
||||
/*
|
||||
* Make sure the signal is raised.
|
||||
* Make sure that SIGSEGV signal is raised.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user