Review Board 2.0.15


O3: Fixes fetch deadlock when the interrupt clears before CPU handles it.

Review Request #338 - Created Dec. 6, 2010 and submitted

Information
Ali Saidi
gem5
Reviewers
Default
ali, gblack, nate, stever
O3: Fixes fetch deadlock when the interrupt clears before CPU handles it.

When this condition occurs the cpu should restart the fetch stage to fetch from
the original execution path. Fault handling in the commit stage is cleaned up a
little bit so the control flow is simplier. Finally, if an instruction is being
used to carry a fault it isn't executed, so the fault propigates appropriately.

   
Review request changed
Updated (Jan. 12, 2011, 1:06 a.m.)

Summary:

-O3: Fixes fetch deadlock when the interrupt master clears single before CPU handles it.
+O3: Fixes fetch deadlock when the interrupt clears before CPU handles it.

Description:

~  

O3: Fixes fetch deadlock when the interrupt master clears single before CPU handles it.

~   Then the cpu should restart fetch stage to fetch from the original execution
~   path.

  ~

O3: Fixes fetch deadlock when the interrupt clears before CPU handles it.

  ~
  ~

When this condition occurs the cpu should restart the fetch stage to fetch from

  + the original execution path. Fault handling in the commit stage is cleaned up a
  + little bit so the control flow is simplier. Finally, if an instruction is being
  + used to carry a fault it isn't executed, so the fault propigates appropriately.

Diff:

Revision 2 (+92 -47)

Show changes

Posted (Jan. 16, 2011, 4:58 p.m.)
I still don't totally follow why this is necessary, although I believe it probably is. One sticky problem you can run into with x86 (and probably most ISAs) is if you enable interrupts and then immediately disable them again, expecting that that will let any pent up interrupts get handled. Is it possible the CPU might attempt to process one but then lose it's opportunity in that case? I know in some real world case (I don't remember the specifics) it can hang an OS which expects an interrupt to get through as described and move things along. If that doesn't matter here then never mind, but it's a potential problem it would be best to fix if possible.
  1. I think part of the problem here is that there's magical instantaneous communication about interrupts in most ISAs. Is that correct? If so, it would likely help for other ISAs to pass interrupts through the memory system like x86 does.
src/arch/arm/interrupts.hh (Diff revision 2)
 
 
This should probably go into it's own change and just get committed right away since it's just fixing a typo basically. It doesn't have anything to do with the O3 changes.
src/cpu/o3/commit.hh (Diff revision 2)
 
 
I think this is spelled propagate. This should be fixed in the commit message too, and wherever else it might be.
src/cpu/o3/commit_impl.hh (Diff revision 2)
 
 
This line is too long now.
Posted (Jan. 17, 2011, 1:01 a.m.)
Much better... thanks for splitting handleInterrupt(), this is much clearer and cleaner.  Just a few little things left.  I'll take your word on the merged DPRINTF since that didn't seem to make it into the revised diff.
src/cpu/o3/commit.hh (Diff revision 2)
 
 
Yea, it's definitely "propagate"
src/cpu/o3/commit_impl.hh (Diff revision 2)
 
 
I'm confused by the bare 'interrupt' term here... shouldn't it be 'interrupt != NoFault' or something like that?
src/cpu/o3/fetch.hh (Diff revision 2)
 
 
This is a big improvement... seems like it would be even better if we could create a new ISA-dependent function like suppressInterrupts() that returns ((pc & 0x3) != 0) for the Alpha case and false for everyone else, then get rid of this function and change the original line to
  (interruptPending && !suppressInterrupts(pc))
which addresses my other concern, that checkInterrupt() is kind of unspecific  since we already have a function called checkInterrupts().
  1. I thought about creating one, but I couldn't decide what parameters should be passed to it. Until we have another ISA that needs similar functionality (and I'm not sure we will, I really don't know how to define a function to handle the case, so I don't think there is a point in doing it.
  2. I'm not a big fan of that sort of function either, primarily since it's really just moving the code around rather than factoring out it's ISA dependent-ness. I think the assumption that there's a PAL mode bit in the PC is one of the last widespread vestiges of the Alpha only days. It would be great to get rid of it, but in my experience that's been tricky to actually do.