[Stackless] Problem building release27-maint in 64-bit linux.

Anselm Kruis a.kruis at science-computing.de
Tue Jul 12 09:30:41 CEST 2011


Hi,

I'm far from understanding the code completely.

I looked at the switching code of the greenlet project 
(http://codespeak.net/py/0.9.2/apigen/source/c-extension/greenlet/switch_amd64_unix.h.html) 
Pretty much the same as our old version of the code.

Here is some discussion about the context switch for amd64:
http://code.google.com/p/coev/wiki/GreenletProblems The page contains a link to 
the amd64 ABI specification http://www.x86-64.org/documentation.html. I'll try 
to read it later.

Regard
   Anselm

Am 11.07.2011 18:14, schrieb Jeff Senn:
> As I'm responsible for that patch -- I'll simply say that IIRC no one was sure that it was working at all on 64-bit
> Linux at the time...and I didn't have a 64 bit linux system to test (there's probably a discussion on the list, or I can dig up email if
> anyone cares...)
>
> In any case, I'd be happy if someone who understands this deeply made the right changes to the
> configure scripts to make this more flexible.  Historically the correct registers to save
> have depended on OS, architecture, *and* (sometimes) compiler version.
>
> As you suggest, some strategy to choose the registers more specifically at configure time is probably a good
> idea.
>
> On Jul 11, 2011, at 11:39 AM, Anselm Kruis wrote:
>
>> Hi,
>>
>> I can confirm the problem report for gcc. Analysis shows, that problem "./Stackless/core/slp_transfer.c:153:1: error: bp cannot be used in asm here" was introduced by the backport of change r83165 to release27-maint (r88294). See below for the diff.
>>
>> The problem is caused by configure.in:
>> -------8<------------8<-------------
>> # Stackless flags for compiling the hard switching code
>> case $MACHDEP in
>>         darwin)
>>                 SLPFLAGS="-fomit-frame-pointer -O2"
>>                 ;;
>>         *)
>>                 SLPFLAGS="-fno-omit-frame-pointer -O2"
>>                 ;;
>> esac
>> AC_SUBST(SLPFLAGS)
>> -------8<------------8<-------------
>>
>> For Linux and all other non darwin systems, SLPFLAGS is "-fno-omit-frame-pointer -O2" and therefore the code does not compile. (SLPFLAGS was introduced with change r82398.)
>>
>> How to fix this problem?
>>
>> If I understand the commit comment correctly, there were crashes on OS-X. But what about Linux? I'm not aware of problems on Linux amd64. Can we make the longer REGS_TO_SAVE list a conditional define? Something like:
>>
>> #ifdef SLP_SAVE_FRAME_POINTER
>> +#define REGS_TO_SAVE "rdx", "rbx", "r12", "r13", "r14", "r15", "r9", "r8", "rdi", "rsi", "rcx", "rbp"
>> #else
>> +#define REGS_TO_SAVE "rdx", "rbx", "r12", "r13", "r14", "r15", "r9", "r8", "rdi", "rsi", "rcx"
>> #endif
>>
>> and define SLP_SAVE_FRAME_POINTER in configure.in together with -fomit-frame-pointer.
>>
>>
>> Just for reference: the change, that introduced the problem:
>>
>> $ svn log -c 83165 http://svn.python.org/projects/stackless/trunk/Stackless/platf/switch_amd64_unix.h | less
>> ------------------------------------------------------------------------
>> r83165 | jeff.senn | 2010-07-26 16:34:04 +0200 (Mon, 26 Jul 2010) | 3 lines
>>
>> Added saved registers. Doesn't crash on tests anymore on OS-X 10.6 (gcc-4.2.1)
>> Not sure registers are minimal. Not sure will work on other platforms/compilers.  But since the consensus is that it has never worked, committing as incremental progress.
>>
>> ------------------------------------------------------------------------
>>
>>
>> $ svn diff -c 83165 http://svn.python.org/projects/stackless/trunk/Stackless/platf/switch_amd64_unix.h | less
>> Index: switch_amd64_unix.h
>> ===================================================================
>> --- switch_amd64_unix.h (revision 83164)
>> +++ switch_amd64_unix.h (revision 83165)
>> @@ -29,8 +35,8 @@
>> /* the above works fine with gcc 2.96, but 2.95.3 wants this */
>> #define STACK_MAGIC 0
>>
>> -#define REGS_TO_SAVE "rdx", "rbx", "r12", "r13", "r14", "r15"
>>
>> +#define REGS_TO_SAVE "rdx", "rbx", "r12", "r13", "r14", "r15", "r9", "r8", "rdi", "rsi", "rcx", "rbp"
>>
>> static int
>> slp_switch(void)
>>
>>
>>
>> Regards
>>    Anselm
>>
>>
>>
>>
>> Am 07.05.2011 00:48, schrieb Richard Tew:
>>> On Fri, May 6, 2011 at 11:27 PM, Estevo<euccastro at yahoo.com>   wrote:
>>>
>>>> I got the following error trying to make release27-maint in a 64-bit
>>>>
>>>
>>> Presumably there's a change that on your system engages
>>> -fno-omit-frame-pointer when to compile Stackless we need
>>> -fomit-frame-pointer.
>>>
>>> Anyone care to look into this? :-)  We could use a patch.
>>>
>>> Cheers,
>>> Richard.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Stackless mailing list
>>> Stackless at stackless.com
>>> http://www.stackless.com/mailman/listinfo/stackless
>>
>> --
>> Dipl. Phys. Anselm Kruis                       science + computing ag
>> Senior Solution Architect                      Ingolstädter Str. 22
>> email A.Kruis at science-computing.de             80807 München, Germany
>> phone +49 89 356386 874  fax 737               www.science-computing.de
>>
>> --
>> Vorstand/Board of Management:
>> Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
>> Vorsitzender des Aufsichtsrats/
>> Chairman of the Supervisory Board:
>> Philippe Miltin
>> Sitz/Registered Office: Tuebingen
>> Registergericht/Registration Court: Stuttgart
>> Registernummer/Commercial Register No.: HRB 382196
>>
>>
>> _______________________________________________
>> Stackless mailing list
>> Stackless at stackless.com
>> http://www.stackless.com/mailman/listinfo/stackless
>>
>
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless

-- 
  Dipl. Phys. Anselm Kruis                       science + computing ag
  Senior Solution Architect                      Ingolstädter Str. 22
  email A.Kruis at science-computing.de             80807 München, Germany
  phone +49 89 356386 874  fax 737               www.science-computing.de

-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 





More information about the Stackless mailing list