> On Oct 2, 2019, at 6:48 PM, Ranadip Das <ranadip....@gmail.com> wrote:
> 
> Hello,
> 
> I am seeing vlib_node_add_next is getting used in two different ways.
> 
> vlib_node_add_next(vm, node_index, next_node_index);
> 
> And
> 
> foreach_vlib_main (({
>      next_index = vlib_node_add_next (this_vlib_main, node_index, 
> next_node_index);
> }));
> 
> The first one (without foreach_vlib_main) calls vlib_node_add_next only for 
> the current vm.
> Does it mean that the other workers will not have the node_index to 
> next_node_index edge in the node graph?
> 

vlib_node_add_next as it's final action calls:

vlib_worker_thread_node_runtime_update (void)
{
  /*
   * Make a note that we need to do a node runtime update
   * prior to releasing the barrier.
   */
  vlib_global_main.need_vlib_worker_thread_node_runtime_update = 1;
}

As this comment indicates (and infers) the code expects to be inside the thread 
barrier which means all work threads are waiting for the barrier to be 
released. When the barrier holder releases the barrier it first checks the 
above flag and if set sets "reforks" to the number of worker threads, then 
releases the barrier. Each worker thread will, upon being released from the 
barrier, see that "reforks" is set and update (thus in parallel) it's copy of 
the graph and runtime data, decrementing reforks and then waiting for reforks 
to reach zero before continuing on.

I don't actually see the foreach code you quote above, but I'm looking at 
stable/1908 right now. Doesn't jive with my understanding of the code.
Thanks,
Chris.


> regards!!
> _RD
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> 
> View/Reply Online (#14101): https://lists.fd.io/g/vpp-dev/message/14101
> Mute This Topic: https://lists.fd.io/mt/34376308/1826170
> Mute #vpp: https://lists.fd.io/mk?hashtag=vpp&subid=3963883
> Group Owner: vpp-dev+ow...@lists.fd.io
> Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [cho...@chopps.org]
> -=-=-=-=-=-=-=-=-=-=-=-

Attachment: signature.asc
Description: Message signed with OpenPGP

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#14102): https://lists.fd.io/g/vpp-dev/message/14102
Mute This Topic: https://lists.fd.io/mt/34376308/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp&subid=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to