From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 745C93852A40 for ; Fri, 16 Dec 2022 12:09:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 745C93852A40 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x131.google.com with SMTP id p36so3135669lfa.12 for ; Fri, 16 Dec 2022 04:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VKurveaKezg+m4tuXraAN9m93zaf+UC3+U0zUMVZgvc=; b=plLtIRbxNxVlq/lY+tSdgbY83lCMl15WUxdqusFS7psVTUcDo278R7B0uPnWaVSJI7 Ame4HzAlkrzOktNUjW99QEoyrI05ay+HWC2sdDvkImGtNQ/KUQ6WzobIW1plRdf+n934 Tq9/bHAUl9iYhWtFsrEv/8HZyUvfUM6LOQu8UK8UeYPHufpVBHRbevtKkNJs6JbCzIlf 9zSN4W7ZIP2+VJDhNvqeBq5CzXmpy6CUr5ZliglZ2K67j9A9ZmREGP7feCdt/p2gLlP2 UDyvKVOMqjreCryPtz5rJ+NolodU38iYBLfvCT1ZJUYAzBlx/9qvxvUZXOqgvv+yajG9 Vxxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VKurveaKezg+m4tuXraAN9m93zaf+UC3+U0zUMVZgvc=; b=fQdcREIMPSFHcT6zunvxUBHHB2GPCWHcNMcUQMuHktn6LGuucWdkRf0/Wgd8mpTCzF FEiQcTmLWbtF8GWJ1xjCxEQOWBHo5qsOP0WW4DjqMpKtpk0zJpiBYyL1IQDID9lU80GA WZEyXbbuaXSEPF+/CbZetIhl7z/u1bPdTO0A5aK2IwPJ51OgqYby4b3ekJiGyebx7VyU 0PX4b5+w5vHu/2FgdftHX68zj9FlnXT4cpzVcJfZjre0+CS/H4XLnduWP2xRnIGpMCsT Kv6yqpiFEKslCG6z0WpBJ8KIcdVr/h0qNxiesN6/2DhueYkiZrio3hDD0T/kXwZOQzgF +e4g== X-Gm-Message-State: ANoB5pl5HDOluCBka5nB+Q0/kCi6fFn3UIf2TlDM/bNoDOxV6MCvZz8H EaO0Ceiz/wOErobXHk6wX9SLGHVhAtMUIleArTE= X-Google-Smtp-Source: AA0mqf4+VcX4bJqPPUoOVxAE0rMFcOQbonMyOTpG2A0X/6gGlw/+HGYmSgmxKJnknGZp32j19mv4ypqELVPMYx7KZkU= X-Received: by 2002:a05:6512:22cb:b0:4b6:e3d5:a8cb with SMTP id g11-20020a05651222cb00b004b6e3d5a8cbmr1128619lfu.448.1671192563972; Fri, 16 Dec 2022 04:09:23 -0800 (PST) MIME-Version: 1.0 References: <20221209135609.55159-1-sebastian.huber@embedded-brains.de> <2d6f0cf1-f979-b3a6-6daa-81fc0882a1d7@embedded-brains.de> In-Reply-To: From: Richard Biener Date: Fri, 16 Dec 2022 13:09:11 +0100 Message-ID: Subject: Re: [PATCH] gcov: Fix -fprofile-update=atomic To: Sebastian Huber Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Dec 16, 2022 at 11:39 AM Sebastian Huber wrote: > > On 16.12.22 10:47, Richard Biener wrote: > >> No, if you select -fprofile-update=3Datomic, then the updates shall be > >> atomic from my point of view. If a fallback is acceptable, then you ca= n > >> use -fprofile-update=3Dprefer-atomic. Using the fallback in > >> -fprofile-update=3Datomic 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=3D77466 > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D77378 Hmm, those are testsuite-isms in some way but of course users would run into the same issue, needing explicit -latomic (where available). I suppose target specs could automatically add that for -fprofile-update=3Datomic but this would need to be specified at link time as well then. > 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. But that's eventually what libatomic will do as well as fallback. I don't have a good idea here. Do you have to explicitely link -latomic on RISCV? Richard. > -- > 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=C3=BCnchen > Registernummer: HRB 157899 > Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler > Unsere Datenschutzerkl=C3=A4rung finden Sie hier: > https://embedded-brains.de/datenschutzerklaerung/