CheckerCPU: Re-factor CheckerCPU to be compatible with current gem5
Review Request #910 - Created Nov. 23, 2011 and submitted
| Information | |
|---|---|
| Geoffrey Blake | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
| ali, gblack, nate, stever | |
CheckerCPU: Re-factor CheckerCPU to be compatible with current gem5 Brings the CheckerCPU back to a functioning state allowing FS and SE mode checking of the O3CPU. These changes have only been tested with the ARM ISA. Other ISAs will potentially require modification.
Successfully runs gzip in SE mode. Successfully boots linux kernel in FS mode. Works with checkpoints and fast-forwarding. Testing with buggy O3CPUs to test checker's capabilities.
Issue Summary
10
6
3
1
| Description | From | Last Updated | Status |
|---|---|---|---|
| This line is too long. | Gabe Black | Jan. 26, 2012, 5:20 p.m. | Open |
| So is this one. | Gabe Black | Jan. 26, 2012, 5:20 p.m. | Open |
| And this one. | Gabe Black | Jan. 26, 2012, 5:20 p.m. | Open |
| And this one. I'll stop pointing them out, but please fix throughout. | Gabe Black | Jan. 26, 2012, 5:20 p.m. | Open |
| It's not from you, but there's some whitespace at the end of this line. Since you're getting rid of commented ... | Gabe Black | Jan. 26, 2012, 5:20 p.m. | Open |
| This sentence seems to have dropped off half way there. | Gabe Black | Jan. 26, 2012, 5:20 p.m. | Open |
Posted (Nov. 23, 2011, 1:35 p.m.)
When you upload a new review, be sure to update the old one. That way you can see what changed between revisions.
-
src/cpu/base_dyn_inst.hh (Diff revision 1) -
Like I said before, you shouldn't use this instResult mechanism. It's broken and obsolete and needs to be removed all together.
-
src/cpu/o3/thread_context.hh (Diff revision 1) -
These shouldn't be squished all onto one line.
-
src/cpu/thread_context.hh (Diff revision 1) -
I think all of these new functions could be replaced with a getCheckerCPU call on the base CPU class. Then you can get the TLB pointers from it and even factor some of the code that's duplicated for the checker into functions that take a CPU pointer.
-
src/mem/packet.hh (Diff revision 1) -
I still don't see the point of this. The memory system should be taking care of this, and it shouldn't have anything to do with the checker.
Posted (Nov. 25, 2011, 3:40 a.m.)
The changes to the packet class fix a long standing limitation where finding a packet that partially satisfied a request would cause a panic. This code remedies that limitation, although it should be in it's own changeset.
-
src/mem/packet.cc (Diff revision 1) -
This should be a separate change and doesn't need to be protected by a checker ifdef. The code is useful in all cases.
-
src/mem/packet.cc (Diff revision 1) -
Same as before. The comment should be updated to note that the partial read satisfy issue no longer exists.
Posted (Nov. 28, 2011, 2:37 a.m.)
-
src/mem/bus.cc (Diff revision 2) -
Why? This seems odd to me. If it is a response then someone responded during the snooping. If the destination port is the same as the source we have a loop. Why should it not continue if it is the default port? Is this not working around an issue located somewhere else?
Posted (Dec. 3, 2011, 4:57 a.m.)
Nice to see this getting resurrected... thanks, Geoff.
-
build_opts/ARM_wCHECKER_FS (Diff revision 2) -
I'm not too excited about exploding the number of built-in configs further by adding these two files. Just saying USE_CHECKER=1 on the scons command line once (assuming it's sticky) doesn't seem that hard to me.
-
src/cpu/DummyChecker.py (Diff revision 2) -
What's this DummyChecker object for?
-
src/cpu/thread_context.hh (Diff revision 2) -
I agree with Gabe here... you're always doing things like: if (cpu->getCheckerCpuPtr()) { cpu->getCheckerITBPtr()->foo(); cpu->getCheckerDTBPtr()->foo(); } so why don't you just do: CPU *checker = cpu->getCheckerCpuPtr(); if (checker) { checker->getITBPtr()->foo; checker->getDTBPtr()->foo; } which seems just as clear (if not clearer) and avoids the need for these extra methods. -
src/mem/bus.cc (Diff revision 2) -
I agree with Andreas here... from Geoff's description, I think the real bug he's facing is that the ARM config he's using doesn't have a default responder on the I/O bus. There should be something out there that if nothing else sends an error response packet back to the requester. The requester can then decide if it wants to panic and terminate the simulation or not. If blindly accessing the default port when it's not set is causing us to segfault on a null pointer, then we should require that every bus has a default responder at config time. We have at least one dummy/bad address device just for this purpose.
Posted (Dec. 3, 2011, 5:37 a.m.)
-
src/cpu/base_dyn_inst.hh (Diff revision 2) -
Can we find a way to replace all this stuff with a single templated method? I think if you add some helper methods to Result like this: union Result { [...] void set(uint64_t i) { integer = i; } void set(double d) { dbl = d; } void get(uint64_t &i) { i = integer; } void get(double &d) { d = dbl; } } then you could replace these with template <class T> T popResult() { [blah blah] } and maybe clean up some of the other existing code as well.
Posted (Dec. 13, 2011, 5:35 a.m.)
Cleaned up the code in base_dyn_inst.hh to use templates. Cleaned up the code in arch/arm/isa.cc to get the ITB/DTB pointers from the CheckerCPU object. I have implemented a solution for functional accesses that go to the IOBus by adding a "reflect_functional_access" parameter to isa_fake.cc. This parameter allows accesses to pass through if they are detected to be functional via checking if the Packet object can be safely cast to a FunctionalPacket object to identify just functional accesses. I then added this io_device with the reflect param set to the IOBus as a default responder for the ARM setup in configs/common/FSConfig.py. Not sure if this is what is ultimately desired, but it fixes the problem with the Checker's functional accesses without the hack in the bus.cc code. I looked at using the default_range variable as Steve suggested, but saw in bus.cc line 359 that the code would panic if the access did not fit in the default range. Also would like some suggestions as to how to warn on detecting no default responder attached to the IOBus (any bus), should it be in the Python or C++ code?
Posted (Dec. 19, 2011, 5:16 p.m.)
This is converging to where it needs to be. There are style problems thinly scattered throughout so you'll need to fix those, and there are some smaller tweaks I'd like to see. I'm surprised to see indentation issues here and there. You should talk to Ali about setting up vim/emacs to do gem5 style automatically and then you won't have to worry about that. Other more knowledgeable people are already discussing the devices/functional access thing you're doing, so I'll just ignore that.
-
src/arch/arm/isa/insts/misc.isa (Diff revision 3) -
This line is too long. I won't point out the others that are as well, but please fix throughout.
-
src/arch/arm/tlb.cc (Diff revision 3) -
What's this for? I don't see any new code in this file that would need this.
-
src/arch/arm/tlb.cc (Diff revision 3) -
Bad indentation, you don't need the {}s, and you could move it all into the assert. assert(!(timing && functional)); At least fix the indentation, preferably just replace it with this new version. -
src/cpu/BaseCPU.py (Diff revision 3) -
Yeah, this assert always seemed a bit hacky to me.
-
src/cpu/CheckerCPU.py (Diff revision 3) -
What's your reasoning for changing this? Are you worried that this is likely to happen but not signify a real bug? Have you actually seen that happen?
-
src/cpu/DummyChecker.py (Diff revision 3) -
So much copyright for so little code :-)
-
src/cpu/base.cc (Diff revision 3) -
It would be better to move these declarations down to where the variables are used. That way you can also merge the #if blocks.
-
src/cpu/base.cc (Diff revision 3) -
Have you tested how the checker acts when you switch CPUs? It wouldn't be criminal if that isn't working perfectly at this stage since this change already fixing alot, but it would be nice if that worked.
-
src/cpu/base_dyn_inst.hh (Diff revision 3) -
Bad indentation.
-
src/cpu/checker/cpu.cc (Diff revision 3) -
A lot of this could be moved to the initializer list. It's ok to leave it here, though, since this isn't performance sensitive.
-
src/cpu/checker/cpu.cc (Diff revision 3) -
Drop the {}s. -
src/cpu/checker/cpu.cc (Diff revision 3) -
I think you're only indented 3 spaces here instead of 4.
-
src/cpu/checker/cpu.cc (Diff revision 3) -
It's really only going to rot, and it'll be in version control anyway. I'd leave a comment saying you deleted it and just get rid of it.
-
src/cpu/checker/cpu.cc (Diff revision 3) -
Bracket should be on the preceding line.
-
src/cpu/checker/cpu.cc (Diff revision 3) -
No {}s, indentation. -
src/cpu/checker/cpu.cc (Diff revision 3) -
spaces after ,
-
src/cpu/checker/cpu.cc (Diff revision 3) -
Using ?: here makes this if harder to understand. You should declare a temporary right above this if, maybe extraDataOk. Using the ?: there would be ok since that would be simpler to start with.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
No offset involved...
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
It would be better to call this handlePendingInt since it's a more ISA neutral term and is more consistent with the rest of gem5.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
Drop the {}s. -
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
You should declare a temporary which has the inst to check and then have one if and one panic which checks it. That gets rid of the redundancy here.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
This line is gigantic. Wrap it, and/or use a temporary.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
Drop the {}s, result.pop(); on the next line. -
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
ckFault => checkFault. It's not very long and there's no reason to be cryptic.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
Not here you aren't...
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
Delete instead of commenting it out. I know the code you copied it from had this commented out and eventually I want to fix this, but there's no reason to propagate the problem.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
If the checker CPU is going to be able to trace things, it should have a tracer parameter. If not, pass NULL in as the tracer argument to execute. I'm 95% sure that will work, and if not you should be able to tell pretty quickly.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
I'm not sure it makes sense for the checker CPU to recognize PC based events since the main CPU is going to do that. It may, though.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
Bad indentation.
-
src/cpu/checker/cpu_impl.hh (Diff revision 3) -
Could you clarify what you mean here? The PC mapping to an integer register should be handled by the instructions and the decoder, although I can believe there may be subtle side effects. Also, vagarities => vagaries.
-
src/cpu/o3/O3Checker.py (Diff revision 3) -
I remember seeing this line before so I may have already asked, but why are you changing this?
-
src/cpu/o3/commit_impl.hh (Diff revision 3) -
Drop the {}s, and I already mentioned this function's name earlier. -
src/cpu/o3/dyn_inst_impl.hh (Diff revision 3) -
{}s -
src/cpu/o3/fetch_impl.hh (Diff revision 3) -
What are these for? If you added these for a reason please say so, but otherwise be careful not to add dead includes.
-
src/cpu/o3/thread_context_impl.hh (Diff revision 3) -
Drop the {}s. I'll stop pointing these out (and I may have missed some), but please fix throughout.
Posted (Dec. 22, 2011, 4:11 a.m.)
Made requested fixes to style. Some small changes to fix a memory leak induced by adding an extra request object in src/cpu/base_dyn_inst.hh. Implemented a solution for the bus/functional accesses problem by treating accesses that come in from the mem-side port to be "expressSnoops" and have the bus treat these accordingly if the IOCache does happen to forward snoops to a device with coherent memory.
Posted (Jan. 23, 2012, 2:21 a.m.)
Re-posted the diff.
-
src/cpu/checker/cpu.cc (Diff revision 5) -
Related to the question below. Any ideas how to clean this up? This limits an SE run to only 1 core effectively right now.
-
src/cpu/o3/O3CPU.py (Diff revision 5) -
I have a question for Nate or someone familiar with the guts of the python setup code for a simulation. I had to put this array de-reference to get the python to work properly. Without it, the python code complains about an unknown type, even if the workload array is 1 element, as python will try to pass this: [[workload1]]. An array of arrays to the C++ code. How should I fix this?
Posted (Jan. 23, 2012, 4:41 p.m.)
-
src/mem/bus.cc (Diff revision 5) -
This should no longer be needed with the changes done to the functionalAccess in the cache now being able to respect forwardSnoops.
-
src/mem/cache/cache_impl.hh (Diff revision 5) -
This should not be needed surely? If it should not forward snoops then don't forward it?
-
src/mem/cache/cache_impl.hh (Diff revision 5) -
I don't understand why these changes are here. They make me even more confused about what an express snoop is and what it is not. What problem is this aiming to solve?
-
src/mem/packet.hh (Diff revision 5) -
A packet should never be an express snoop and at any point loose that state (at least it messes with my brain and the ability to reason about what type of packets go where).
Posted (Jan. 25, 2012, 7:08 a.m.)
Re-factored patch to compile and work with Andreas's changes that were recently pushed. Will fix the python param code issue with the Checker for SE mode in another patch to come soon.
Posted (Jan. 26, 2012, 5:20 p.m.)
There are only a few small things to fix now, at least as far as I can see.
-
src/arch/arm/isa.cc (Diff revision 7) -
This line is too long.
-
src/arch/arm/isa.cc (Diff revision 7) -
So is this one.
-
src/arch/arm/isa.cc (Diff revision 7) -
And this one.
-
src/arch/arm/isa.cc (Diff revision 7) -
And this one. I'll stop pointing them out, but please fix throughout.
-
src/cpu/checker/cpu.hh (Diff revision 7) -
It's not from you, but there's some whitespace at the end of this line. Since you're getting rid of commented out code, you could get rid of the whitespace too.
-
src/cpu/checker/cpu.cc (Diff revision 7) -
This sentence seems to have dropped off half way there.
Ship It!
