From: Dimitar Dimitrov <dimitar@dinux.eu>
To: Thomas Neumann <thomas.neumann@in.tum.de>
Cc: gcc-patches@gcc.gnu.org, Jason Merrill <jason@redhat.com>,
Florian Weimer <fweimer@redhat.com>,
Jakub Jelinek <jakub@redhat.com>,
Jonathan Wakely <jwakely.gcc@gmail.com>
Subject: Re: [PATCH v4] eliminate mutex in fast path of __register_frame
Date: Sun, 18 Sep 2022 11:59:54 +0300 [thread overview]
Message-ID: <YybeCrbTSerRia36@kendros> (raw)
In-Reply-To: <2a4776b9-9271-bb3c-a626-d5ec22dae6f3@in.tum.de>
On Fri, Sep 16, 2022 at 12:19:36PM +0200, Thomas Neumann via Gcc-patches wrote:
> The __register_frame/__deregister_frame functions are used to register
> unwinding frames from JITed code in a sorted list. That list itself
> is protected by object_mutex, which leads to terrible performance
> in multi-threaded code and is somewhat expensive even if single-threaded.
> There was already a fast-path that avoided taking the mutex if no
> frame was registered at all.
>
> This commit eliminates both the mutex and the sorted list from
> the atomic fast path, and replaces it with a btree that uses
> optimistic lock coupling during lookup. This allows for fully parallel
> unwinding and is essential to scale exception handling to large
> core counts.
>
> Changes since v3:
> - Avoid code duplication by adding query mode to classify_object_over_fdes
> - Adjust all comments as requested
>
> libgcc/ChangeLog:
>
> * unwind-dw2-fde.c (release_registered_frames): Cleanup at shutdown.
> (__register_frame_info_table_bases): Use btree in atomic fast path.
> (__deregister_frame_info_bases): Likewise.
> (_Unwind_Find_FDE): Likewise.
> (base_from_object): Make parameter const.
> (classify_object_over_fdes): Add query-only mode.
> (get_pc_range): Compute PC range for lookup.
> * unwind-dw2-fde.h (last_fde): Make parameter const.
> * unwind-dw2-btree.h: New file.
> ---
> libgcc/unwind-dw2-btree.h | 953 ++++++++++++++++++++++++++++++++++++++
> libgcc/unwind-dw2-fde.c | 195 ++++++--
> libgcc/unwind-dw2-fde.h | 2 +-
> 3 files changed, 1098 insertions(+), 52 deletions(-)
> create mode 100644 libgcc/unwind-dw2-btree.h
>
Hi Thomas,
This patch broke avr and pru-elf cross builds:
gcc/libgcc/unwind-dw2-fde.c:680:28: error: unknown type name ‘uintptr_t’
680 | uintptr_t *range)
Should uintptr_t be replaced with __UINTPTR_TYPE__? Such change fixes the
above broken builds for me. But I'm not sure how valid it is for that
part of libgcc.
Other embedded targets like arm-none-eabi are not broken because they
overwrite LIB2ADDEH, and consequently unwind-dw2-fde.c is not built for
them.
Regards,
Dimitar
next prev parent reply other threads:[~2022-09-18 9:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 10:19 Thomas Neumann
2022-09-16 14:49 ` Jason Merrill
2022-09-18 8:59 ` Dimitar Dimitrov [this message]
2022-09-18 9:20 ` Thomas Neumann
2022-09-18 10:02 ` Thomas Neumann
2022-09-19 13:46 ` Stephan Bergmann
2022-09-19 13:55 ` Thomas Neumann
2022-09-19 14:00 ` Stephan Bergmann
2022-09-19 15:33 ` Thomas Neumann
2022-09-20 5:39 ` Stephan Bergmann
2022-11-21 11:14 ` Tamar Christina
2022-11-21 11:22 ` Thomas Neumann
2022-11-21 11:48 ` Jakub Jelinek
2022-11-21 17:13 ` H.J. Lu
2022-11-22 0:31 ` Thomas Neumann
2022-11-22 8:20 ` Florian Weimer
2022-11-22 9:12 ` Thomas Neumann
2022-12-09 17:34 ` [PATCH] initialize fde objects lazily Thomas Neumann
2022-12-15 16:11 ` Tamar Christina
2022-12-16 17:25 ` Jason Merrill
2023-05-02 14:32 ` [PATCH] release the sorted FDE array when deregistering a frame [PR109685] Thomas Neumann
2023-05-10 10:49 ` [PATCH] fix radix sort on 32bit platforms [PR109670] Thomas Neumann
2023-08-10 11:33 ` [PATCH] preserve base pointer for __deregister_frame [PR110956] Thomas Neumann
2023-08-11 15:21 ` Jeff Law
2024-03-15 10:29 ` [PATCH] handle unwind tables that are embedded within unwinding code, [PR111731] Thomas Neumann
2024-03-20 8:25 ` Richard Biener
2024-03-22 13:35 ` Jeff Law
2024-03-22 13:36 ` Jeff Law
2024-03-22 14:43 ` Thomas Neumann
2022-11-22 8:00 ` [PATCH] speed up end_fde_sort using radix sort Thomas Neumann
2022-12-16 18:02 ` Jason Merrill
2022-11-21 11:49 ` [PATCH v4] eliminate mutex in fast path of __register_frame Tamar Christina
2022-11-21 11:53 ` Thomas Neumann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YybeCrbTSerRia36@kendros \
--to=dimitar@dinux.eu \
--cc=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
--cc=jwakely.gcc@gmail.com \
--cc=thomas.neumann@in.tum.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).