Review Board 2.0.15


cpu: Adding AddressMonitor structs for every hardware thread

Review Request #2857 - Created May 28, 2015 and updated

Information
Alexandru Dutu
gem5
default
Reviewers
Default
Changeset 10863:27ededc60d38
---------------------------
cpu: Adding AddressMonitor structs for every hardware thread
This patch builds toward having the ability to mwait on a ThreadContext,
rather then on a CPU core. This is achieved by having a vector of
AddressMonitor structs in BaseCPU.

Quick regressions passed for all ISAs.

Ship it!
Posted (June 1, 2015, 5:54 a.m.)

I had to code this up as well. Everything here looks fine.

For most places I had to convert to be thread-aware, I found using a reference to be cleaner. Didn't hae to append a "[tid]" everywhere.

Example of my current mwait()

bool
BaseCPU::mwait(ThreadID tid, PacketPtr pkt)
{
assert(tid < numThreads);
AddressMonitor &monitor = addressMonitor[tid];

if(monitor.gotWakeup == false) {                                                                                                                                                                                 
    int block_size = cacheLineSize();                                                                                                                                                                            
    uint64_t mask = ~((uint64_t)(block_size - 1));

    assert(pkt->req->hasPaddr());                                                                                                                                                                                
    monitor.pAddr = pkt->getAddr() & mask;                                                                                                                                                                       
    monitor.waiting = true;

    DPRINTF(Mwait,"[tid:%d] mwait called (vAddr=0x%lx, paddr=0x%lx)\n",                                                                                                                                          
            tid, monitor.vAddr, monitor.pAddr);                                                                                                                                                                  
    return true;                                                                                                                                                                                                 
} else {                                                                                                                                                                                                         
    monitor.gotWakeup = false;                                                                                                                                                                                   
    return false;                                                                                                                                                                                                
}

}