numam-dpdk/lib
Erik Gabriel Carrillo 7079e29f7f timer: fix race condition
rte_timer_manage() adds expired timers to a "run list", and walks the
list, transitioning each timer from the PENDING to the RUNNING state.
If another lcore resets or stops the timer at precisely this
moment, the timer state would instead be set to CONFIG by that other
lcore, which would cause timer_manage() to skip over it. This is
expected behavior.

However, if a timer expires quickly enough, there exists the
following race condition that causes the timer_manage() routine to
misinterpret a timer in CONFIG state, resulting in lost timers:

- Thread A:
  - starts a timer with rte_timer_reset()
  - the timer is moved to CONFIG state
  - the spinlock associated with the appropriate skiplist is acquired
  - timer is inserted into the skiplist
  - the spinlock is released
- Thread B:
  - executes rte_timer_manage()
  - find above timer as expired, add it to run list
  - walk run list, see above timer still in CONFIG state, unlink it from
    run list and continue on
- Thread A:
  - move timer to PENDING state
  - return from rte_timer_reset()
  - timer is now in PENDING state, but not actually linked into a
    pending list or a run list and will never get processed further
    by rte_timer_manage()

This commit fixes this race condition by only releasing the spinlock
after the timer state has been transitioned from CONFIG to PENDING,
which prevents rte_timer_manage() from seeing an incorrect state.

Fixes: 9b15ba895b ("timer: use a skip list")
Cc: stable@dpdk.org

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
2018-12-19 20:56:09 +01:00
..
librte_acl lib: fix shifting 32-bit signed variable 31 times 2018-11-06 01:14:05 +01:00
librte_bbdev bbdev: add missing experimental tags and map entries 2018-12-19 19:36:53 +01:00
librte_bitratestats bitrate: add sanity check on parameters 2018-07-26 20:07:57 +02:00
librte_bpf bpf: fix x86 JIT for immediate loads 2018-11-13 23:18:53 +01:00
librte_cfgfile fix indentation in symbol maps 2018-11-26 20:16:46 +01:00
librte_cmdline ethdev: support MAC address as iterator filter 2018-10-26 22:14:06 +02:00
librte_compat buildtools: change license to SPDX 2018-07-26 22:45:17 +02:00
librte_compressdev compressdev: fix structure comment 2018-12-19 11:19:10 +01:00
librte_cryptodev fix indentation in symbol maps 2018-11-26 20:16:46 +01:00
librte_distributor
librte_eal eal: clean up unused files on initialization 2018-12-19 04:12:30 +01:00
librte_efd efd: fix write unlock during ring creation 2018-11-18 15:46:02 +01:00
librte_ethdev ethdev: fix typo in queue setup error log 2018-12-13 17:45:59 +00:00
librte_eventdev eventdev: fix eth Tx adapter queue count checks 2018-12-17 20:25:10 +01:00
librte_flow_classify flow_classify: do not check for invalid socket ID 2018-10-11 10:37:45 +02:00
librte_gro gro: fix overflow of payload length calculation 2018-12-19 04:29:57 +01:00
librte_gso
librte_hash hash: fix TSX aborts with newer gcc 2018-11-14 01:02:07 +01:00
librte_ip_frag fix indentation in symbol maps 2018-11-26 20:16:46 +01:00
librte_jobstats
librte_kni kni: fix possible uninitialized variable 2018-11-23 01:43:35 +01:00
librte_kvargs kvargs: support list value 2018-10-26 22:14:06 +02:00
librte_latencystats latency: fix timestamp marking and latency calculation 2018-10-25 10:30:13 +02:00
librte_lpm lpm6: add incremental update on delete 2018-09-19 17:11:37 +02:00
librte_mbuf ethdev: support metadata as flow rule criteria 2018-10-26 22:14:05 +02:00
librte_member
librte_mempool malloc: add function to check if socket is external 2018-10-11 11:11:25 +02:00
librte_meter meter: remove experimental tag from profile API 2018-08-06 01:15:11 +02:00
librte_metrics metrics: disallow null as metric name 2018-07-26 20:30:18 +02:00
librte_net lib: fix shifting 32-bit signed variable 31 times 2018-11-06 01:14:05 +01:00
librte_pci pci: fix parsing of address without function number 2018-11-13 17:59:42 +01:00
librte_pdump pdump: remove deprecated APIs 2018-12-19 01:25:56 +01:00
librte_pipeline pipeline: fix logically dead code 2018-11-12 17:45:23 +01:00
librte_port port: add symmetric crypto 2018-10-12 19:33:02 +02:00
librte_power fix indentation in symbol maps 2018-11-26 20:16:46 +01:00
librte_rawdev lib: reduce global variable usage 2018-10-29 02:34:27 +01:00
librte_reorder
librte_ring ring/c11: relax ordering for load and store of the head 2018-11-13 17:00:58 +01:00
librte_sched mk: build with _GNU_SOURCE defined by default 2018-10-22 11:28:27 +02:00
librte_security security: restore experimental tag for unimplemented APIs 2018-11-23 02:03:33 +01:00
librte_table lib/librte_table: add hash function headers 2018-10-12 17:58:53 +02:00
librte_telemetry build: add dependency on telemetry to apps with meson 2018-10-27 15:21:33 +02:00
librte_timer timer: fix race condition 2018-12-19 20:56:09 +01:00
librte_vhost vhost: fix double read of descriptor flags 2018-12-13 18:17:42 +00:00
Makefile telemetry: introduce infrastructure 2018-10-27 15:18:20 +02:00
meson.build build: change default driver installation directory 2018-10-27 23:22:12 +02:00