diff options
author | Christian E. Hopps <chopps@chopps.org> | 2019-09-28 21:36:36 -0400 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-10-18 14:39:40 +0000 |
commit | c518bd63c3c6823c9f1e45da3da938df560c7877 (patch) | |
tree | d097e2790a3c78a146c8936123bae1739334d33b /src/vnet/mpls | |
parent | b8f61f4863c29cc59d71183c87a691dbf2b85a92 (diff) |
vlib: move thread barrier around mod of global node next data
The old code modified the node next array prior to obtaining the thread
barrier. Then it updated the runtime node data, and upon barrier release
caused reforking of each worker thread. The reforking clones the main
thread nodes and reconstructs the runtime node structure. This cloning
is not 100% "deep" in the sense that the node next array is
shared (i.e., only the pointer is copied). So prior to the barrier being
obtained the node's next array is being changed while workers are
actively using it (bad). Treating the node next array as read-only in
the workers and sharing it is a decent optimization so instead of trying
to fix that just move the barrier a little earlier in the process to
protect the node next array as well.
This was tripping an assert in next frame ownership change by way of the
ip4-arp node. The assert verifies that the node's next array length is
equal to the runtime next node count. The race above was lost and the
node next array data was updated in the main thread while the arp code
was still executing in a worker.
This was being hit when many arp requests were being sent from both ends
of a tunnel during which the add next node function was called, which
often led to an assert b/c the next node array was out of sync with the
runtime next node count.
- PS#2 update - move barrier sync to just above code that modifies state.
Ticket: VPP-1783
Type: fix
Signed-off-by: Christian E. Hopps <chopps@chopps.org>
Change-Id: I868784e28f994ee0922aaaae11c4894a3f4f1fe7
Signed-off-by: Christian E. Hopps <chopps@chopps.org>
(cherry picked from commit d3122ef4ecfa9a515cc39c1632d29e43fa771b2a)
Diffstat (limited to 'src/vnet/mpls')
0 files changed, 0 insertions, 0 deletions