solved.

On Sun, Feb 14, 2016 at 12:26 PM, Gongjin Sun <[email protected]> wrote:

> Hi All,
>
> I'm doing some experiments to observe and understand the multi-level
> access mechanism in gem5.
>
> I understand that gem5 uses the write-allocate at L1 level for the write
> miss. In order to fill the fetched data from other levels, all the regular
> WriteReq (except for WriteInvalidate)'s cmd will be changed into ReadReq or
> ReadExReq at the L1 cache when these write requests are ready to be sent to
> next level. The related code are as follows:
>
>
> *--------------------------------Cache::recvTimingResp----------------------*
> *bool is_fill = !mshr->isForward &&*
> *    (pkt->isRead() || pkt->cmd == MemCmd::UpgradeResp);*
>
> *-----------------------------------------------------------------------------------------*
>
> *---------------------------------Cache::getBusPacket----------------------------*
> * else {*
> *   // block is invalid*
> *   cmd = needsExclusive ? MemCmd::ReadExReq : MemCmd::ReadReq;*
> *}*
>
> *--------------------------------------------------------------------------------------*
>
> But now I want to implement a new access mode: L1 is NOT write-allocate
> for write miss, L2 is write-allocate for write miss. (Doing so is just to
> understand the gem5's cache mechanism and related code more well)
>
> So I made two minor modifications:
> 1 Add a new 'else if" branch below "else if
> (cpu_pkt->isWriteInvalidate())" in *Cache::getBusPacket:*
>
>    *else if (cpu_pkt->cmd==MemCmd::WriteReq && isTopLevel) {*
> *   cmd = cpu_pkt->cmd;*
>
> This change will allow WriteReq to go through L1 and arrive at L2 (just
> L2, then will be changed ReadReq or ReadExReq like the original case)
>
> 2 Add a new 'else if" branch below "else if (pkt->cmd ==
> MemCmd::UpgradeFailResp) {" in Cache::recvTimingResp:
>
>  *else if (pkt->cmd== MemCmd::WriteResp) {*
> *   completion_time += clockEdge(responseLatency) + pkt->payloadDelay;*
>
>  This means that when L1 receives the WriteResp packet from L2, L1 doesn't
> fill data to its cache. Except this, anything else isn't changed.
>
> Unfortunately, after doing so, I got a panic:
>
> panic: Tried to read unmapped address 0x2d2d2d30d46bcd25.
>
> I checked my code again and again. I checked the debuginfo and found this
> WriteReq can be returned correctly. After it returns to cpu, gem5 continued
> to advance instructions, that is, six inst fetch access. The last one looks
> like:
>
> *1284000: system.cpu: Fetch*
> *1284000: system.cpu: Complete ICache Fetch for addr 0*
>
> Then I also used gdb to get the backtrace info:
>
>
> --------------------------------------------------------------------------------------
> #0  0x00007ffff5e7d657 in __GI_raise (sig=sig@entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:55
>
> #1  0x00007ffff5e7ea2a in __GI_abort () at abort.c:89
>
> #2  0x00000000010ae00e in __exit_epilogue (code=-1,
>     func=0x1dae81e <X86ISA::PageFault::invoke(ThreadContext*,
> RefCountingPtr<StaticInst> const&)::__FUNCTION__> "invoke",
>     file=0x1dae60d "build/X86/arch/x86/faults.cc", line=160,
> format=0x1dae6a0 "Tried to %s unmapped address %#x.\n")
>     at build/X86/base/misc.cc:94
>
> #3  0x0000000000d44923 in __exit_message<char const*, unsigned long>
> (prefix=0x1dae62a "panic", code=-1,
>     func=0x1dae81e <X86ISA::PageFault::invoke(ThreadContext*,
> RefCountingPtr<StaticInst> const&)::__FUNCTION__> "invoke",
>     file=0x1dae60d "build/X86/arch/x86/faults.cc", line=160,
> format=0x1dae6a0 "Tried to %s unmapped address %#x.\n")
>     at build/X86/base/misc.hh:81
>
> #4  0x0000000000d4308f in X86ISA::PageFault::invoke (this=0x30c7910,
> tc=0x31ac3d0, inst=...) at build/X86/arch/x86/faults.cc:160
>
> #5  0x0000000000dcef87 in BaseSimpleCPU::advancePC (this=0x3122ad0,
> fault=std::shared_ptr (count 3, weak 0) 0x30c7910)
>     at build/X86/cpu/simple/base.cc:532
>
> #6  0x0000000000dc7308 in TimingSimpleCPU::advanceInst (this=0x3122ad0,
> fault=std::shared_ptr (count 3, weak 0) 0x30c7910)
>     at build/X86/cpu/simple/timing.cc:578
>
> #7  0x0000000000dc5c7b in TimingSimpleCPU::translationFault
> (this=0x3122ad0, fault=std::shared_ptr (count 3, weak 0) 0x30c7910)
>     at build/X86/cpu/simple/timing.cc:331
>
> #8  0x0000000000dc6a24 in TimingSimpleCPU::finishTranslation
> (this=0x3122ad0, state=0x30c7ae0) at build/X86/cpu/simple/timing.cc:497
>
> #9  0x0000000000dcaacd in DataTranslation<TimingSimpleCPU*>::finish
> (this=0x30ce300, fault=std::shared_ptr (count 3, weak 0) 0x30c7910,
>     req=0x30c6aa0, tc=0x31ac3d0, mode=BaseTLB::Read) at
> build/X86/cpu/translation.hh:244
>
> #10 0x0000000000d8223f in X86ISA::TLB::translateTiming (this=0x31109d0,
> req=0x30c6aa0, tc=0x31ac3d0, translation=0x30ce300,
>     mode=BaseTLB::Read) at build/X86/arch/x86/tlb.cc:429
>
> #11 0x0000000000dc6311 in TimingSimpleCPU::readMem (this=0x3122ad0,
> addr=3255307793404251429, data=0x7fffffffcde0 "", size=8, flags=3)
>     at build/X86/cpu/simple/timing.cc:409
>
> #12 0x0000000001d4c8ac in X86ISA::readMemTiming<ExecContext>
> (xc=0x3122c30, traceData=0x0, addr=3255307793404251429,
>     mem=@0x7fffffffcde0: 0, dataSize=8, flags=3) at
> build/X86/arch/x86/memhelpers.hh:46
>
> #13 0x0000000001d3d3f5 in X86ISAInst::LdBig::initiateAcc (this=0x30c7e10,
> xc=0x3122c30, traceData=0x0)
>     at build/X86/arch/x86/generated/exec-ns.cc.inc:19231
>
> #14 0x0000000000dc761a in TimingSimpleCPU::completeIfetch (this=0x3122ad0,
> pkt=0x0) at build/X86/cpu/simple/timing.cc:619
>
> #15 0x0000000000dc6e81 in TimingSimpleCPU::fetch (this=0x3122ad0) at
> build/X86/cpu/simple/timing.cc:537
>
> #16 0x0000000000dc7426 in TimingSimpleCPU::advanceInst (this=0x3122ad0,
> fault=std::shared_ptr (empty) 0x0)
>     at build/X86/cpu/simple/timing.cc:595
>
> #17 0x0000000000dc78ec in TimingSimpleCPU::completeIfetch (this=0x3122ad0,
> pkt=0x30c7860) at build/X86/cpu/simple/timing.cc:653
>
> #18 0x0000000000dc7a1d in TimingSimpleCPU::IcachePort::ITickEvent::process
> (this=0x3122e98) at build/X86/cpu/simple/timing.cc:666
>
> #19 0x0000000000ec139c in EventQueue::serviceOne (this=0x2f897a0) at
> build/X86/sim/eventq.cc:221
>
> ------------------------------------------------------------------------------------------------
>
> I've spent dozens of hours on debugging but still got stuck on this. So
> frustrated... Really hope some experienced guys can help me this. Or tell
> me what I did is wrong because gem5's internal mechanism doesn't allow such
> modifications... I don't know.  Anyway, any ideas or thoughts are very
> appreciated!
>
> Best regards
> gjins
>
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to