Fix bugs due to interaction between SEV instructions and O3 pipeline
SEV instructions were originally implemented to cause asynchronous squashes via the generateTCSquash() function in the O3 pipeline when updating the SEV_MAILBOX miscReg. This caused race conditions between CPUs in an MP system that would lead to a pipeline either going inactive indefinitely or not being able to commit squashed instructions. Fixed SEV instructions to behave like interrupts and cause synchronous sqaushes inside the pipeline, eliminating the race conditions. Also fixed up the semantics of the WFE instruction to behave as documented in the ARMv7 ISA description to not sleep if SEV_MAILBOX=1 or unmasked interrupts are pending.
This commit is contained in:
@@ -505,6 +505,7 @@ DefaultCommit<Impl>::generateTrapEvent(ThreadID tid)
|
||||
|
||||
cpu->schedule(trap, curTick() + trapLatency);
|
||||
trapInFlight[tid] = true;
|
||||
thread[tid]->trapPending = true;
|
||||
}
|
||||
|
||||
template <class Impl>
|
||||
|
||||
@@ -184,9 +184,19 @@ class FullO3CPU : public BaseO3CPU
|
||||
if (activateThreadEvent[tid].squashed())
|
||||
reschedule(activateThreadEvent[tid],
|
||||
nextCycle(curTick() + ticks(delay)));
|
||||
else if (!activateThreadEvent[tid].scheduled())
|
||||
schedule(activateThreadEvent[tid],
|
||||
nextCycle(curTick() + ticks(delay)));
|
||||
else if (!activateThreadEvent[tid].scheduled()) {
|
||||
Tick when = nextCycle(curTick() + ticks(delay));
|
||||
|
||||
// Check if the deallocateEvent is also scheduled, and make
|
||||
// sure they do not happen at same time causing a sleep that
|
||||
// is never woken from.
|
||||
if (deallocateContextEvent[tid].scheduled() &&
|
||||
deallocateContextEvent[tid].when() == when) {
|
||||
when++;
|
||||
}
|
||||
|
||||
schedule(activateThreadEvent[tid], when);
|
||||
}
|
||||
}
|
||||
|
||||
/** Unschedule actiavte thread event, regardless of its current state. */
|
||||
|
||||
@@ -351,8 +351,7 @@ O3ThreadContext<Impl>::setMiscRegNoEffect(int misc_reg, const MiscReg &val)
|
||||
|
||||
template <class Impl>
|
||||
void
|
||||
O3ThreadContext<Impl>::setMiscReg(int misc_reg,
|
||||
const MiscReg &val)
|
||||
O3ThreadContext<Impl>::setMiscReg(int misc_reg, const MiscReg &val)
|
||||
{
|
||||
cpu->setMiscReg(misc_reg, val, thread->threadId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user