fix unlock bug (#1384)

This commit is contained in:
Matthew Kennedy 2020-04-29 13:42:55 -07:00 committed by GitHub
parent b9c4c3636e
commit 4252ed8d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -65,6 +65,7 @@ static void perfEventImpl(PE event, EPhase phase)
// In addition, if we want to trace lock/unlock events, we can't
// be locking ourselves from the trace functionality.
{
uint32_t prim = __get_PRIMASK();
__disable_irq();
idx = s_nextIdx++;
@ -73,7 +74,10 @@ static void perfEventImpl(PE event, EPhase phase)
s_isTracing = false;
}
__enable_irq();
// Restore previous interrupt state - don't restore if they weren't enabled
if (!prim) {
__enable_irq();
}
}
// We can safely write data out of the lock, our spot is reserved