From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 87ABA3985402; Thu, 29 Oct 2020 10:19:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87ABA3985402 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/97461] [11 Regression] allocate_gcov_kvp() deadlocks in firefox LTO+PGO build (overridden malloc() recursion) Date: Thu, 29 Oct 2020 10:19:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2020 10:19:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97461 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #14 from Martin Li=C5=A1ka --- (In reply to Sergei Trofimovich from comment #13) > Tried firefox-82 with LTO+PGO today on gcc-11-4428-g4a369d199bf. It gets a > lot more forward, but still gets stuck. This time on > free()->allocate_gcov_kvp ()->alloc() deadloc. Hmm, that's quite unpleasant. Anyway, thanks for testing that. >=20 > The backtrace: >=20 > (gdb) bt > #0 __lll_lock_wait (futex=3D0x7ffff7800018, private=3D0) at lowlevellock= .c:52 > #1 0x00007ffff7f69305 in __GI___pthread_mutex_lock (mutex=3D0x7ffff78000= 18) > at ../nptl/pthread_mutex_lock.c:135 > #2 0x00005555555b2151 in arena_t::MallocSmall(unsigned long, bool) () > #3 0x00005555555b307c in arena_t::Malloc(unsigned long, bool) () > #4 0x00005555555b41f2 in calloc () > #5 0x00005555556a49ab in allocate_gcov_kvp () at > /var/tmp/portage/sys-devel/gcc-11.0.0_pre9999/work/gcc-11.0.0_pre9999/lib= gcc/ > libgcov.h:431 > #6 gcov_topn_add_value (count=3D1, use_atomic=3D1, increment_total=3D1, > value=3D496, counters=3D0x5555557158c0 > <__gcov3._ZL20arena_run_reg_dallocP11arena_run_tP11arena_bin_tPvm>) > at > /var/tmp/portage/sys-devel/gcc-11.0.0_pre9999/work/gcc-11.0.0_pre9999/lib= gcc/ > libgcov.h:477 > #7 __gcov_topn_values_profiler_body (use_atomic=3D1, value=3D496, > counters=3D0x5555557158c0 > <__gcov3._ZL20arena_run_reg_dallocP11arena_run_tP11arena_bin_tPvm>) > at > /var/tmp/portage/sys-devel/gcc-11.0.0_pre9999/work/gcc-11.0.0_pre9999/lib= gcc/ > libgcov-profiler.c:103 > #8 __gcov_topn_values_profiler_atomic (counters=3D0x5555557158c0 > <__gcov3._ZL20arena_run_reg_dallocP11arena_run_tP11arena_bin_tPvm>, > value=3D496) > at > /var/tmp/portage/sys-devel/gcc-11.0.0_pre9999/work/gcc-11.0.0_pre9999/lib= gcc/ > libgcov-profiler.c:128 > #9 0x00005555555b1065 in arena_t::DallocSmall(arena_chunk_t*, void*, > arena_chunk_map_t*) () > #10 0x00005555555b166c in free () > #11 0x00007fffe1b0ef1a in CollectProcessInfo(ProcessInfo&) () at > /home/slyfox/tmp/portage/www-client/firefox-82.0/work/firefox_build/ > instrumented/dist/firefox/libxul.so > #12 0x00007fffea0afa72 in PreRecordMetaInformation() () at > /home/slyfox/tmp/portage/www-client/firefox-82.0/work/firefox_build/ > instrumented/dist/firefox/libxul.so > #13 0x00007fffea0b28c8 in profiler_shutdown(IsFastShutdown) () at > /home/slyfox/tmp/portage/www-client/firefox-82.0/work/firefox_build/ > instrumented/dist/firefox/libxul.so > #14 0x00007fffea7c6aa0 in XREMain::XRE_main(int, char**, > mozilla::BootstrapConfig const&) () > at > /home/slyfox/tmp/portage/www-client/firefox-82.0/work/firefox_build/ > instrumented/dist/firefox/libxul.so > #15 0x00007fffea7c7543 in XRE_main(int, char**, mozilla::BootstrapConfig > const&) () at > /home/slyfox/tmp/portage/www-client/firefox-82.0/work/firefox_build/ > instrumented/dist/firefox/libxul.so > #16 0x00007fffea7cfbd0 in mozilla::BootstrapImpl::XRE_main(int, char**, > mozilla::BootstrapConfig const&) () > at > /home/slyfox/tmp/portage/www-client/firefox-82.0/work/firefox_build/ > instrumented/dist/firefox/libxul.so > #17 0x000055555559a370 in do_main(int, char**, char**) () > #18 0x00005555555980a1 in main () Can you please run in gdb how many times is allocate_gcov_kvp called before we reach the deadlock? >=20 > Worth filing a new bug, or this would be good enough? We can stay with this PR as it contains useful discussion. Anyway, one another fix can be usage of the suggested __gcov_supress_malloc/__gcov_allow_malloc that will be used in an alternative memory allocator..=