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.129.124]) by sourceware.org (Postfix) with ESMTPS id 0CA77385735B for ; Thu, 14 Apr 2022 16:39:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0CA77385735B Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-vgNDwRrVPlGn3qkbHHJPBg-1; Thu, 14 Apr 2022 12:39:46 -0400 X-MC-Unique: vgNDwRrVPlGn3qkbHHJPBg-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-2ec1914e315so46654107b3.23 for ; Thu, 14 Apr 2022 09:39:46 -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=4cEVzs8eTN3dvJaWkEsDilOwBbooq803hAVz8+//Zw0=; b=WAoGnkwiJ6akjmBw0ZXnH0opze9OQgOq2FoV/JwGPvggf528mh9CddH2N1hHpQmboU IiBFyxl55IF4fDZucpr9yU7QuFIJSuXMe6cJ4C1aThpARS/mrt/X+5dwiXTAdg171ie/ 90iWbk5TXG52Nexf/b0Bt63WVrnjRBTXpGBi1D4uGg1tyt6QBmML8imdgoy0aNnoRmdS 8/elqbTRkprUYfoZ8FG8riosKFvqpudufdSaSymUZ+XfsuH87zIhef74ncV6cWw1pQMB NW/Mb3a5IffR124gZjnB7nX9uVCNYQ2O/R6D6BorKfFIrKPRUgaEkQJ7cpt6S0yVmlct PzDw== X-Gm-Message-State: AOAM531jBQLCkvbVeoli2JeH+PjUtGhTanfA/JP94uZEMr0mvQYPuMdI 1ZD613Bnu2Ja1PCr6x63SGSxScpxqb2h9mLiTYddR+P+arny6kHpVe1SFdfBiVYUOeu3WmszcKP zaiqgmAMy8MeP/QLooDE+Dm6VK2aaYNw= X-Received: by 2002:a81:16cb:0:b0:2eb:f4c2:fadd with SMTP id 194-20020a8116cb000000b002ebf4c2faddmr2671085yww.475.1649954386184; Thu, 14 Apr 2022 09:39:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG5tMqPh8/FjoMjF2t8gYWmTtXRiKf4Z8f/OD8x03hdY7Vl+fPHeyLSnSbOkQdH5xE50FOtsDatI3k1S7TbTA= X-Received: by 2002:a81:16cb:0:b0:2eb:f4c2:fadd with SMTP id 194-20020a8116cb000000b002ebf4c2faddmr2671072yww.475.1649954385969; Thu, 14 Apr 2022 09:39:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 14 Apr 2022 17:39:34 +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_H4, 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 16:39:53 -0000 On Thu, 14 Apr 2022 at 16:24, Palmer Dabbelt wrote: > > On Thu, 14 Apr 2022 08:22:05 PDT (-0700), jwakely@redhat.com wrote: > > 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. > > Great, thanks! Pushed as r12-8161-g3fc22eedb033cb