[gem5-users] L1 load misses
Hello all, I’m simulating a single core system with Ruby, using the MESI_Two_Level protocol. I need to measure the number of L1 load misses. To do so, I’m summing up these two statistics: system.ruby.L1Cache_Controller.NP.Load system.ruby.L1Cache_Controller.I.Load I would expect the resulting sum to give me the number of load requests that miss in the L1. However, I’m seeing some confusing behaviour that isn’t what I expect, so I’m trying to figure out what’s going on. a) Does anyone where the two stats above are generated? MESI_Two_Level-L1cache.sm doesn’t seem to be generating these stats, nor can I find any reference to them in the C++ code… b) I just wanted to confirm that this is in fact the correct way to measure the number of L1 load misses? Thanks, Farhad ___ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-users] Re: A puzzle about how TLB is emulated
Hello, As far as I know, TLB misses are not modeled in SE mode at all. Cheers, Jason On Thu, Apr 22, 2021 at 12:50 PM Θοδωρής Τροχάτος via gem5-users < gem5-users@gem5.org> wrote: > Hi Jason! Thanks for the info! > > Do you know what is happening when there is a TLB miss in SE mode? > Is the latency of a TLB miss modeled in some way in SE? > ___ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-le...@gem5.org > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s > ___ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-users] Re: A puzzle about how TLB is emulated
Hi Jason! Thanks for the info! Do you know what is happening when there is a TLB miss in SE mode? Is the latency of a TLB miss modeled in some way in SE? ___ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-users] Re: A puzzle about how TLB is emulated
Hi Leon, I believe you're correct. When there is a TLB hit, it's up to the *CPU model* to model the latency of the TLB access. I think this implementation was designed this way to give flexibility to the CPU models. Since the TLB is deeply embedded in the pipeline, we wouldn't want to always have a 1 cycle latency for the TLB. On the other hand, when there is a miss (in FS mode), the page table walker will model the correct delay. Cheers, Jason On Wed, Apr 21, 2021 at 6:38 AM Leon Zhao via gem5-users < gem5-users@gem5.org> wrote: > Hi all, > > While I'm doing some research about how TLB is emulated in gem5 the other > day, I noticed that TLB costs no ticks, which is quite unusual. > I tried printing current tick before and after (xxx is where I set in my > print declaration): > (1) src/cpu/o3/lsq_impl.hh > void LSQ::LSQRequest::sendFragmentToTranslation(int i) { > xxx > the original function body > xxx > } > (2) src/cpu/o3/fetch_impl.hh > DefaultFetch::finishTranslation(const Fault , const > RequestPtr _req) { > ... > xxx > if (fault == NoFault) { > > fetchedCacheLines++; > xxx > ... > } > ... > } > > However, in both cases, both print functions printed the same tick number > (starting from the very beginning). Is this normal or I found the wrong > places to implant printf's or there's some misunderstanding about my > perspective? > > Here is a sample of what's left on my console: > > !>> TLB starts @ tick=86592000 > !>> TLB ends @ tick=86592000 > !>> TLB starts @ tick=86593000 > !>> TLB ends @ tick=86593000 > !>> TLB starts @ tick=86597000 > !>> TLB ends @ tick=86597000 > > Any pointers would do. Thanks in advance. > ___ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-le...@gem5.org > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s > ___ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-users] Re: How to measure how many ticks a particular part of process costs?
Hi Leon, This is exactly what gem5's region of interest (ROI) markers are for. You can use these "special instructions" as either magic instructions (using unused opcodes in the ISA) or as memory-mapped IO (useful for KVM CPUs). You can embed these markers in your program by calling the m5ops functions. See http://www.gem5.org/documentation/general_docs/m5ops/ for the documentation. Once your program has been annotated, you can modify the gem5 runscript file by adding "system.work_begin_exit_count = 1" or "system.exit_on_work_items = True" (not sure if these are exactly the right parameters) which will cause the simulation to exit when the ROI begins. At that point, in your runscript you can programmatically choose what to do (e.g., drop a checkpoint, reset stats, dump stats, etc.). See the parsec run script as an example: https://gem5.googlesource.com/public/gem5-resources/+/refs/heads/stable/src/parsec/configs/run_parsec.py#115 Cheers, Jason On Thu, Apr 22, 2021 at 7:33 AM Leon Zhao via gem5-users < gem5-users@gem5.org> wrote: > Hi all, > I've been wondering if there's a way to measure how many ticks a > particular part of process costs. I usually do this by hedging code blocks > around with printf's that contain curTick() and then observing the output. > But other than that, perhaps a better way exists? (ticks only, ie not > pertaining to milliseconds or any other time unit) > > Thanks in advance. > ___ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-le...@gem5.org > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s > ___ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-users] How to measure how many ticks a particular part of process costs?
Hi all, I've been wondering if there's a way to measure how many ticks a particular part of process costs. I usually do this by hedging code blocks around with printf's that contain curTick() and then observing the output. But other than that, perhaps a better way exists? (ticks only, ie not pertaining to milliseconds or any other time unit) Thanks in advance. ___ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-users] 答复: How to debug a program in GEM5 FS mode.
Thank you very much, Boris. Let me have a try with it. -邮件原件- 发件人: Boris Shingarov [mailto:shinga...@labware.com] 发送时间: 2021年4月22日 15:13 收件人: gem5 users mailing list 抄送: Liyichao 主题: Re: How to debug a program in GEM5 FS mode. Liyichao, > It is pretty if you would like to give some use guidance or an example with > this patch. If your question is, "How do I apply the patch", first you need to fetch it to your local Git clone: git fetch https://gem5.googlesource.com/public/gem5 refs/changes/85/44685/3 and then switch to the new branch with it: git checkout -b change-44685 FETCH_HEAD Now you can build it whatever way you normally do it. Just for one example (assuming ARM, obviously yours can be different): $ scons build/ARM/gem5.debug If your question is, how to start using it, well suppose you have this very simple buggy program demo.c: int *x; int g(void) { return *x; } int f(void) { return g() + 1; } int _start() { x = (int*) 1; return f(); } For our example of ARM, compile it like so: $ arm-linux-gnueabi-gcc -O0 -ggdb -c demo.c $ arm-linux-gnueabi-ld -static -o demo demo.o Now, supposing your gem5 directory is pointed to by $G5DIR, start gem5: $G5DIR/build/ARM/gem5.debug $G5DIR/configs/example/se.py -c demo --wait-gdb=1 This is going to block, waiting for a connection on port 7000. In another terminal start GDB, load the binary program and connect to gem5: $ gdb GNU gdb (GDB) 11.0.50.20210225-git Copyright (C) 2021 Free Software Foundation, Inc. ... (gdb) file demo Reading symbols from demo... (gdb) target remote localhost:7000 Remote debugging using localhost:7000 _start () at demo.c:4 4 int _start() { Now it's sitting at the first instruciton; if you try to continue it will nicely tell you where the SIGSEGV is: (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x000100a4 in g () at demo.c:2 2 int g(void) { return *x; } (gdb) bt #0 0x000100a4 in g () at demo.c:2 #1 0x000100c8 in f () at demo.c:3 #2 0x000100f0 in _start () at demo.c:6 Obviously other debuggers work well with this, I gave the example of GDB simply because that's standard reference, but the only limit here is your imagination. I use my own custom debugger I wrote for my [admittedly weird] needs (github://shingarov/SmallRSP if you are curious), a lot of people like Eclipse, etc etc. Hope this helps. Boris -"Liyichao via gem5-users" wrote: - To: "Boris Shingarov" , "gem5 users mailing list" From: "Liyichao via gem5-users" Date: 04/21/2021 04:42AM Cc: "Gabe Black" , "Liyichao" Subject: [gem5-users] : Re: How to debug a program in GEM5 FS mode. Thank for reply, I will try to use it. It is pretty if you would like to give some use guidance or an example with this patch. -- : Boris Shingarov [mailto:shinga...@labware.com] : 2021421 16:39 : gem5 users mailing list : Liyichao ; Gabe Black : Re: [gem5-users] Re: How to debug a program in GEM5 FS mode. Liyichao, In fact, our group have been using that change since at least 2014 and it holds up in pretty complex debugging scenarios. I hope it will be merged soon. I would be really interested to hear whether it will help in your scenario. Boris -"Gabe Black via gem5-users" wrote: - To: "Liyichao" From: "Gabe Black via gem5-users" Date: 04/21/2021 02:27AM Cc: "gem5 users mailing list" , "Gabe Black" Subject: [gem5-users] Re: How to debug a program in GEM5 FS mode. Yeah, I don't think gdb in SE mode handles page faults well, but there was actually a change proposed very recently which should help improve that. You can probably cherry-pick that change locally if you want to try it out. https://urldefense.proofpoint.com/v2/url?u=https-3A__gem5-2Dreview.googlesource.com_c_public_gem5_-2B_44685=DwIGaQ=sPZ6DeHLiehUHQWKIrsNwWp3t7snrE-az24ztT0w7Jc=ecC5uu6ubGhPt6qQ8xWcSQh1QUJ8B1-CG4B9kRM0nd4=xGCMssfB_BUGfSEEKV79FCUDjr9ITBsAG0uN2ZjHsFc=-MUfR7cD0QU9XSD39_UGYJxOY87eIk_--U4M9pAaCP8= Gabe On Tue, Apr 20, 2021 at 11:16 PM Liyichao wrote: Thanks Gabe. I think run gdb inside gem5 is of course a better method but slow speed. In se modeI also have tried itbut my program in se mode has a page fault panic before segment fault.I think se mode cannot process page fault. charlie Mobile+86-15858232899 Emailliyic...@huawei.com Gabe Black gem5 users mailing list Liyichao Re: [gem5-users] How to debug a program in GEM5 FS mode. 2021-04-21 14:06:58 Hello, Liyichao. While gdb debugging in gem5 is a great tool, it's a bit limited as far as the sort of debugging you're talking about. It can see the CPU state when you're in user space programs, but it doesn't understand that different user space programs are different things, or know how to look up their symbols, etc. It's intended primarily for debugging the kernel, since that's frankly a more tractable problem. It would be possible to extend that support to give it more
[gem5-users] Re: How to debug a program in GEM5 FS mode.
Liyichao, > It is pretty if you would like to give some use guidance or an example with > this patch. If your question is, "How do I apply the patch", first you need to fetch it to your local Git clone: git fetch https://gem5.googlesource.com/public/gem5 refs/changes/85/44685/3 and then switch to the new branch with it: git checkout -b change-44685 FETCH_HEAD Now you can build it whatever way you normally do it. Just for one example (assuming ARM, obviously yours can be different): $ scons build/ARM/gem5.debug If your question is, how to start using it, well suppose you have this very simple buggy program demo.c: int *x; int g(void) { return *x; } int f(void) { return g() + 1; } int _start() { x = (int*) 1; return f(); } For our example of ARM, compile it like so: $ arm-linux-gnueabi-gcc -O0 -ggdb -c demo.c $ arm-linux-gnueabi-ld -static -o demo demo.o Now, supposing your gem5 directory is pointed to by $G5DIR, start gem5: $G5DIR/build/ARM/gem5.debug $G5DIR/configs/example/se.py -c demo --wait-gdb=1 This is going to block, waiting for a connection on port 7000. In another terminal start GDB, load the binary program and connect to gem5: $ gdb GNU gdb (GDB) 11.0.50.20210225-git Copyright (C) 2021 Free Software Foundation, Inc. ... (gdb) file demo Reading symbols from demo... (gdb) target remote localhost:7000 Remote debugging using localhost:7000 _start () at demo.c:4 4 int _start() { Now it's sitting at the first instruciton; if you try to continue it will nicely tell you where the SIGSEGV is: (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x000100a4 in g () at demo.c:2 2 int g(void) { return *x; } (gdb) bt #0 0x000100a4 in g () at demo.c:2 #1 0x000100c8 in f () at demo.c:3 #2 0x000100f0 in _start () at demo.c:6 Obviously other debuggers work well with this, I gave the example of GDB simply because that's standard reference, but the only limit here is your imagination. I use my own custom debugger I wrote for my [admittedly weird] needs (github://shingarov/SmallRSP if you are curious), a lot of people like Eclipse, etc etc. Hope this helps. Boris -"Liyichao via gem5-users" wrote: - To: "Boris Shingarov" , "gem5 users mailing list" From: "Liyichao via gem5-users" Date: 04/21/2021 04:42AM Cc: "Gabe Black" , "Liyichao" Subject: [gem5-users] : Re: How to debug a program in GEM5 FS mode. Thank for reply, I will try to use it. It is pretty if you would like to give some use guidance or an example with this patch. -- : Boris Shingarov [mailto:shinga...@labware.com] : 2021421 16:39 : gem5 users mailing list : Liyichao ; Gabe Black : Re: [gem5-users] Re: How to debug a program in GEM5 FS mode. Liyichao, In fact, our group have been using that change since at least 2014 and it holds up in pretty complex debugging scenarios. I hope it will be merged soon. I would be really interested to hear whether it will help in your scenario. Boris -"Gabe Black via gem5-users" wrote: - To: "Liyichao" From: "Gabe Black via gem5-users" Date: 04/21/2021 02:27AM Cc: "gem5 users mailing list" , "Gabe Black" Subject: [gem5-users] Re: How to debug a program in GEM5 FS mode. Yeah, I don't think gdb in SE mode handles page faults well, but there was actually a change proposed very recently which should help improve that. You can probably cherry-pick that change locally if you want to try it out. https://urldefense.proofpoint.com/v2/url?u=https-3A__gem5-2Dreview.googlesource.com_c_public_gem5_-2B_44685=DwIGaQ=sPZ6DeHLiehUHQWKIrsNwWp3t7snrE-az24ztT0w7Jc=ecC5uu6ubGhPt6qQ8xWcSQh1QUJ8B1-CG4B9kRM0nd4=xGCMssfB_BUGfSEEKV79FCUDjr9ITBsAG0uN2ZjHsFc=-MUfR7cD0QU9XSD39_UGYJxOY87eIk_--U4M9pAaCP8= Gabe On Tue, Apr 20, 2021 at 11:16 PM Liyichao wrote: Thanks Gabe. I think run gdb inside gem5 is of course a better method but slow speed. In se modeI also have tried itbut my program in se mode has a page fault panic before segment fault.I think se mode cannot process page fault. charlie Mobile+86-15858232899 Emailliyic...@huawei.com Gabe Black gem5 users mailing list Liyichao Re: [gem5-users] How to debug a program in GEM5 FS mode. 2021-04-21 14:06:58 Hello, Liyichao. While gdb debugging in gem5 is a great tool, it's a bit limited as far as the sort of debugging you're talking about. It can see the CPU state when you're in user space programs, but it doesn't understand that different user space programs are different things, or know how to look up their symbols, etc. It's intended primarily for debugging the kernel, since that's frankly a more tractable problem. It would be possible to extend that support to give it more insight into what's going on inside the kernel so it can do more in that regard, and while I'd like to do that at some point, that's not anything that will happen soon. If you want to debug a user space program inside gem5, I think your best