Re[2]: [Gc] Powerpc/m68k issue running test_stack

Ivan Maidanski ivmai at mail.ru
Mon Sep 24 11:35:18 PDT 2012


Hi Michael,

Mon, 24 Sep 2012 20:43:43 +1200 Michael Cree <mcree at orcon.net.nz>:
> On Sun 23 September 2012 21:44:34 Ivan Maidanski wrote:
> > Hi Michael, Thorsten and Wouter,
> > 
> > A couple of months, You reported libatomic_ops-7.3alpaha test_stack failure
> > on Alpha, PowerPC and m68k: *
> > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680100
> > * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680066
> > 
> > 1. Could you please verify that the problem exists in the recent
> > libatomic_ops-7.2:
> 
> On Alpha the test_stack failure is not present in the release-7_2 branch but 
> is present in master.  It therefore looks like a regression.
> 
> The test_stack failure only happens when running under an SMP linux kernel.  
> In the testing I have just performed against git master it always resulted in 
> a detected fail in the test_stack test but the Debian packaged version can 
> result in a list item pointing to itself, thus an infinite loop in the 
> check_list() function in tests/test_stack.c.
> 
> I bisected between the head of the release-7_2 branch and master which results 
> in:
> 
> cc51941b02fddc75952831eb8e28b06d340d2bef is the first bad commit
> commit cc51941b02fddc75952831eb8e28b06d340d2bef
> Author: Ivan Maidanski <ivmai at mail.ru>
> Date:   Mon Mar 26 08:06:19 2012 +0400
> 
>     Use __builtin_expect in CAS failure loop condition checks (GCC only)
>     
>     * src/atomic_ops.c (lock, block_all_signals): Use AO_EXPECT_FALSE.
>     * src/atomic_ops.h (AO_EXPECT_FALSE): New macro.
>     * src/atomic_ops/generalize-small.template
>     (AO_XSIZE_fetch_and_add_full, AO_XSIZE_fetch_and_add_acquire,
>     AO_XSIZE_fetch_and_add_release): Use AO_EXPECT_FALSE for CAS failure
>     check.
>     * src/atomic_ops/generalize.h (AO_fetch_and_add_full,
>     AO_fetch_and_add_acquire, AO_fetch_and_add_release, AO_fetch_and_add,
>     AO_and_full, AO_or_full, AO_xor_full): Likewise.
>     * src/atomic_ops/sysdeps/gcc/arm.h
>     (AO_compare_double_and_swap_double): Likewise.
>     * src/atomic_ops_stack.c (AO_stack_push_explicit_aux_release,
>     AO_stack_pop_explicit_aux_acquire, AO_stack_push_release,
>     AO_stack_pop_acquire): Likewise.
>     * src/atomic_ops/generalize-small.h: Regenerate.
> 
> :040000 040000 15676aef9361c647a597a25e8dd0e152d34681cb 
> a209c59999ae9072859594d532125236b898779c M   src
> 
> Something really subtle must be going on as the only change in the commit is 
> to wrap if statement conditionals with AO_EXPECT_FALSE().

Looks like.
Will something like this (for master) fix the problem on alpha?:
src/atomic_ops.h:

#if __GNUC__ >= 3 && !defined(LINT2)
# define AO_EXPECT_FALSE(expr) __builtin_expect(expr, 0)

->

#if __GNUC__ >= 3 && !defined(LINT2) && !defined(__alpha__)
# define AO_EXPECT_FALSE(expr) __builtin_expect(expr, 0)

If yes then, right, this is gcc/alpha bug. A more precise workaround (targeting particular AO_EXPECT_FALSE use) could done then.

Regards,
Ivan

> 
> Cheers
> Michael.
> 



More information about the Gc mailing list