On 14 January 2015 at 11:23, Ola Dahl <[email protected]> wrote:
> Hi,
>
> when I run the ODP timer test on 32-bit Ubuntu, it fails.
>
> I use ODP commit
>
> commit 68c7b7e88b1b948868d35497e715cf5077e90e40
> Author: Mike Holmes <[email protected]>
> Date:   Fri Jan 2 16:30:16 2015 -0500
>
>     api: odp_coremask: Improve documentation
>
> and the timer test fails as
>
> ubuntu@ubuntu:~/odp$ ./example/timer/odp_timer_test
>
> ODP timer example starts
> odp_buffer_pool.c:90:odp_buffer_pool_init_global():
> Buffer pool init global
> odp_buffer_pool.c:91:odp_buffer_pool_init_global():  pool_entry_s size
> 256
> odp_buffer_pool.c:92:odp_buffer_pool_init_global():  pool_entry_t size
> 256
> odp_buffer_pool.c:93:odp_buffer_pool_init_global():  odp_buffer_hdr_t size
> 76
> odp_buffer_pool.c:94:odp_buffer_pool_init_global():
> odp_queue.c:100:odp_queue_init_global():Queue init ...
> odp_queue.c:120:odp_queue_init_global():done
> odp_queue.c:121:odp_queue_init_global():Queue init global
> odp_queue.c:123:odp_queue_init_global():  struct queue_entry_s size 192
> odp_queue.c:125:odp_queue_init_global():  queue_entry_t size        192
> odp_queue.c:126:odp_queue_init_global():
> odp_schedule.c:90:odp_schedule_init_global():Schedule init ...
> odp_schedule.c:142:odp_schedule_init_global():done
>
> ODP system info
> ---------------
> ODP API version: 0.7.0
> CPU model:       Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
> CPU freq (hz):   2388222999
> Cache line size: 64
> Max CPU count:   1
>
> num worker threads: 1
> first CPU:          0
> resolution:         10000 usec
> min timeout:        0 usec
> max timeout:        10000000 usec
> period:             1000000 usec
> timeouts:           30
> odp_timer.c:640:itimer_init():Creating POSIX timer for timer pool
> timer_pool, period 10000000 ns
> odp_timer.c:664:itimer_init():timer_settime() returned error Invalid
> argument
The POSIX timer uses CLOCK_MONOTONIC but this should always be
supported me thinks.
The man page has this for EINVAL:
       timer_settime() may fail with the following errors:

       EINVAL new_value.it_value is negative; or new_value.it_value.tv_nsec is
              negative or greater than 999,999,999.


> Aborted (core dumped)
Can you run again with core dumps enabled (ulimit -c unlimited) and
print the values of the parameters to timer_settime? Or run it in gdb.

> ubuntu@ubuntu:~/odp$
>
> I use Virtualbox and a fresh Ubuntu 32-bit image, prepared using
>
>     3  sudo apt-get install git
>     4  git clone https://git.linaro.org/lng/odp.git
>     5  cd odp
>     7  sudo apt-get install autoconf
>     9  sudo apt-get install autotools-dev
>    11  sudo apt-get install libtool
>    14  ./bootstrap
>    26  sudo apt-get update
>    29  sudo apt-get install libssl-dev
>    30  ./configure
>    36  make all
>    37  ./example/timer/odp_timer_test
This works on my 32-bit ChromeBook2 (ARMv7a) so not a 32-bit problem.

But I do get spurious errors "odp_timer_set_abs() failed: too early"
and the example treats them as fatal errors (they don't have to be,
that's why they are return codes, the application could/should try
again with a later timeout tick). Possibly this is caused by the
worker threads being preempted at the wrong place and so attempting to
set timeouts for ticks that have already passed.

Managed to configure and build odp for 32-bit x86 (I had to install
libssl-dev:i386 package and that had weird side effects on my
installation! gcc was for some reason also uninstalled and had to be
reinstalled).

And building ODP with "make CFLAGS=-m32", I get the same problem.
662 if (timer_settime(&tp->timerid, 0, &ispec, NULL))
(gdb) p ispec
$1 = {it_interval = {tv_sec = 0, tv_nsec = 10000000}, it_value = {tv_sec = 0,
    tv_nsec = 10000000}}
(gdb) n
663 ODP_ABORT("timer_settime() returned error %s\n",
(gdb) n
odp_timer.c:664:itimer_init():timer_settime() returned error Invalid argument

Program received signal SIGABRT, Aborted.

I found the bug:
Current code:
timer_settime(&tp->timerid, 0, &ispec, NULL)
(timer_create some lines above also uses &tp->timerid to get the new timerid).

Correct code:
timer_settime(tp->timerid, 0, &ispec, NULL)
Note no "&" on the timerid variable.

This code was copied from the old timer implementation and has worked
on x86-64 and ARMv7a (and other architectures?). And the compiler
doesn't complain...

660 ispec.it_value.tv_nsec    = (long)nsec;
(gdb)
662 if (timer_settime(tp->timerid, 0, &ispec, NULL))
(gdb)
665 }


>
> Best regards,
>
> Ola D
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to