summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include/nvgpu
diff options
context:
space:
mode:
authorAbhiroop Kaginalkar <akaginalkar@nvidia.com>2019-08-16 18:41:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-09-23 12:25:58 -0400
commit99700222a553bc40bd1d1c8a7d430ce2090ecc93 (patch)
treeb55fec5b749d668c55894187f8f34fdcf4cbfe69 /drivers/gpu/nvgpu/include/nvgpu
parentbb47dcf2ab38eb0b0206a2dcb3a84696d17791f2 (diff)
gpu: nvgpu: Fix PMU destroy sequence
A call to exit the PMU state machine/kthread must be prioritized over any other state change. It was possible to set the state as PMU_STATE_EXIT, signal the kthread and overwrite the state before the kthread has had the chance to exit its loop. This may lead to a "lost" signal, resulting in indefinite wait during the destroy sequence. Faulting sequence: 1. pmu_state = PMU_STATE_EXIT in nvgpu_pmu_destroy() 2. cond_signal() 3. pmu_state = PMU_STATE_LOADING_PG_BUF 4. PMU kthread wakes up 5. PMU kthread processes PMU_STATE_LOADING_PG_BUF 6. PMU kthread sleeps 7. nvgpu_pmu_destroy() waits indefinitely This patch adds a sticky flag to indicate PMU_STATE_EXIT, irrespective of any subsequent changes to pmu_state. The PMU PG init kthread may wait on a call to NVGPU_COND_WAIT_INTERRUPTIBLE, which requires a corresponding call to nvgpu_cond_signal_interruptible() as the core kernel code requires this task mask to wake-up an interruptible task. Bug 2658750 Bug 200532122 Change-Id: I61beae80673486f83bf60c703a8af88b066a1c36 Signed-off-by: Abhiroop Kaginalkar <akaginalkar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2177112 (cherry picked from commit afa49fb073a324c49a820e142aaaf80e4656dcc6) Reviewed-on: https://git-master.nvidia.com/r/2190733 Tested-by: Divya Singhatwaria <dsinghatwari@nvidia.com> Reviewed-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/pmu.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmu.h b/drivers/gpu/nvgpu/include/nvgpu/pmu.h
index 00194ec0..dcd49481 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -301,6 +301,7 @@ struct pmu_sequence {
301 301
302struct nvgpu_pg_init { 302struct nvgpu_pg_init {
303 bool state_change; 303 bool state_change;
304 bool state_destroy;
304 struct nvgpu_cond wq; 305 struct nvgpu_cond wq;
305 struct nvgpu_thread state_task; 306 struct nvgpu_thread state_task;
306}; 307};