Re: [Gc] test_stack on powerpc (power7)
Pavel Raiskup <[email protected]> Thu, 28 Jul 2016 09:39:31 +0200
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --nextPart2219463.bLTsH90Rcl Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Wednesday, July 27, 2016 9:26:14 PM CEST Ivan Maidanski wrote: > Hello Pavel and Hans, > > To Pavel: > > I've seen Fedora maintainer applied this workaround downstream. > Please give a reference? (sorry I failed to access the patch in ML) Rex Dieter posted correct link -> that probably originally comes from this thread, but link to archives is here: https://lists.opendylan.org/pipermail/bdwgc/2014-January/005841.html > To Hans: > What do you think of the failure reason? Could you please better description of stack_aux? > On Mon, 2012-12-17 at 15:34 +0100, Pavel Raiskup wrote: > > ... > > I need to understand more deeply the "stack_aux" structure and how you are > > using it, I still can't see whether there is guaranteed that the background > > algorithm may not have collisions (considering 2+ threads trying to make a > > pop and 2+ threads trying to make a push operation in parallel). I was unable to download the patch from archives, so I'm re-attaching the "attempt" to move this forward again. Pavel --nextPart2219463.bLTsH90Rcl Content-Disposition: attachment; filename="0001-This-works-OK.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-This-works-OK.patch" From 6cd2f947eb6204d617ecbe3ee19dff8f8348beb8 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup <[email protected]> Date: Tue, 18 Dec 2012 14:31:20 +0100 Subject: [PATCH] This works OK. --- src/atomic_ops_stack.c | 25 +++++++++---------------- src/atomic_ops_stack.h | 2 +- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/atomic_ops_stack.c b/src/atomic_ops_stack.c index 642bac0..e1077ce 100644 --- a/src/atomic_ops_stack.c +++ b/src/atomic_ops_stack.c @@ -1,4 +1,4 @@ -/* +/* vi: ts=2 expandtab * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * * This file may be redistributed and/or modified under the @@ -76,18 +76,8 @@ AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, { int i; for (i = 0; i < AO_BL_SIZE; ++i) - { - if (AO_load(a -> AO_stack_bl + i) == x_bits) - { - /* Entry is currently being removed. Change it a little. */ - ++x_bits; - if ((x_bits & AO_BIT_MASK) == 0) - /* Version count overflowed; */ - /* EXTREMELY unlikely, but possible. */ - x_bits = (AO_t)x; - goto retry; - } - } + if (!AO_compare_and_swap_acquire(a->AO_stack_bl, 0, 1)) + goto retry; } # endif /* x_bits is not currently being deleted */ @@ -97,6 +87,9 @@ AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, *x = next; } while (AO_EXPECT_FALSE(!AO_compare_and_swap_release(list, next, x_bits))); + + /* must success */ + AO_compare_and_swap_release(a->AO_stack_bl, 1, 0); } /* @@ -132,8 +125,8 @@ AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) /* structure a are currently in progress. */ for (i = 0; ; ) { - if (PRECHECK(a -> AO_stack_bl[i]) - AO_compare_and_swap_acquire(a->AO_stack_bl+i, 0, first)) + if (PRECHECK(a -> AO_stack_bl[0]) + AO_compare_and_swap_acquire(a->AO_stack_bl, 0, 1)) break; ++i; if ( i >= AO_BL_SIZE ) @@ -143,7 +136,7 @@ AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) } } assert(i < AO_BL_SIZE); - assert(a -> AO_stack_bl[i] == first); + // assert(a -> AO_stack_bl[i] == first); /* First is on the auxiliary black list. It may be removed by */ /* another thread before we get to it, but a new insertion of x */ /* cannot be started here. */ diff --git a/src/atomic_ops_stack.h b/src/atomic_ops_stack.h index 1ca5f40..f2bace3 100644 --- a/src/atomic_ops_stack.h +++ b/src/atomic_ops_stack.h @@ -83,7 +83,7 @@ * debugging. */ #ifndef AO_BL_SIZE -# define AO_BL_SIZE 2 +# define AO_BL_SIZE 1 #endif #if AO_BL_SIZE > (1 << AO_N_BITS) -- 1.7.11.7 --nextPart2219463.bLTsH90Rcl Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bdwgc mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/bdwgc --nextPart2219463.bLTsH90Rcl--