2
0

Correct data race in GpuAgent::GetXgmiBlit.

Threads may race against xgmi_peer_list_ when dynamically assigning
peers to sdma engines.

Change-Id: I300c10f0cfa0ff7d6a5515364070a0895e2f4644


[ROCm/ROCR-Runtime commit: bb4dfbba1e]
Este cometimento está contido em:
Sean Keely
2021-07-29 17:39:13 -05:00
ascendente b10954c185
cometimento dd7c30ec6b
2 ficheiros modificados com 5 adições e 0 eliminações
@@ -400,6 +400,9 @@ class GpuAgent : public GpuAgentInt {
// List of agents connected via xGMI
std::vector<const core::Agent*> xgmi_peer_list_;
// Protects xgmi_peer_list_
KernelMutex xgmi_peer_list_lock_;
// @brief AQL queues for cache management and blit compute usage.
enum QueueEnum {
QueueUtility, // Cache management and device to {host,device} blit compute
@@ -1483,6 +1483,8 @@ lazy_ptr<core::Blit>& GpuAgent::GetXgmiBlit(const core::Agent& dst_agent) {
uint32_t xgmi_engine_cnt = properties_.NumSdmaXgmiEngines;
assert((xgmi_engine_cnt > 0) && ("Illegal condition, should not happen"));
ScopedAcquire<KernelMutex> lock(&xgmi_peer_list_lock_);
for (uint32_t idx = 0; idx < xgmi_peer_list_.size(); idx++) {
uint64_t dst_handle = dst_agent.public_handle().handle;
uint64_t peer_handle = xgmi_peer_list_[idx]->public_handle().handle;