diff --git a/src/common/unix/nvidia-push/src/nvidia-push.c b/src/common/unix/nvidia-push/src/nvidia-push.c index 58b3dca8c..74d973eee 100644 --- a/src/common/unix/nvidia-push/src/nvidia-push.c +++ b/src/common/unix/nvidia-push/src/nvidia-push.c @@ -347,6 +347,7 @@ static NvBool nvWriteGpEntry( NvU32 nextGpPut; NvU32 *gpPointer; + NvU64 baseTime, currentTime; const NvU32 entriesNeeded = NV_PUSH_NUM_GPFIFO_ENTRIES_PER_KICKOFF; NvPushDevicePtr pDevice = push_buffer->pDevice; @@ -359,11 +360,21 @@ static NvBool nvWriteGpEntry( nvAssert((nextGpPut % 2) == 0); // Wait for a free entry in the buffer - while (nextGpPut == ReadGpGetOffset(push_buffer)) { + for (baseTime = currentTime = nvPushImportGetMilliSeconds(pDevice); + nextGpPut == ReadGpGetOffset(push_buffer); + currentTime = nvPushImportGetMilliSeconds(pDevice)) { + if (nvPushCheckChannelError(push_buffer)) { nvAssert(!"A channel error occurred in nvWriteGpEntry()"); return FALSE; } + + if (currentTime > (baseTime + NV_PUSH_NOTIFIER_SHORT_TIMEOUT) && + !push_buffer->noTimeout) { + nvPushImportLogError(pDevice, + "Timed out waiting for a free GPFIFO entry."); + return FALSE; + } } gpPointer[0] = gpEntry0; gpPointer[1] = gpEntry1;