My goal is to instrument the region-of-interest of a program in syscall emulation mode. I have already implemented pseudo instructions for full system mode based on this tutorial. It is time consuming though to test everything in FS after I make even a small change. Is there any way to implement the same functionality for syscall mode?
Asked
Active
Viewed 536 times
2
-
Hi vic, pseudo instructions work on SE just like in FS, what else is missing for it to work for you? Also consider the following methods that allow not rebooting every time after rebuilding. Mailing list thread: https://www.mail-archive.com/gem5-users@gem5.org/msg16605.html – Ciro Santilli Jun 10 '19 at 20:23
-
I haven't tried it. I was looking at this comment. http://gedare-csphd.blogspot.com/2013/02/add-pseudo-instruction-to-gem5.html?showComment=1466816628493#c2021664104318252241 – vic Jun 10 '19 at 20:32
-
@CiroSantilli I actually tried it. There doesn't seem to be any difference in the volume of printouts generated. I'm using the Cache, CacheTags and PCache (my own) debug flags. – vic Jun 10 '19 at 21:42
-
I have just tried it out, and I observe that at m5 dumpstats does generate dumps and that `numCycles` increases each time [with this setup](https://github.com/cirosantilli/linux-kernel-module-cheat/tree/038c23729bdea50ed0b6e24cf72d0119645d2b94#m5ops-instructions). Do you reproduce that? If yes, then I recommend that you explain more precisely in your post what stat exactly is not working for you. – Ciro Santilli Jun 11 '19 at 08:32
-
I can't get my microbenchmark to run with gem5. If I execute it normally, I get a "Can't open /dev/mem". If I execute it with sudo, it seems to finish fine. But when I want to execute it with gem5, I get an mmap warning and a segfault. I built my mb like this: 1) gcc -O2 -DM5OP_ADDR=0xFFFF0000 -Ipath/to/include -c gem5_array.cpp -o gem5_array.o 2) gcc gem5_array.o -o gem5_array path/to/m5op_x86.o path/to/m5_mmap.o I don't only want to get the stats for the ROI in the stats file. I'm using some debug flags, so in the output of gem5, I want to see only the printouts from inside the ROI. – vic Jun 12 '19 at 21:10
-
OK, if `/dev/mem` is the problem, make that clear on your posts. Maybe it is simply not implemented in SE, have a look at the source, this part is not hard. It would also be good if you could provide a minimal C program that reproduces it, or a precise open source program that produces the problem, although in this case `busybox devmem` will likely do it: https://stackoverflow.com/questions/12040303/how-to-access-physical-addresses-from-user-space-in-linux/45127890#45127890 – Ciro Santilli Jun 13 '19 at 07:34
-
Ciro is it possible to post a diff of your changes in gem5 for the implementation of pseudo instructions? This is my setup. Microbenchmark: https://filebin.net/cb5jsu1fakpdo163/gem5_array.pdf?t=d6gmvy5e These are the instructions I'm following: https://filebin.net/cb5jsu1fakpdo163/instructions.pdf?t=d6gmvy5e And finally these are the changes (diff): https://filebin.net/cb5jsu1fakpdo163/diff.pdf?t=d6gmvy5e Thanks. – vic Jun 13 '19 at 17:54
-
thanks for posting further details. Please prefer posting short content like this in the question itself, and larger one on somewhere more visible like GitHub gists :-) All I have mentioned in vanilla gem5, but I have only tested in arm. – Ciro Santilli Jun 13 '19 at 19:28
1 Answers
1
So I found what the problem was. You need to remove all mentions of mmap. So in my case it would be removing the include of m5_mmap.h in the microbenchmark and not calling map_m5_mem() first thing in main(). Just call m5_roi_begin() and m5_roi_end() (or however you call your instrumentation functions).
Also in the gem5 x86 makefile (gem5/util/m5/Makefile.x86) remove the
-DM5OP_ADDR=0xFFFF0000
flag and compile again (make -f Makefile.x86). Now when I run the microbenchmark with gem5, I can see when the ROI starts and ends. Everyting else remains the same, as I've posted in a comment above to the question.
Thanks Ciro.

vic
- 359
- 4
- 18