Files
linux-nvgpu/drivers/gpu/nvgpu/os/posix/bug.c
Nicolas Benech 9934cfdd72 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 <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1920220
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-12 17:35:10 +05:30

62 lines
1.7 KiB
C

/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <nvgpu/log.h>
#include <nvgpu/posix/bug.h>
#include <signal.h>
#include <pthread.h>
static void __dump_stack(unsigned int skip_frames)
{
return;
}
void dump_stack(void)
{
__dump_stack(0);
}
/*
* Ahhh! A bug!
*/
void __bug(const char *fmt, ...)
{
nvgpu_err(NULL, "BUG detected!");
/* Raise a bad system call signal and kill the thread */
(void) raise(SIGSEGV);
pthread_exit(NULL);
}
bool __warn(bool cond, const char *fmt, ...)
{
if (!cond)
goto done;
nvgpu_warn(NULL, "WARNING detected!");
dump_stack();
done:
return cond;
}