Hello,

doWritebacks will only populate the write queue, which would then be emptied 
when possible. Since you are evicting a multitude of blocks simultaneously, the 
queue will become full and the assertion will trigger.
You will either have to implement a specialized version of doWritebacks() for 
your use-case, or simply assume that these writebacks are done atomically and 
bypass the write queue with a call to doWritebacksAtomic(). Still, the second 
solution would probably not be that simple, because you will likely run into 
the same multi-eviction issue described in the last messages of 
https://gem5-review.googlesource.com/c/public/gem5/+/18209

Regards,
Daniel
   Em quinta-feira, 16 de abril de 2020 16:43:12 GMT+2, 周泰宇 <645505...@qq.com> 
escreveu:  
 
 Hi,DanielThanks for you reply. I’ve try to perform doWritebacks(..) before 
access(..). But It still can’t work for me. Cache will be blocked because 
writeBuffer.isFull() and finally gem5 will report that freeList has no space. 
Error report:gem5.opt: build/X86/mem/cache/write_queue.cc:64: WriteQueueEntry* 
WriteQueue::allocate(Addr, unsigned int, PacketPtr, Tick, Counter): Assertion 
`!freeList.empty()' failed.

My new code is below
BaseCache::recvTimingReq(pkt){  if(trigger){ //some instr will trigger this 
code section
                wb_pkts.clear();
                dirty_blk_count = my_memWriteback(wb_pkts);+            
doWritebacks(wb_pkts, clockEdge(lat+forwardLatency));   }       bool satisfied 
= false;
        {
      PacketList writebacks;
      satisfied = access(pkt, blk, lat, writebacks);
      .....
}

int
BaseCache::my_memWriteback(PacketList &wb_pkts)
{
  int count = 0;
  tags->forEachBlk([this,&count,&wb_pkts](CacheBlk &blk) mutable{
                      if(blk.isDirty()){
                              if(blk.isValid()){
                                      count++;
                              }
                      }
                      my_writebackVisitor(blk,wb_pkts);
                  });
  //printf("NmemWriteback count:%d\n",count);
  return count;
}

BaseCache::my_writebackVisitor(CacheBlk &blk,PacketList &writebacks)
{
  if (blk.isDirty()) {
      assert(blk.isValid());
      RequestPtr request = std::make_shared(
          regenerateBlkAddr(&blk), blkSize, 0, Request::funcMasterId);
      request->taskId(blk.task_id);
      if (blk.isSecure()) {
          request->setFlags(Request::SECURE);
      }

-      //PacketPtr packet = new Packet(request, MemCmd::WriteReq);
+     PacketPtr packet = new Packet(request, MemCmd::WriteReq);//should only 
see writes or clean evicts in allocateWriteBuffer        packet->allocate();
      std::memcpy(packet->getPtr, blk.data, blkSize);
      // packet->dataStatic(blk.data);
      writebacks.push_back(packet);

      blk.status &= ~BlkDirty;
  }
}



  
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to