gpu: nvgpu: Stop vfe state change thread during unload

As part of vfe init a thread was created which is not getting
destroyed during de-init causing thread to access invalid memory
which is already freed.

Bug 2461665

Change-Id: I0770c7c6f293c1026a2c86715bdbe93f233e97c0
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1990089
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Antony Clince Alex
2019-01-08 16:08:11 +05:30
committed by mobile promotions
parent 1bfe1c157e
commit 6a31f02a2d
3 changed files with 25 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
/*
* GV100 PERF
*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2019, 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"),
@@ -44,8 +44,11 @@ static int pmu_set_boot_clk_runcb_fn(void *arg)
while (true) {
NVGPU_COND_WAIT_INTERRUPTIBLE(&vfe_init->wq,
(vfe_init->state_change == true), 0);
(vfe_init->state_change ||
nvgpu_thread_should_stop(&vfe_init->state_task)), 0);
if (nvgpu_thread_should_stop(&vfe_init->state_task)) {
break;
}
vfe_init->state_change = false;
(void) memset(&rpc, 0,