public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] gcov: Fix -fprofile-update=atomic
Date: Fri, 16 Dec 2022 11:39:54 +0100	[thread overview]
Message-ID: <a822810d-2b95-0ad1-5991-1f5246c66859@embedded-brains.de> (raw)
In-Reply-To: <CAFiYyc0-1mgZr8Ne078HuiLbdAo1E1nTgNngKRhNSeFvTZNMJA@mail.gmail.com>

On 16.12.22 10:47, Richard Biener wrote:
>> No, if you select -fprofile-update=atomic, then the updates shall be
>> atomic from my point of view. If a fallback is acceptable, then you can
>> use -fprofile-update=prefer-atomic. Using the fallback in
>> -fprofile-update=atomic is a bug which prevents the use of gcov for
>> multi-threaded applications on the lower end targets which do not have
>> atomic operations in hardware.
> Ah, OK.  So the fallback there is libatomic calls as well then?  Note
> not all targets support libatomic, for those the failure mode is likely
> a link error (which might be fine, but we eventually might want to
> amend documentation to indicate this failure mode).

It seems these library calls caused issues in the past:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77466

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77378

One option could be to emit calls to a new libgcov function:

__gcov_inc_counter(counter) -> updated value

This function could use a __gthread_mutex_t mutex for updates. This ends 
up probably with quite a bad performance.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

  reply	other threads:[~2022-12-16 10:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 13:56 Sebastian Huber
2022-12-13 14:30 ` Richard Biener
2022-12-15  8:34   ` Sebastian Huber
2022-12-16  9:47     ` Richard Biener
2022-12-16 10:39       ` Sebastian Huber [this message]
2022-12-16 12:09         ` Richard Biener
2022-12-16 13:01           ` Sebastian Huber

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=a822810d-2b95-0ad1-5991-1f5246c66859@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).