1
1
Граф коммитов

6 Коммитов

Автор SHA1 Сообщение Дата
Nathan Hjelm
dc000213ea opal/fifo: use atomics to set fifo head in opal_fifo_push
This commit changes the opal_fifo_push code to use
opal_update_counted_pointer to set the head. This fixes a data race
that occurs because the read of the fifo head in opal_fifo_pop
requires two instructions. This combined with the non-atomic update in
opal_fifo_push can lead to an ABA issue that puts the fifo in an
inconsistant state.

There are other ways this problem could be fixed. One way would be to
introduce an opal_atomic_read_128 implementation. On x86_64 this would
have to use the cmpxchg16b instruction. Since this instruction would
have to be in the pop path (and always executed) it would be slower
than the fix in this commit.

Closes open-mpi/ompi#1460.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2016-03-17 13:21:27 -06:00
Nathan Hjelm
2a7e191dd8 opal/fifo: if available use load-linked store-conditional
These instructions allow a more efficient implementation of the
opal_fifo_pop_atomic function.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2015-08-18 14:01:52 -06:00
Nathan Hjelm
9abccbd9fc opal/fifo: add missing memory barrier
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2015-08-03 16:22:28 -06:00
Nathan Hjelm
1c8f8c6694 opal_fifo: add a couple of memory barriers to the cswap2 implementation 2015-02-12 11:01:40 -07:00
Nathan Hjelm
9f6faadd91 opal_fifo: add missing memory barrier in pop
Thanks to Adrian Reber for reporting this.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2015-01-08 09:14:56 -07:00
Nathan Hjelm
d1114ec17a Add opal_fifo_t class
This commit adds a new class: opal_fifo.h. The new class has atomic, non-atomic,
and opal_using_threads() conditoned routines. It should be used when first-in
first-out is required and should perform much better than using locks and an
opal_list_t. Like with opal_lifo_t there are two versions of the atomic
implementation: 128-bit compare-and-swap, and spin-locked. More implementations
can be added later (LL/SC comes to mind).

This commit also adds a unit test for the opal_fifo_t class. This test verifies
the fifo implementation when using multiple threads.
2014-12-04 15:30:02 -07:00