aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVladimir Ratnikov <vratnikov@netgate.com>2022-10-17 07:34:14 +0000
committerFan Zhang <royzhang1980@hotmail.com>2022-10-20 20:47:29 +0000
commit65bff88c3671ec6ee561e70f17c60ea9784a39dd (patch)
treeabb87aa85776e6ff46afe058f033a876186c3e58 /src
parent5569a85a1efd1bb3dd1cfa8ad78d3b3d3db2beec (diff)
crypto-sw-scheduler: fix queue iterator
When there are several workers, iterator can and will skip head iterator and it will last until BARRIER_SYNC_TIMEOUT won't expire and will cause SIGABRT with `worker thread deadlock` Type: fix Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com> Change-Id: Id4def4d5894e077ae27592367b141ecd822e86af Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/crypto_sw_scheduler/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/crypto_sw_scheduler/main.c b/src/plugins/crypto_sw_scheduler/main.c
index 47fa37d7251..09d4a0b9b94 100644
--- a/src/plugins/crypto_sw_scheduler/main.c
+++ b/src/plugins/crypto_sw_scheduler/main.c
@@ -471,6 +471,15 @@ crypto_sw_scheduler_process_aead (vlib_main_t *vm,
tail = current_queue->tail;
head = current_queue->head;
+ /* Skip this queue unless tail < head or head has overflowed
+ * and tail has not. At the point where tail overflows (== 0),
+ * the largest possible value of head is (queue size - 1).
+ * Prior to that, the largest possible value of head is
+ * (queue size - 2).
+ */
+ if ((tail > head) && (head >= CRYPTO_SW_SCHEDULER_QUEUE_MASK))
+ goto skip_queue;
+
for (j = tail; j != head; j++)
{
@@ -488,6 +497,7 @@ crypto_sw_scheduler_process_aead (vlib_main_t *vm,
}
}
+ skip_queue:
if (found || i == ptd->last_serve_lcore_id)
{
CLIB_MEMORY_STORE_BARRIER ();