mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: posix: cond: add fault injection to timeout
Add fault injection to the function nvgpu_cond_timedwait(). This allows unit tests to test the timeout case when testing code that uses NVGPU_COND_WAIT(). JIRA NVGPU-2224 Change-Id: I90656f29146f90afc08c6d5e0500e68f01a92043 Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2258705 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
dcd1e423b4
commit
b5617a61d9
@@ -234,6 +234,7 @@ nvgpu_cg_slcg_ce2_load_enable
|
||||
nvgpu_cg_init_gr_load_gating_prod
|
||||
nvgpu_cg_elcg_enable_no_wait
|
||||
nvgpu_cg_elcg_disable_no_wait
|
||||
nvgpu_cond_get_fault_injection
|
||||
nvgpu_current_pid
|
||||
nvgpu_current_tid
|
||||
nvgpu_engine_cleanup_sw
|
||||
|
||||
@@ -160,6 +160,13 @@ int nvgpu_cond_timedwait(struct nvgpu_cond *c, unsigned int *ms)
|
||||
s64 t_start_ns, t_ns;
|
||||
struct timespec ts;
|
||||
|
||||
#ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT
|
||||
if (nvgpu_posix_fault_injection_handle_call(
|
||||
nvgpu_cond_get_fault_injection())) {
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*ms == NVGPU_COND_WAIT_TIMEOUT_MAX_MS) {
|
||||
return pthread_cond_wait(&c->cond, &c->mutex.lock.mutex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user