SWDEV-330307 - Avoid releasing command before last use
The fix for SWDEV-329789 moved down the last use of the a command object pointer in order to prevent a race condition. However, the previous patch did not move down the release of that command. By releasing the command early, another thread could get a command with the same pointer. That second thread could later submit work to the queue using that new command. The first thread could then perform a comparison against the queue's last command using its own now-stale pointer. This could eventually allow the second thread to skip synchornizing on the queue. This would result in host synchronizations completing before their device work was actually complete. Change-Id: I292b7b369743251ceafe453a4c5cae14a6d01046
此提交包含在:
@@ -136,7 +136,6 @@ void HostQueue::finish() {
|
||||
ClPrint(LOG_DEBUG, LOG_CMD, "HW Event not ready, awaiting completion instead");
|
||||
command->awaitCompletion();
|
||||
}
|
||||
command->release();
|
||||
if (IS_HIP) {
|
||||
ScopedLock sl(vdev()->execution());
|
||||
ScopedLock l(lastCmdLock_);
|
||||
@@ -146,6 +145,7 @@ void HostQueue::finish() {
|
||||
lastEnqueueCommand_ = nullptr;
|
||||
}
|
||||
}
|
||||
command->release();
|
||||
ClPrint(LOG_DEBUG, LOG_CMD, "All commands finished");
|
||||
}
|
||||
|
||||
|
||||
新增問題並參考
封鎖使用者