Support intercept queue with multiple packet rewriters
If an intercept queue is created and multiple packet rewriters are
registered, and if one of the rewriters invokes the packet writer
multiple times, then on returning from the packet writer the packet
rewriter index needs to be restored. Otherwise the next packet writer
call will start with an index of 0 which will be decremented and result
in out of bounds vector access.
Change-Id: Icb3f6a81ea04f1f7b91551b974a1f48c4f32db60
[ROCm/ROCR-Runtime commit: b64a845105]
This commit is contained in:
@@ -167,9 +167,13 @@ bool InterceptQueue::HandleAsyncDoorbell(hsa_signal_value_t value, void* arg) {
|
||||
}
|
||||
|
||||
void InterceptQueue::PacketWriter(const void* pkts, uint64_t pkt_count) {
|
||||
Cursor.interceptor_index--;
|
||||
assert(Cursor.interceptor_index > 0 &&
|
||||
"Packet intercept error: final submit handler must not call PacketWritter.\n");
|
||||
--Cursor.interceptor_index;
|
||||
auto& handler = Cursor.queue->interceptors[Cursor.interceptor_index];
|
||||
handler.first(pkts, pkt_count, Cursor.pkt_index, handler.second, PacketWriter);
|
||||
// Restore index as the same rewrite handler may call the PacketWriter more than once.
|
||||
++Cursor.interceptor_index;
|
||||
}
|
||||
|
||||
void InterceptQueue::Submit(const void* pkts, uint64_t pkt_count, uint64_t user_pkt_index,
|
||||
|
||||
Reference in New Issue
Block a user