Subject: Re: [PATCH 3/3] powerpc/ftrace: simplify prepare_ftrace_return

From: Segher Boessenkool <[email-masked]>
Date: Fri, 26 Sep 2014 19:22:28 -0500

On Wed, Sep 24, 2014 at 12:33:07PM +1000, Anton Blanchard wrote:
> We are scratching our heads trying to remember details of the issue
> right now. In retrospect we should have linked the gcc bugzilla or
> gcc commit details in the kernel commit message :)

There have been many GCC bugs in this area.

30282 (for 32-bit)
44199 (for 64-bit)
52828 (for everything, and this one should finally handle things for good)
Also a bunch of duplicates, and I'm sure I've missed some more.

The original issue as far as I remember: when using a frame pointer, GCC
would sometimes schedule the epilogue to do the stack adjust before
restoring all regs from the stack.  Then an interrupt comes in, those
saved regs are clobbered, kaboom.  We cannot disable the frame pointer
because -pg forces it (although PowerPC does not need it).  The
-mno-sched-epilog flag is a workaround: the epilogue (and prologue) will
not be reordered by instruction scheduling.  Slow code is better than
blowing up fast ;-)

Segher