Re: [lng-odp] [PATCHv7] validation: synchronizer tests

2015-01-12 Thread Stuart Haslam
On Mon, Jan 12, 2015 at 05:33:15PM +, Maxim Uvarov wrote:
> On 01/12/2015 08:21 PM, Stuart Haslam wrote:
> > On Mon, Jan 12, 2015 at 11:30:24AM +, Mario Torrecillas Rodriguez wrote:
> >> This should fix it. Can anyone with a decent number of cores try it out? I
> >> only have 2 in my setup, and the problem was relatively hard to replicate.
> >>
> > Works for me - ran ~1000 iterations (on 8 cores) without any issues, the
> > previous version would always hang after <20.
> >
> > --
> > Stuart.
> 
> Stuart, please add your Reviewed-and-Tested-by:
> 
> Maxim.

I tested it and reviewed just the changes between v6 and v7 rather than
the entire patch, but for that;

Reviewed-and-Tested-by: Stuart Haslam 

-- 
Stuart.


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv7] validation: synchronizer tests

2015-01-12 Thread Maxim Uvarov

On 01/12/2015 08:21 PM, Stuart Haslam wrote:

On Mon, Jan 12, 2015 at 11:30:24AM +, Mario Torrecillas Rodriguez wrote:

This should fix it. Can anyone with a decent number of cores try it out? I
only have 2 in my setup, and the problem was relatively hard to replicate.


Works for me - ran ~1000 iterations (on 8 cores) without any issues, the
previous version would always hang after <20.

--
Stuart.


Stuart, please add your Reviewed-and-Tested-by:

Maxim.



___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp



___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv7] validation: synchronizer tests

2015-01-12 Thread Stuart Haslam
On Mon, Jan 12, 2015 at 11:30:24AM +, Mario Torrecillas Rodriguez wrote:
> This should fix it. Can anyone with a decent number of cores try it out? I
> only have 2 in my setup, and the problem was relatively hard to replicate.
> 

Works for me - ran ~1000 iterations (on 8 cores) without any issues, the
previous version would always hang after <20.

--
Stuart.


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv7] validation: synchronizer tests

2015-01-12 Thread Mario Torrecillas Rodriguez
This should fix it. Can anyone with a decent number of cores try it out? I
only have 2 in my setup, and the problem was relatively hard to replicate.

As Bill pointed out, there were two barriers being reinitialised on the go
to make them reusable. This accidentally worked fine for the case where
the ODP barrier was present, but only because this other barrier was
preventing the custom barrier from being reinitialised before all the
threads were done with it.
I¹ve changed it to use one custom barrier per iteration instead of one
barrier for every iteration, in a similar manner the ODP barrier was being
used.

Mario.

On 12/01/2015 11:25, "Mario Torrecillas Rodriguez"
 wrote:

>First set of synchronizer tests. This patch includes
>tests for locks, barriers and atomics.
>
>Signed-off-by: Mario Torrecillas Rodriguez
>
>---
>(This code contribution is provided under the terms of agreement
>LES-LTM-21309)
>
>Changes from previous version:
>Fixed issue with no_barrier_test.
>
> test/validation/.gitignore  |1 +
> test/validation/Makefile.am |6 +-
> test/validation/odp_synchronizers.c | 1178
>+++
> 3 files changed, 1183 insertions(+), 2 deletions(-)
> create mode 100644 test/validation/odp_synchronizers.c
>
>diff --git a/test/validation/.gitignore b/test/validation/.gitignore
>index 882a695..a1d4d15 100644
>--- a/test/validation/.gitignore
>+++ b/test/validation/.gitignore
>@@ -10,3 +10,4 @@ odp_pktio
> odp_buffer
> odp_timer
> odp_time
>+odp_synchronizers
>diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
>index c03294c..400d758 100644
>--- a/test/validation/Makefile.am
>+++ b/test/validation/Makefile.am
>@@ -6,9 +6,9 @@ AM_LDFLAGS += -static
> TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
>
> if ODP_CUNIT_ENABLED
>-TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run
>odp_buffer odp_system odp_timer odp_time
>+TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run
>odp_buffer odp_system odp_timer odp_time odp_synchronizers
> check_PROGRAMS = ${bin_PROGRAMS}
>-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
>odp_pktio odp_buffer odp_system odp_timer odp_time
>+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
>odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers
> odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
> endif
>@@ -29,3 +29,5 @@ dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c
>\
> dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
> dist_odp_timer_SOURCES = odp_timer.c common/odp_cunit_common.c
> dist_odp_time_SOURCES = odp_time.c common/odp_cunit_common.c
>+dist_odp_synchronizers_SOURCES = odp_synchronizers.c \
>+   common/odp_cunit_common.c
>diff --git a/test/validation/odp_synchronizers.c
>b/test/validation/odp_synchronizers.c
>new file mode 100644
>index 000..ef18499
>--- /dev/null
>+++ b/test/validation/odp_synchronizers.c
>@@ -0,0 +1,1178 @@
>+/* Copyright (c) 2014, Linaro Limited
>+ * All rights reserved.
>+ *
>+ * SPDX-License-Identifier:BSD-3-Clause
>+ */
>+
>+#include 
>+#include 
>+#include 
>+#include 
>+#include 
>+#define VERBOSE   0
>+#define MAX_ITERATIONS1000
>+#define BARRIER_ITERATIONS64
>+
>+#define SLOW_BARRIER_DELAY400
>+#define BASE_DELAY6
>+#define MIN_DELAY 1
>+
>+#define NUM_TEST_BARRIERS BARRIER_ITERATIONS
>+#define NUM_RESYNC_BARRIERS   100
>+
>+#define ADD_SUB_CNT   5
>+
>+#define CNT   10
>+#define BARRIER_DELAY 10
>+#define U32_INIT_VAL  (1UL << 10)
>+#define U64_INIT_VAL  (1ULL << 33)
>+
>+#define GLOBAL_SHM_NAME   "GlobalLockTest"
>+
>+#define UNUSED__attribute__((__unused__))
>+
>+static odp_atomic_u32_t a32u;
>+static odp_atomic_u64_t a64u;
>+
>+typedef __volatile uint32_t volatile_u32_t;
>+typedef __volatile uint64_t volatile_u64_t;
>+
>+typedef struct {
>+  odp_atomic_u32_t wait_cnt;
>+} custom_barrier_t;
>+
>+typedef struct {
>+  /* Global variables */
>+  uint32_t g_num_threads;
>+  uint32_t g_iterations;
>+  uint32_t g_verbose;
>+  uint32_t g_max_num_cores;
>+
>+  odp_barrier_t test_barriers[NUM_TEST_BARRIERS];
>+  custom_barrier_t custom_barrier1[NUM_TEST_BARRIERS];
>+  custom_barrier_t custom_barrier2[NUM_TEST_BARRIERS];
>+  volatile_u32_t slow_thread_num;
>+  volatile_u32_t barrier_cnt1;
>+  volatile_u32_t barrier_cnt2;
>+  odp_barrier_t global_barrier;
>+
>+  /* Used to periodically resync within the lock functional tests */
>+  odp_barrier_t barrier_array[NUM_RESYNC_BARRIERS];
>+
>+  /* Locks */
>+  odp_spinlock_t global_spinlock;
>+  odp_ticketlock_t global_ticketlock;
>+  odp_rwlock_t global_rwlock;
>+
>+  volatile_u32_t global_lock_owner;
>+} glo