summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-06-30 18:17:06 +0200
committerDave Barach <openvpp@barachs.net>2020-07-01 20:39:01 +0000
commitd25147d58117a573fd2fc04cdfa76339fa1cdf22 (patch)
tree0e44628d9499f7d45a8aa0944cc4847e137f90d6 /src
parent126c88544103d3775252f741398111875f6a62d7 (diff)
vlib: wake up workers if interrupts are posted
Type: fix Change-Id: If8dbbcb46193fd057fe8d704058609a3a8787d6c Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/main.c5
-rw-r--r--src/vlib/node.h1
-rw-r--r--src/vlib/node_funcs.h1
-rw-r--r--src/vlib/unix/input.c3
-rw-r--r--src/vppinfra/vec.h2
5 files changed, 9 insertions, 3 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 2c397a29672..8d7c6c09275 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1766,6 +1766,8 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
/* Pre-allocate interupt runtime indices and lock. */
vec_alloc (nm->pending_local_interrupts, 32);
vec_alloc (nm->pending_remote_interrupts, 32);
+ vec_alloc_aligned (nm->pending_remote_interrupts_notify, 1,
+ CLIB_CACHE_LINE_BYTES);
clib_spinlock_init (&nm->pending_interrupt_lock);
/* Pre-allocate expired nodes. */
@@ -1857,7 +1859,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
cpu_time_now = dispatch_pending_interrupts (vm, nm, cpu_time_now);
/* handle remote interruots */
- if (_vec_len (nm->pending_remote_interrupts))
+ if (PREDICT_FALSE (_vec_len (nm->pending_remote_interrupts)))
{
vlib_node_interrupt_t *in;
@@ -1868,6 +1870,7 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
in = nm->pending_local_interrupts;
nm->pending_local_interrupts = nm->pending_remote_interrupts;
nm->pending_remote_interrupts = in;
+ *nm->pending_remote_interrupts_notify = 0;
clib_spinlock_unlock (&nm->pending_interrupt_lock);
cpu_time_now = dispatch_pending_interrupts (vm, nm, cpu_time_now);
diff --git a/src/vlib/node.h b/src/vlib/node.h
index ca7564a13e7..9c4cadd56f7 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -698,6 +698,7 @@ typedef struct
/* Node runtime indices for input nodes with pending interrupts. */
vlib_node_interrupt_t *pending_local_interrupts;
vlib_node_interrupt_t *pending_remote_interrupts;
+ volatile u32 *pending_remote_interrupts_notify;
clib_spinlock_t pending_interrupt_lock;
/* Input nodes are switched from/to interrupt to/from polling mode
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h
index b607ef252bd..89f212374e9 100644
--- a/src/vlib/node_funcs.h
+++ b/src/vlib/node_funcs.h
@@ -242,6 +242,7 @@ vlib_node_set_interrupt_pending_with_data (vlib_main_t * vm, u32 node_index,
vec_add2 (nm->pending_remote_interrupts, i, 1);
i->node_runtime_index = n->runtime_index;
i->data = data;
+ *nm->pending_remote_interrupts_notify = 1;
clib_spinlock_unlock (&nm->pending_interrupt_lock);
}
}
diff --git a/src/vlib/unix/input.c b/src/vlib/unix/input.c
index 98cb133409f..7531dd19749 100644
--- a/src/vlib/unix/input.c
+++ b/src/vlib/unix/input.c
@@ -249,7 +249,8 @@ linux_epoll_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
while (nanosleep (&ts, &tsrem) < 0)
ts = tsrem;
- if (*vlib_worker_threads->wait_at_barrier)
+ if (*vlib_worker_threads->wait_at_barrier
+ || *nm->pending_remote_interrupts_notify)
goto done;
}
}
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h
index df913c2b144..d4063e64bdc 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -119,7 +119,7 @@ void *vec_resize_allocate_memory (void *v,
#define _vec_resize_numa(V,L,DB,HB,A,S) \
({ \
__typeof__ ((V)) _V; \
- _V = _vec_resize_inline(V,L,DB,HB,clib_max((__alignof__((V)[0])),(A)),(S)); \
+ _V = _vec_resize_inline((void *)V,L,DB,HB,clib_max((__alignof__((V)[0])),(A)),(S)); \
_V; \
})