From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.rbg.tum.de (mailout2.rbg.tum.de [IPv6:2a09:80c0::202]) by sourceware.org (Postfix) with ESMTPS id ECEA43858C66 for ; Tue, 22 Nov 2022 09:12:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ECEA43858C66 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=in.tum.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=in.tum.de Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout2.rbg.tum.de (Postfix) with ESMTPS id 808A24C0273; Tue, 22 Nov 2022 10:12:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.tum.de; s=20220209; t=1669108328; bh=7QlOTe9lQ7+g2n9VGHTcdjq18zwkKhSMkO9oDTNFb1g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fz1sRz0a1d2eKGvtsw6yr9Sit7JOW6vq6VB3zC4b9GRFbHOon/Bg8pcLPraiovE1w Z8auXCEt92MyHpd3NlPoVX36ixqCoWC+tWyCCSN93JQgkZKoCsD/M7vnD55Y9cqwCB tAwxq8qusBIXK5xikkzMHBtBQHlETstyurL+RtXfsmP44atYlsaR+mtXpJn/1aUXJu EVlnqwx7yHmMAJVgzlximoyhoPBub7bz1Ycx02+w8K/6EYEd8k4VgkY5gE8wKJej9R BP7gVX6I8HV+TVcxppcN/2N5kq1FBWvhzqmtcMw46y5ye0RAwHZ6778HUpz6G08rBb R12t+WZv/2TNA== Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 7A3DF85; Tue, 22 Nov 2022 10:12:08 +0100 (CET) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 24712DD; Tue, 22 Nov 2022 10:12:08 +0100 (CET) Received: from mail.in.tum.de (mailproxy.in.tum.de [IPv6:2a09:80c0::78]) by mailrelay1.rbg.tum.de (Postfix) with ESMTPS id 1F2B122; Tue, 22 Nov 2022 10:12:08 +0100 (CET) Received: by mail.in.tum.de (Postfix, from userid 112) id 19E174A01A8; Tue, 22 Nov 2022 10:12:08 +0100 (CET) Received: (Authenticated sender: neumann) by mail.in.tum.de (Postfix) with ESMTPSA id 88B074A031D; Tue, 22 Nov 2022 10:12:07 +0100 (CET) (Extended-Queue-bit xtech_ez@fff.in.tum.de) Message-ID: <95d6d5eb-2dcc-e085-965c-d4cba1fa1cf6@in.tum.de> Date: Tue, 22 Nov 2022 10:12:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH v4] eliminate mutex in fast path of __register_frame Content-Language: en-US To: Florian Weimer Cc: "H.J. Lu" , Jakub Jelinek , Tamar Christina , "gcc-patches@gcc.gnu.org" , Jason Merrill , Jonathan Wakely References: <2a4776b9-9271-bb3c-a626-d5ec22dae6f3@in.tum.de> <91045a34-a534-4436-bb06-cac32d797a36@in.tum.de> <87sfibqu1s.fsf@oldenburg.str.redhat.com> From: Thomas Neumann In-Reply-To: <87sfibqu1s.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,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: > Would it be possible to trigger lazy registration if the version is read > as a zero? This would not introduce any additional atomic instructions > on the fast path. yes, that is possible. The main problem is the transition from lazy to non-lazy mode when the first exception is thrown. We must somehow stop the world for that without introducing an additional mutex. But I have though about that some more, and that is possible too, by encoding a magic value as version during the transition, which causes the other threads to block. A bit ugly, but manageable. I will implement that in a few days. Independent of that I think we should improve the sort logic, as we still have to sort, even in lazy mode, at latest when the first exception is thrown. I have send a patch that significantly improves that step. Best Thomas