[PATCH] [RFC] Emulate "lwsync" to run standard user land on e500 cores

Kumar Gala galak at kernel.crashing.org
Sat Oct 26 18:26:34 EST 2013


On Oct 25, 2013, at 8:02 AM, Benjamin Herrenschmidt wrote:

> On Fri, 2013-10-25 at 10:58 +0100, David Laight wrote:
>>> This is not a distro issue. It's a libstdc++ portability issue. libstdc++
>>> hardcodes lwsync unless __NO_LWSYNC__ is explicitly defined,
>>> which you only get with -mcpu=8540/-mcpu=8548.  When compiled
>>> for any powerpc target other than -mcpu=8540/-mcpu=8548, including
>>> the default -mcpu=common,  libstdc++ will end up containing lwsync.
>>> There is no way to explicitly request libstdc++ to be built without lwsync
>>> with an -mcpu target other than 8540/8548.
>>> 
>>> The issue is easily demonstrated by running a program that throws a
>>> C++ exception: __cxa_throw() is called, which has an lwsync.  This
>>> results in an illegal instruction exception when run on an e500v1/e500v2.
>> 
>> Perhaps libstc++ should be working out at run time whether lwsync is valid?
> 
> Do we have enough coats of paint on this bike shed yet ? :-)
> 
> I'm personally tempted to take Scott's approach since that's what we do
> for other things as well, it just works and is simple.
> 
> Cheers,
> Ben.
> 

I give in, however some should test with CONFIG_PPC_EMULATED_STATS and fix what I'm guessing is a build breakage with either patch.

- k



More information about the Linuxppc-dev mailing list