Review Board 2.0.15


Config: Add support for a Self.all proxy object

Review Request #720 - Created May 26, 2011 and submitted

Information
Ali Saidi
gem5
Reviewers
Default
ali, gblack, nate, stever
Config: Add support for a Self.all proxy object

   
Posted (May 26, 2011, 4:29 p.m.)
What does Self.all do? What is it for? You have one use in the change so I have a basic idea, but it would be helpful to know the specifics.
  1. It's similar to Parent.any in that it traverses the object hierarchy and finds all  (as opposed to one) objects that are of a certain type.  As you see from the memories example, the system object can have a pointer to all PhysicalMemory objects that belong to that system. The reason to add something like this, is to have a generic way to prevent speculation from touching I/O. It's possible for a speculative instruction fetch to sneak out of the CPU if the wrong 10 things all happen an once and with this another change can prevent that (will post soon). It's not as simple as just not fetching from non-cacheable memory, since most architectures start their processors in some kind of caches disabled, tlb should only issue non-cachable transaction state.
  2. So if the real machine is using speculative execution in this cache-disable mode, how does it avoid touching I/O locations?
  3. i would guess that when it sees non-cachable memory it only executes one instruction at a time or something, but that would be incredibly difficult to retrofit the o3 model to be able to do.
Posted (May 27, 2011, 1:10 p.m.)



  
src/python/m5/SimObject.py (Diff revision 1)
 
 
Does this do what you want?  It doesn't seem like it would recurse down the tree and find all nodes that match (or does it?)
  1. It works. I've been using it for 2 weeks without issues and all the regressions pass. 
src/python/m5/params.py (Diff revision 1)
 
 
what exactly is this doing?  Also, what happens if val is of length 2 and the first element is a list or tuple?  Seems like an error condition or you're doing something wrong.
src/python/m5/proxy.py (Diff revision 1)
 
 
Seems like Mr Doxygen should be documenting this file a bit better :)

Also, what does Parent.all do?  It'd be nice if you described Self.all and Parent.all in this file.
Posted (May 28, 2011, 2:20 a.m.)



  
src/python/m5/params.py (Diff revision 1)
 
 
The all proxy object is going to return an array which in then going to get turned into [[all,objects,that,match]]. we don't want this.
  1. I understand why this code is necessary, but that doesn't mean I like it ;-).  It seems like an arbitrary hack that could possibly turn around and bite us at some point.
    
    Basically the current code assumes that a proxied VectorParam is a vector of scalar proxies, not a single proxy object that's going to return a vector of things.  This code assumes that if the first element of the unproxied vector is a vector, then you really want that and not the original vector.  Seems a little broad to me.  How about something like:
    
    if len(self) == 1 and isinstance(self[0], AllProxy):
        return self[0].unproxy(base)
    else:
        return [v.unproxy(base) for v in self]
    
src/python/m5/proxy.py (Diff revision 1)
 
 
Parent.all would find every object above you in the hierarchy that matched, although I've never tried it. I only use self.all..

I can add a description for those two. Will you add one for the rest of the proxy objets? :)
  1. After looking at BaseProxy.unproxy(), I'm pretty sure Parent.all will not work, since the base algorithm quits as soon as it sees a find() method return True.  I don't think that's a huge problem, but it would be good to find a way to return an error on Parent.all instead of letting people find out the hard way that it doesn't work.
Posted (May 28, 2011, 10:22 a.m.)



  
src/sim/System.py (Diff revision 1)
 
 
It seems odd that Parent.any here will generate an error if there are multiple matches, but Self.all only is necessary if there are multiple matches.  I think the reason it's not a problem is that this Parent.any proxy on physmem is never used.  Should we get rid of it?
  1. You mean we set it to something and we should make it have no default? Another option would be to change the way this works a bit. Just use the memories above. 
  2. Getting rid of the Parent.any default would be one step; merging physmem and memories would be even better since they seem redundant, correct?  What about keeping the physmem name and replacing it with the definition you have for memories?
  3. I think I'm going to take the getting rid of Parent.any route and making it a required parameter. I tried to make ti work with memories, but the issue is that memories can contain more than one and most platforms requires some knowledge about what "the" memory is. For example the alpha console needs to know how big it's memory is to allocate all of the appropriate page tables for that memory size. 
  4. OK... another option would be to use memories[0] as "the" memory, but I'm not convinced that's better (or worse).