mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: unit: enable signal handler in single thread
Until now, using single thread we disable the signal handler to make it easier to debug crashes. Since we are now using single threading in GVS, it is better to have the signal handler enabled by default. This patch introduces a "-d" argument to explicitly disable the signal handler and thus make local debugging easier. JIRA NVGPU-2975 Change-Id: I35b0fb71990b3fef575242c1bba398a3b0e6facf Signed-off-by: Nicolas Benech <nbenech@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2223662 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> 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>
This commit is contained in:
committed by
Alex Waterman
parent
d22fc21a5c
commit
4523ee2b14
@@ -36,15 +36,14 @@ static struct option core_opts[] = {
|
||||
{ "no-color", 0, NULL, 'C' },
|
||||
{ "nvtest", 0, NULL, 'n' },
|
||||
{ "is-qnx", 0, NULL, 'Q' },
|
||||
|
||||
{ "unit-load-path", 1, NULL, 'L' },
|
||||
{ "num-threads", 1, NULL, 'j' },
|
||||
{ "test-level", 1, NULL, 't' },
|
||||
|
||||
{ "debug", 0, NULL, 'd' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
static const char *core_opts_str = "hvqCnQL:j:t:";
|
||||
static const char *core_opts_str = "hvqCnQL:j:t:d";
|
||||
|
||||
void core_print_help(struct unit_fw *fw)
|
||||
{
|
||||
@@ -73,6 +72,8 @@ void core_print_help(struct unit_fw *fw)
|
||||
" Number of threads to use while running all tests.\n",
|
||||
" -t, --test-level <LEVEL>\n",
|
||||
" Test plan level. 0=L0, 1=L1. default: 1\n",
|
||||
" -d, --debug Disable signal handling to facilitate debug of",
|
||||
" crashes.\n",
|
||||
"\n",
|
||||
"Note: mandatory arguments to long arguments are mandatory for short\n",
|
||||
"arguments as well.\n",
|
||||
@@ -162,6 +163,9 @@ int core_parse_args(struct unit_fw *fw, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
args->debug = true;
|
||||
break;
|
||||
case '?':
|
||||
args->help = true;
|
||||
return -1;
|
||||
|
||||
@@ -191,10 +191,11 @@ int core_exec(struct unit_fw *fw)
|
||||
sem_init(&unit_thread_semaphore, 0, fw->args->thread_count);
|
||||
|
||||
/*
|
||||
* If running single threaded, keep the default SIGSEGV handler to make
|
||||
* interactive debugging easier, otherwise install the custom one.
|
||||
* By default, use a custom signal hanlder to catch faults such as
|
||||
* SIGSEGV. This can be disabled with the -d argument to make it
|
||||
* easier to investigate with a debugger.
|
||||
*/
|
||||
if (fw->args->thread_count > 1) {
|
||||
if (!fw->args->debug) {
|
||||
err = install_thread_error_handler();
|
||||
if (err != 0) {
|
||||
core_msg_color(fw, C_RED,
|
||||
|
||||
Reference in New Issue
Block a user