Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/regress/sys/kern/ras



On Tue, Jan 06, 2004 at 08:37:41PM -0800, Jason Thorpe wrote:
> Using:
> 
>       __asm __volatile("":::"memory");
> 
> on both sides of the RAS ought to be enough, if the RAS doesn't operate 
> on any locals.

Ok, so I tested it and it works.
What actually happens is that in the tests there is code like:

  if (rasctl(&&start, &&end, ...) < 0) fail...
start:
  /* RAS starts here */
end:
  /* test results */

Inside the RAS there are references to global objects, and the compiler moves
the address load for one of the objects into the branch delay slot of the if,
and uses the address after the delay slot as "&&start".
It probably would not do that if the label "start:" had a goto using it. So
this might be considered a bug in gcc (since taking the address of the label
should have the same effect).

Anyway, this is just one case of optimzation interfering with the code, 
as Steve said we can not be sure w/o the big hammer (or the next gcc update
may break it).

With the current compiler either Jasons memory clobber or Pauls instruction
barrier before the RAS work. Thinking about it IMHO the global memory clobber
is what we realy want here, as it exactly matches the RAS semantics.

I don't see why a second clobber/barrier would be needed after the RAS, there
is no magic involved exiting the section, so the compilers guess about live
registers should be OK, shouldn't it?

Martin



Home | Main Index | Thread Index | Old Index