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 1229C3856DC8 for ; Thu, 14 Apr 2022 15:22:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1229C3856DC8 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.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-vR7oluiRMOCNtUku7kv87A-1; Thu, 14 Apr 2022 11:22:16 -0400 X-MC-Unique: vR7oluiRMOCNtUku7kv87A-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-2ef53391dbaso32089617b3.11 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=UfZRLp3DZBcQhqPGCopfKsZukGhhRPuVcQB3tf7iwT0GqVt7u1Z2QHXgRTXaa196Qe SkP1x0NTHh/IBcH8aUNL+Pl63ppO53sCIwlUfAsGbyDr4Bnoj9tGE3xXNZHHvNNxaZIj gh5K/b1TJ5g1YCIr02LACP6Hh49kPtEsLW6kBhmHWZDQMKTYFJUR/y1nuCHK7RXiW1+z sFBr4LLR0Xs9SHINn6MQbU0S3bcNEZmf5RiC2z/ocPTF3I+drKk+T1wH+teAPA8fATJL MmzcBVq1TuiRWD3QYIVkZZS3BU5nk3zODE49eJ5QydKBR/0sCcMqNDThzeDwcwC/XmS+ MOkA== X-Gm-Message-State: AOAM531jEOAqRVPySeEj2VPOVk4odWBnVMZ5wTcwtxewQBTTKqCNZNN2 HnUnUtEDQSFR1wqH0aqvt3GTvimUeDz5OxSO+qCbw68oDhTMueoqocAf9mRr3sxCOGdyXcA06PX Fg7/BKbo0+DrKTGxjAZQB8G2xoqOnpSb8eA== X-Received: by 2002:a25:6f55:0:b0:63e:7447:7c19 with SMTP id k82-20020a256f55000000b0063e74477c19mr2058025ybc.551.1649949736175; 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=-4.1 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches 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.