From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1679E3856DC9 for ; Thu, 14 Apr 2022 15:22:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1679E3856DC9 Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-398-DLRmqTybOcyRKJsuLcWRAA-1; Thu, 14 Apr 2022 11:22:16 -0400 X-MC-Unique: DLRmqTybOcyRKJsuLcWRAA-1 Received: by mail-yb1-f197.google.com with SMTP id h16-20020a056902009000b00628a70584b2so4568659ybs.6 for ; Thu, 14 Apr 2022 08:22:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aFgSUlSsKrlEjgpLXJ4Ih+dB2ZCC76QdV8rh+22cpww=; b=CNIipauw/4uo82J2WnmnEGXI7KeGfv2WRpNdXIDsQRhSb0BYSGY0t7Du1x6U+eG9g6 JE8dQbdmaIlghtcKiOyVJ19Mvx1C04x1bO5WfMSm835KDoGhAQam/VJrcad373F02OMR VXgD8goBscQ29zr3kC3I1rrUKAwEzc7auGdAg51wMrU+N4iLvt4szE+YXksSvEvHevq6 JSv1EY5LW52cy08gkGukubTjt1X/kARxDcJc+A8EejKapJ6Qm7gXFQyS3Lz9VBZv7Jw1 Th/oiekNIEIRFrMNljfWBjAnDwC7Jci9LZXVnbBskA1JVPsfw8m9TJO08aeu59/J5hLP VZ3g== X-Gm-Message-State: AOAM530usR30Qs718gedaaCTvrKUnYRpSsSBqj6P/NYc1/6pAdBfmjP/ zDnaG2laKx8EtUTzY5YTSbTHCO9syn/NFEetusk+HG/CBYBHEiy7xp4Ruy3GAPyZcc63CJquYv3 pFppN9IF8HE0Ewmb3fahpGHOt1Ef/IfQ= X-Received: by 2002:a25:6f55:0:b0:63e:7447:7c19 with SMTP id k82-20020a256f55000000b0063e74477c19mr2058026ybc.551.1649949736176; Thu, 14 Apr 2022 08:22:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytgYd2K94Jn673XfpFKndhvbBca6/qt/ZWCLxaM8f/BTmAp6l62+ATlJmTVBRNqCTXUL5PmGT69n8cByK8cjo= X-Received: by 2002:a25:6f55:0:b0:63e:7447:7c19 with SMTP id k82-20020a256f55000000b0063e74477c19mr2058011ybc.551.1649949735919; Thu, 14 Apr 2022 08:22:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 14 Apr 2022 16:22:05 +0100 Message-ID: Subject: Re: [PATCH v1] libstdc++: Default to mutex-based atomics on RISC-V To: Palmer Dabbelt Cc: gcc Patches , "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 15:22:19 -0000 On Thu, 14 Apr 2022 at 16:18, Palmer Dabbelt wrote: > > On Thu, 14 Apr 2022 08:08:17 PDT (-0700), jwakely@redhat.com wrote: > > On 07/04/22 11:46 -0700, Palmer Dabbelt wrote: > >>The RISC-V port requires libatomic to be linked in order to resolve > >>various atomic functions, which results in builds that have > >>"--with-libstdcxx-lock-policy=auto" defaulting to mutex-based locks. > >>Changing this to direct atomics breaks the ABI, this forces the auto > >>detection mutex-based atomics on RISC-V in order to avoid a silent ABI > >>break for users. > >> > >>See Bug 84568 for more discussion. In the long run there may be a way > >>to get the higher-performance atomics without an ABI flag day, but > >>that's going to be a much more complicated operation. We don't even > >>have support for the inline atomics yet, but given that some folks have > >>been discussing hacks to make these libatomic routines appear implicitly > >>it seems prudent to just turn off the automatic detection for RISC-V. > >> > >>libstdc++-v3/ChangeLog > >> > >> * acinclude.md (GLIBCXX_ENABLE_LOCK_POLICY): Force auto to mutex > >> for RISC-V. > > > > As documented at https://gcc.gnu.org/lists.html all patches for > > libstdc++ need to go to the libstdc++ list as well as gcc-patches > > (otherwise I won't see them). > > Thanks, I'll try to remember to look next time. > > > We'd usually do something like: > > > > case "${host}" in > > *-*-riscv) libstdcxx_atomic_lock_policy=mutex ;; > > *-*-*) AC_TRY_COMPILE([ ... ],,[],[]) > > esac > > > > but this way is simpler. If we add more customization for other > > targets we can reconsider using the 'case "${host}"' form. > > Ya, that's kind of where I came to as well -- the proper autoconf flavor > would scale way better, but hopefully nobody else makes this mistake and > thus we don't need to worry about that. > I'm fine with either way (though I think we'd need a "riscv*" there, to > match riscv32 and riscv64?), so if you want to swap it over (or have me > re-spin this) it's no big deal on my end -- also fine, as per below, > with you just committing this ;) Yeah, I figured *-*-riscv probably wasn't right, so that's another reason to prefer your approach. > > > So this is OK for trunk, modulo regenerating libstdc++-v3/configure > > with this change. Let me know if you want me to do that regen for you > > (or commit the whole thing for you). > > That'd be great, thanks! It usually takes me a while to get all the > autotools versions lined up (we just got new machines at the office), > that way I won't have to do so. No problem, I can regen+push for you.