Prevent accessing packets outside intercept queue
When the intecept queue copies packets from the proxy queue to the
wrapped queue, it should not attempt to copy packets that are outside
the proxy queue. This could happen if the user of the proxy queue
advances the write pointer beyond the number of free slots and the
packet rewriter reduces the number of packets.
Change-Id: Id02f5df8aee0ed7269f4de813731d507cf2126b3
[ROCm/ROCR-Runtime commit: b020f66d39]
This commit is contained in:
@@ -302,6 +302,13 @@ void InterceptQueue::StoreRelaxed(hsa_signal_value_t value) {
|
||||
|
||||
// Loop over valid packets and process.
|
||||
uint64_t end = LoadWriteIndexAcquire();
|
||||
|
||||
// Can only process packets that are occupying slots in the queue buffer. No
|
||||
// need to add a barrier packet to ensure the extra packets are processed as
|
||||
// the producer must ring the doorbell once the extra packets are made valid.
|
||||
if (end > next_packet_ + amd_queue_.hsa_queue.size)
|
||||
end = next_packet_ + amd_queue_.hsa_queue.size;
|
||||
|
||||
uint64_t i = next_packet_;
|
||||
while (i < end) {
|
||||
if (!ring[i & mask].IsValid()) break;
|
||||
|
||||
Reference in New Issue
Block a user