timer: allow management in shared memory
authorErik Gabriel Carrillo <erik.g.carrillo@intel.com>
Mon, 15 Apr 2019 21:41:27 +0000 (16:41 -0500)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 17 Apr 2019 18:05:20 +0000 (20:05 +0200)
commitc0749f7096c7e39ce9e8969b0ab0955d82500511
tree6b019d09291e4b03618aa43ffa063df1a935d589
parent73eca2f77f4c3a95ba77ceb19f8b92d41fd2eccf
timer: allow management in shared memory

Currently, the timer library uses a per-process table of structures to
manage skiplists of timers presumably because timers contain arbitrary
function pointers whose value may not resolve properly in other
processes.

However, if the same callback is used handle all timers, and that
callback is only invoked in one process, then it woud be safe to allow
the data structures to be allocated in shared memory, and to allow
secondary processes to modify the timer lists.  This would let timers be
used in more multi-process scenarios.

The library's global variables are wrapped with a struct, and an array
of these structures is created in shared memory.  The original APIs
are updated to reference the zeroth entry in the array. This maintains
the original behavior for both primary and secondary processes since
the set intersection of their coremasks should be empty [1].  New APIs
are introduced to enable the allocation/deallocation of other entries
in the array.

New variants of the APIs used to start and stop timers are introduced;
they allow a caller to specify which array entry should be used to
locate the timer list to insert into or delete from.

Finally, a new variant of rte_timer_manage() is introduced, which
allows a caller to specify which array entry should be used to locate
the timer lists to process; it can also process multiple timer lists per
invocation.

[1] https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html#multi-process-limitations

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
lib/librte_timer/Makefile
lib/librte_timer/meson.build
lib/librte_timer/rte_timer.c
lib/librte_timer/rte_timer.h
lib/librte_timer/rte_timer_version.map