gpu: nvgpu: fix timeout error msg in sync-unmap

Fixed the erroneous timeout message in sync-unmap and corrected the
condition for returning ETIMEDOUT.

In the original codeflow, after waiting for mapped_buffer release,
nvgpu_timeout_expired is called to check whether to return ETIMEDOUT.
However, if there is a delay between the end of the waiting and the
nvgpu_timeout_expired check, ETIMEDOUT is returned regardless if the
mapped_buffer is released with the timeout message printed. This is
an incorrect behavior. This patch fixes it by letting the refcount of
the mapped_buffer be the only source to determine the return value.

Bug 200434475

Change-Id: I8ca170c811da415c24045ab643da26476bc7463c
Signed-off-by: Kyle Guo <kyleg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1945388
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:
Kyle Guo
2018-11-07 17:20:03 -08:00
committed by mobile promotions
parent 86319055f4
commit 25ef9f869b

View File

@@ -1191,7 +1191,7 @@ static int nvgpu_vm_unmap_sync_buffer(struct vm_gk20a *vm,
nvgpu_msleep(10);
}
if (nvgpu_timeout_expired(&timeout) == -ETIMEDOUT) {
if (nvgpu_atomic_read(&mapped_buffer->ref.refcount) > 1) {
ret = -ETIMEDOUT;
}