Skip to content

Commit

Permalink
call ovsrcu_exit() before exit in ovn-northd and ovn-controller to ma…
Browse files Browse the repository at this point in the history
…ke valgrind happy

You can check logs by running: make check-valgrind TESTSUITEFLAGS="246"

(Actually almost every test affected but for example we need one test)

Valgrind message looks like

==65437== 304 bytes in 1 blocks are possibly lost in loss record 265 of 289
==65437==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==65437==    by 0x40149DA: allocate_dtv (dl-tls.c:286)
==65437==    by 0x40149DA: _dl_allocate_tls (dl-tls.c:532)
==65437==    by 0x4BE2322: allocate_stack (allocatestack.c:622)
==65437==    by 0x4BE2322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==65437==    by 0x283D46: ovs_thread_create (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x27FFB0: ovsrcu_quiesced (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x28000B: ovsrcu_quiesce_start (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x2AFE04: time_poll (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x2A16A2: poll_block (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x165019: pinctrl_handler (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x283BB1: ovsthread_wrapper (in /home/ivzhukov/upstream/ovn/controller/ovn-controller)
==65437==    by 0x4BE1608: start_thread (pthread_create.c:477)
==65437==    by 0x4F5F132: clone (clone.S:95)

or

==63926== 304 bytes in 1 blocks are possibly lost in loss record 128 of 130
==63926==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==63926==    by 0x40149DA: allocate_dtv (dl-tls.c:286)
==63926==    by 0x40149DA: _dl_allocate_tls (dl-tls.c:532)
==63926==    by 0x4BE2322: allocate_stack (allocatestack.c:622)
==63926==    by 0x4BE2322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==63926==    by 0x24EE4B: ovs_thread_create (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x24CB63: ovsrcu_quiesced (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x24CBBE: ovsrcu_quiesce_start (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x276DE6: time_poll (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x26BA03: poll_block (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x26A9FD: stopwatch_thread (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x24ECB6: ovsthread_wrapper (in /home/ivzhukov/upstream/ovn/northd/ovn-northd)
==63926==    by 0x4BE1608: start_thread (pthread_create.c:477)
==63926==    by 0x4F5F132: clone (clone.S:95)

I also noticed that ovs-vswitchd calls ovsrcu_exit() before exit: https://github.com/openvswitch/ovs/blob/0187eadfce4505d502e57c0e688b830f0a1ec728/vswitchd/ovs-vswitchd.c#L150

I also stopped a thread pool by calling run_update_worker_pool(0); because ovsrcu_exit(); stucks without it.

Signed-off-by: Igor Zhukov <ivzhukov@sbercloud.ru>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
fsb4000 authored and putnopvut committed Jun 9, 2023
1 parent 9bed5b2 commit 6849811
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions controller/ovn-controller.c
Expand Up @@ -4277,6 +4277,7 @@ main(int argc, char *argv[])
ovs_feature_support_destroy();
free(ovs_remote);
service_stop();
ovsrcu_exit();

exit(retval);
}
Expand Down
3 changes: 3 additions & 0 deletions northd/ovn-northd.c
Expand Up @@ -32,6 +32,7 @@
#include "lib/ovn-l7.h"
#include "lib/ovn-nb-idl.h"
#include "lib/ovn-sb-idl.h"
#include "lib/ovs-rcu.h"
#include "openvswitch/poll-loop.h"
#include "simap.h"
#include "stopwatch.h"
Expand Down Expand Up @@ -951,6 +952,8 @@ main(int argc, char *argv[])
ovsdb_idl_loop_destroy(&ovnnb_idl_loop);
ovsdb_idl_loop_destroy(&ovnsb_idl_loop);
service_stop();
run_update_worker_pool(0);
ovsrcu_exit();

exit(res);
}
Expand Down

0 comments on commit 6849811

Please sign in to comment.