x86 isa: This patch attempts an implementation at mwait.

Mwait works as follows:
1. A cpu monitors an address of interest (monitor instruction)
2. A cpu calls mwait - this loads the cache line into that cpu's cache.
3. The cpu goes to sleep.
4. When another processor requests write permission for the line, it is
   evicted from the sleeping cpu's cache. This eviction is forwarded to the
   sleeping cpu, which then wakes up.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>
This commit is contained in:
Marc Orr
2014-11-06 05:42:22 -06:00
parent 3947f88d0f
commit bf80734b2c
26 changed files with 381 additions and 16 deletions

View File

@@ -64,11 +64,26 @@
#include "sim/insttracer.hh"
#include "sim/probe/pmu.hh"
#include "sim/system.hh"
#include "debug/Mwait.hh"
class BaseCPU;
struct BaseCPUParams;
class CheckerCPU;
class ThreadContext;
struct AddressMonitor
{
AddressMonitor();
bool doMonitor(PacketPtr pkt);
bool armed;
Addr vAddr;
Addr pAddr;
uint64_t val;
bool waiting; // 0=normal, 1=mwaiting
bool gotWakeup;
};
class CPUProgressEvent : public Event
{
protected:
@@ -536,6 +551,16 @@ class BaseCPU : public MemObject
Stats::Scalar numCycles;
Stats::Scalar numWorkItemsStarted;
Stats::Scalar numWorkItemsCompleted;
private:
AddressMonitor addressMonitor;
public:
void armMonitor(Addr address);
bool mwait(PacketPtr pkt);
void mwaitAtomic(ThreadContext *tc, TheISA::TLB *dtb);
AddressMonitor *getCpuAddrMonitor() { return &addressMonitor; }
void atomicNotify(Addr address);
};
#endif // THE_ISA == NULL_ISA