mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
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:
committed by
mobile promotions
parent
1bfe1c157e
commit
6a31f02a2d
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GV100 PERF
|
* 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
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* 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) {
|
while (true) {
|
||||||
NVGPU_COND_WAIT_INTERRUPTIBLE(&vfe_init->wq,
|
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;
|
vfe_init->state_change = false;
|
||||||
|
|
||||||
(void) memset(&rpc, 0,
|
(void) memset(&rpc, 0,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* GV100 PERF
|
* 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
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* 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) {
|
while (true) {
|
||||||
NVGPU_COND_WAIT_INTERRUPTIBLE(&vfe_init->wq,
|
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;
|
vfe_init->state_change = false;
|
||||||
|
|
||||||
(void) memset(&rpc, 0,
|
(void) memset(&rpc, 0,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -144,8 +144,20 @@ int perf_pmu_init_pmupstate(struct gk20a *g)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vfe_thread_stop_cb(void *data)
|
||||||
|
{
|
||||||
|
struct nvgpu_cond *cond = (struct nvgpu_cond *)data;
|
||||||
|
|
||||||
|
(void)nvgpu_cond_signal(cond);
|
||||||
|
}
|
||||||
|
|
||||||
void perf_pmu_free_pmupstate(struct gk20a *g)
|
void perf_pmu_free_pmupstate(struct gk20a *g)
|
||||||
{
|
{
|
||||||
|
if (nvgpu_thread_is_running(&g->perf_pmu->vfe_init.state_task)) {
|
||||||
|
nvgpu_thread_stop_graceful(&g->perf_pmu->vfe_init.state_task,
|
||||||
|
vfe_thread_stop_cb, &g->perf_pmu->vfe_init.wq);
|
||||||
|
}
|
||||||
|
nvgpu_cond_destroy(&g->perf_pmu->vfe_init.wq);
|
||||||
nvgpu_mutex_destroy(&g->perf_pmu->pstatesobjs.pstate_mutex);
|
nvgpu_mutex_destroy(&g->perf_pmu->pstatesobjs.pstate_mutex);
|
||||||
nvgpu_kfree(g, g->perf_pmu);
|
nvgpu_kfree(g, g->perf_pmu);
|
||||||
g->perf_pmu = NULL;
|
g->perf_pmu = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user