From 6d8700198f8a04c5fd6cb3dd57dfdbb79691012d Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Mon, 11 May 2020 18:50:20 -0700 Subject: [PATCH] Set ttmp11[8] for all memory violation errors In the case where SQ_WAVE_TRAPSTS_XNACK_ERROR_MASK is set, we also need to set the TTMP11_EXCP_RAISED_BIT in ttmp11. If we don't, the debugger may think that the wave is halted at launch (halted without events). Change-Id: I8c19605bbfc145275728de4ad1979d3ba8bb478a [ROCm/ROCR-Runtime commit: 838c6bd6ad49e970de38428865c6f101ba8c3bee] --- .../hsa-runtime/core/inc/amd_gpu_shaders.h | 72 ++++++++++--------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h index 00afa7223c..bd0826fb67 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h @@ -246,20 +246,26 @@ static const unsigned int kCodeTrapHandler9[] = { mExitTrap .excp_raised: + s_bitset1_b32 ttmp11, TTMP11_EXCP_RAISED_BIT + // If memory violation without XNACK error then signal queue error. // XNACK error will be handled by VM interrupt, since it has more information. s_and_b32 ttmp3, ttmp2, (SQ_WAVE_TRAPSTS_MEM_VIOL_MASK | SQ_WAVE_TRAPSTS_XNACK_ERROR_MASK) s_cmp_eq_u32 ttmp3, SQ_WAVE_TRAPSTS_MEM_VIOL_MASK s_mov_b32 ttmp3, SIGNAL_CODE_MEM_VIOL - s_cbranch_scc1 .signal_excp_error + s_cbranch_scc1 .signal_error // If illegal instruction then signal queue error. s_and_b32 ttmp3, ttmp2, SQ_WAVE_TRAPSTS_ILLEGAL_INST_MASK s_mov_b32 ttmp3, SIGNAL_CODE_ILLEGAL_INST - s_cbranch_scc1 .signal_excp_error + s_cbranch_scc1 .signal_error - // Otherwise (memory violation with XNACK error) return to shader. - s_branch .exit_trap + // Otherwise (memory violation with XNACK error) return to shader. Do not + // send a signal as that will cause an interrupt storm. Instead let the + // interrupt generated by the TLB miss cause the kernel to notify ROCr and + // put the queue into an error state. This also ensures the TLB interrupt + // is received which provides information about the page causing the fault. + s_branch .halt_wave .trap_raised: // If debugger trap (s_trap >= 3) then signal debugger. @@ -278,10 +284,6 @@ static const unsigned int kCodeTrapHandler9[] = { .signal_trap_error: s_bitset1_b32 ttmp11, TTMP11_TRAP_RAISED_BIT - s_branch .signal_error - - .signal_excp_error: - s_bitset1_b32 ttmp11, TTMP11_EXCP_RAISED_BIT .signal_error: // FIXME: don't trash ttmp4/ttmp5 when exception handling is unified. @@ -335,7 +337,7 @@ static const unsigned int kCodeTrapHandler9[] = { .exit_trap: mExitTrap */ - 0x92eeff6d, 0x00080010, 0xbf850039, 0xb8eef803, 0x866fff6e, 0x00000900, + 0x92eeff6d, 0x00080010, 0xbf85003a, 0xb8eef803, 0x866fff6e, 0x00000900, 0xbf850029, 0xbf820001, 0xbef71a87, 0xbeee007e, 0xbeef007f, 0xbefe00ff, 0x80000000, 0xbf90000a, 0xbf800007, 0xbf0c9f7e, 0xbf84fffd, 0xbeff006f, 0x867eff7e, 0x00000fff, 0xbeef007e, 0xbefe006e, 0xbeef1a97, 0xbeee007c, @@ -343,18 +345,18 @@ static const unsigned int kCodeTrapHandler9[] = { 0xc0021bb6, 0x00000000, 0xbf8cc07f, 0x866eff6e, 0xffff0000, 0xbf06ff6e, 0xbf810000, 0xbf850002, 0x8778ff78, 0x00002000, 0x8f6e8b77, 0x866eff6e, 0x001f8000, 0xb96ef807, 0x86fe7e7e, 0x86ea6a6a, 0xb978f802, 0xbe801f6c, - 0x866fff6e, 0x10000100, 0xbf06ff6f, 0x00000100, 0xbeef00ff, 0x20000000, - 0xbf850010, 0x866fff6e, 0x00000800, 0xbeef00f4, 0xbf85000c, 0xbf820032, - 0xbf09836e, 0xbf85ffca, 0xbf06826e, 0xbeef00ff, 0x80000000, 0xbf850003, - 0x806c846c, 0x826d806d, 0xbf820029, 0xbef71a87, 0xbf820001, 0xbef71a88, - 0xbef0006f, 0xbefe00ff, 0x80000000, 0xbf90000a, 0xbf800007, 0xbf0c9f7e, - 0xbf84fffd, 0x866eff7e, 0x000003ff, 0x8e6e836e, 0xc0051bbd, 0x0000006e, - 0xbf8cc07f, 0xc0071bb7, 0x000000c0, 0xbf8cc07f, 0xbef10080, 0xc2831c37, - 0x00000008, 0xbf8cc07f, 0x87707170, 0xbf85000e, 0xc0071c37, 0x00000010, - 0xbf8cc07f, 0x86f07070, 0xbf840009, 0xc0031bb7, 0x00000018, 0xbf8cc07f, - 0xc0431bb8, 0x00000000, 0xbf8cc07f, 0xbefc0080, 0xbf800000, 0xbf900001, - 0x8778ff78, 0x00002000, 0x8f6e8b77, 0x866eff6e, 0x001f8000, 0xb96ef807, - 0x86fe7e7e, 0x86ea6a6a, 0xb978f802, 0xbe801f6c, + 0xbef71a88, 0x866fff6e, 0x10000100, 0xbf06ff6f, 0x00000100, 0xbeef00ff, + 0x20000000, 0xbf85000f, 0x866fff6e, 0x00000800, 0xbeef00f4, 0xbf85000b, + 0xbf82002e, 0xbf09836e, 0xbf85ffc9, 0xbf06826e, 0xbeef00ff, 0x80000000, + 0xbf850003, 0x806c846c, 0x826d806d, 0xbf820027, 0xbef71a87, 0xbef0006f, + 0xbefe00ff, 0x80000000, 0xbf90000a, 0xbf800007, 0xbf0c9f7e, 0xbf84fffd, + 0x866eff7e, 0x000003ff, 0x8e6e836e, 0xc0051bbd, 0x0000006e, 0xbf8cc07f, + 0xc0071bb7, 0x000000c0, 0xbf8cc07f, 0xbef10080, 0xc2831c37, 0x00000008, + 0xbf8cc07f, 0x87707170, 0xbf85000e, 0xc0071c37, 0x00000010, 0xbf8cc07f, + 0x86f07070, 0xbf840009, 0xc0031bb7, 0x00000018, 0xbf8cc07f, 0xc0431bb8, + 0x00000000, 0xbf8cc07f, 0xbefc0080, 0xbf800000, 0xbf900001, 0x8778ff78, + 0x00002000, 0x8f6e8b77, 0x866eff6e, 0x001f8000, 0xb96ef807, 0x86fe7e7e, + 0x86ea6a6a, 0xb978f802, 0xbe801f6c, }; static const unsigned int kCodeCopyAligned8[] = { @@ -470,7 +472,7 @@ static const unsigned int kCodeFill10[] = { }; static const unsigned int kCodeTrapHandler10[] = { - 0x93eeff6d, 0x00080010, 0xbf85003d, 0xb96ef803, 0x876fff6e, 0x00000900, + 0x93eeff6d, 0x00080010, 0xbf85003e, 0xb96ef803, 0x876fff6e, 0x00000900, 0xbf85002d, 0xbf820001, 0xbef71d87, 0xbeee037e, 0xbeef037f, 0xbefe03ff, 0x80000000, 0xbf90000a, 0xbf800007, 0xbf0c9f7e, 0xbf84fffd, 0xbeff036f, 0x877eff7e, 0x00000fff, 0xbeef037e, 0xbefe036e, 0xbeef1d97, 0xbeee037c, @@ -478,19 +480,19 @@ static const unsigned int kCodeTrapHandler10[] = { 0xf4001bb6, 0xfa000000, 0xbf8cc07f, 0x876eff6e, 0xffff0000, 0xbf06ff6e, 0xbf810000, 0xbf850002, 0x8878ff78, 0x00002000, 0x906e8977, 0x876fff6e, 0x003f8000, 0x906e8677, 0x876eff6e, 0x02000000, 0x886e6f6e, 0xb9eef807, - 0x87fe7e7e, 0x87ea6a6a, 0xb9f8f802, 0xbe80226c, 0x876fff6e, 0x10000100, - 0xbf06ff6f, 0x00000100, 0xbeef03ff, 0x20000000, 0xbf850010, 0x876fff6e, - 0x00000800, 0xbeef03f4, 0xbf85000c, 0xbf820032, 0xbf09836e, 0xbf85ffc6, - 0xbf06826e, 0xbeef03ff, 0x80000000, 0xbf850003, 0x806c846c, 0x826d806d, - 0xbf820029, 0xbef71d87, 0xbf820001, 0xbef71d88, 0xbef0036f, 0xbefe03ff, - 0x80000000, 0xbf90000a, 0xbf800007, 0xbf0c9f7e, 0xbf84fffd, 0x876eff7e, - 0x000003ff, 0x8f6e836e, 0xf4051bbd, 0xdc000000, 0xbf8cc07f, 0xf4051bb7, - 0xfa0000c0, 0xbf8cc07f, 0xbef10380, 0xf6811c37, 0xfa000008, 0xbf8cc07f, - 0x88707170, 0xbf85000e, 0xf4051c37, 0xfa000010, 0xbf8cc07f, 0x87f07070, - 0xbf840009, 0xf4011bb7, 0xfa000018, 0xbf8cc07f, 0xf4411bb8, 0xfa000000, - 0xbf8cc07f, 0xbefc0380, 0xbf800000, 0xbf900001, 0x8878ff78, 0x00002000, - 0x906e8977, 0x876fff6e, 0x003f8000, 0x906e8677, 0x876eff6e, 0x02000000, - 0x886e6f6e, 0xb9eef807, 0x87fe7e7e, 0x87ea6a6a, 0xb9f8f802, 0xbe80226c, + 0x87fe7e7e, 0x87ea6a6a, 0xb9f8f802, 0xbe80226c, 0xbef71d88, 0x876fff6e, + 0x10000100, 0xbf06ff6f, 0x00000100, 0xbeef03ff, 0x20000000, 0xbf85000f, + 0x876fff6e, 0x00000800, 0xbeef03f4, 0xbf85000b, 0xbf82002e, 0xbf09836e, + 0xbf85ffc5, 0xbf06826e, 0xbeef03ff, 0x80000000, 0xbf850003, 0x806c846c, + 0x826d806d, 0xbf820027, 0xbef71d87, 0xbef0036f, 0xbefe03ff, 0x80000000, + 0xbf90000a, 0xbf800007, 0xbf0c9f7e, 0xbf84fffd, 0x876eff7e, 0x000003ff, + 0x8f6e836e, 0xf4051bbd, 0xdc000000, 0xbf8cc07f, 0xf4051bb7, 0xfa0000c0, + 0xbf8cc07f, 0xbef10380, 0xf6811c37, 0xfa000008, 0xbf8cc07f, 0x88707170, + 0xbf85000e, 0xf4051c37, 0xfa000010, 0xbf8cc07f, 0x87f07070, 0xbf840009, + 0xf4011bb7, 0xfa000018, 0xbf8cc07f, 0xf4411bb8, 0xfa000000, 0xbf8cc07f, + 0xbefc0380, 0xbf800000, 0xbf900001, 0x8878ff78, 0x00002000, 0x906e8977, + 0x876fff6e, 0x003f8000, 0x906e8677, 0x876eff6e, 0x02000000, 0x886e6f6e, + 0xb9eef807, 0x87fe7e7e, 0x87ea6a6a, 0xb9f8f802, 0xbe80226c, }; } // namespace amd