mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
nvgpu: pmu: cleanup init thread on destroy
In nvgpu_kill_task_pg_init(), call nvgpu_thread_join() if the init thread is no longer running in order to reclaim thread resources. Bug 2452799 JIRA ESRM-437 Change-Id: Id9c67f689027f00039ac2df226ee9c28ad89dd1d Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1967983 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-misra-checker <svc-misra-checker@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
mobile promotions
parent
d921afd0ce
commit
ebf874c351
@@ -172,6 +172,8 @@ void nvgpu_kill_task_pg_init(struct gk20a *g)
|
|||||||
nvgpu_udelay(2);
|
nvgpu_udelay(2);
|
||||||
} while (nvgpu_timeout_expired_msg(&timeout,
|
} while (nvgpu_timeout_expired_msg(&timeout,
|
||||||
"timeout - waiting PMU state machine thread stop") == 0);
|
"timeout - waiting PMU state machine thread stop") == 0);
|
||||||
|
} else {
|
||||||
|
nvgpu_thread_join(&pmu->pg_init.state_task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,4 +80,13 @@ bool nvgpu_thread_should_stop(struct nvgpu_thread *thread);
|
|||||||
*/
|
*/
|
||||||
bool nvgpu_thread_is_running(struct nvgpu_thread *thread);
|
bool nvgpu_thread_is_running(struct nvgpu_thread *thread);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nvgpu_thread_join - join a thread to reclaim resources
|
||||||
|
* after it has exited
|
||||||
|
*
|
||||||
|
* @thread - thread to join
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nvgpu_thread_join(struct nvgpu_thread *thread);
|
||||||
|
|
||||||
#endif /* NVGPU_THREAD_H */
|
#endif /* NVGPU_THREAD_H */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
|
|
||||||
#include <nvgpu/thread.h>
|
#include <nvgpu/thread.h>
|
||||||
|
#include <nvgpu/timers.h>
|
||||||
|
|
||||||
int nvgpu_thread_proxy(void *threaddata)
|
int nvgpu_thread_proxy(void *threaddata)
|
||||||
{
|
{
|
||||||
@@ -61,3 +62,10 @@ bool nvgpu_thread_is_running(struct nvgpu_thread *thread)
|
|||||||
{
|
{
|
||||||
return ACCESS_ONCE(thread->running);
|
return ACCESS_ONCE(thread->running);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void nvgpu_thread_join(struct nvgpu_thread *thread)
|
||||||
|
{
|
||||||
|
while (ACCESS_ONCE(thread->running)) {
|
||||||
|
nvgpu_msleep(10);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -95,3 +95,8 @@ bool nvgpu_thread_is_running(struct nvgpu_thread *thread)
|
|||||||
{
|
{
|
||||||
return thread->running;
|
return thread->running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nvgpu_thread_join(struct nvgpu_thread *thread)
|
||||||
|
{
|
||||||
|
(void) pthread_join(thread->thread, NULL);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user