Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29047508rwd; Wed, 5 Jul 2023 06:33:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlHiI7c5C5t1NVna/InWmPD0+P6jpignVkNQIjl31B6URK4hEafmPHPD3nOaZZegqDoqLEGg X-Received: by 2002:a17:902:d4ca:b0:1b8:936f:c346 with SMTP id o10-20020a170902d4ca00b001b8936fc346mr3148637plg.30.1688563982825; Wed, 05 Jul 2023 06:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688563982; cv=none; d=google.com; s=arc-20160816; b=u7b1UWj4y+2FKt6lZaoxRERBos+r+lUMGQ1bzUausnOJyKOvBn/HF9u5o/EfQtzQ3f OKXfGAyMYCg6u525ptnH5NS0XEv5qJG8psg5AR9bNcgo65dYq1ErJZLNtnvmjhmEGofL 1FgevZsBwwPuKGFGQNnHGmlt66wMonVjg0WPiU6NXFvDMzh3BfxQAYlzy7P16dW+GhO4 ZO/1nQchEffdoCUK+k8lv6LCThhpmGqEbifWQUfJpqwdkvtAl73sQT1hnFDSTO5/P9Ji ZFZPt00k2agFSPYT3NqnfNuj1p4sv+WXOfWOddZvxzpzqXAjF9GStPBaNU9033FHuZVD f4Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Ai6h7p9dXZHIQcQzzMGDZO/BF+myT13n9JsArvjBl20=; fh=O0Rl4x7Ls4Xs3AWeplZ9zLlXv7EbxAu/IFzlWOZFrAE=; b=Pk4Lu8vfTeH7Ry8xeiu8kmnG/9KAgq8em2EM0ETFZx0yWBGiKwiLF5M3xjdc2YxlfX i8wtL2srhCblI1qjksnG3SGM14HAio2qApMsTFN+1wBV+QMY1SeyWSiWrG3QExbwyfVU tB8g1hprGEo/edROvHAw308dLKuexvzQUxZ+FrEnGkBr4e+suYU2HHw4bO1ZyclnK0AE Qn6Qm5PWI9NSlE8y6k9HJ3Ix1Em8w2ObzOiFVhlLHhtXPDub0DJq2l/jbhc3BqjdJnvm XSH1Ee8V6vsWjhm5sm+Nk6lvATs8UYQwM5evym5SWNt3XrqKIX4bOHV4EAyV/xfO86UK iWkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=QvAuwK3O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902848300b001b22c8d0dc5si22033350plo.437.2023.07.05.06.32.47; Wed, 05 Jul 2023 06:33:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=QvAuwK3O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbjGENQ2 (ORCPT + 99 others); Wed, 5 Jul 2023 09:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbjGENQ0 (ORCPT ); Wed, 5 Jul 2023 09:16:26 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3515171C; Wed, 5 Jul 2023 06:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1688562982; bh=MQxEHzoj7/QzWcBHD3sDIDxrK5ABdydHyDEuVfPWfKw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=QvAuwK3OzpsW/IOcVjc9hI7vX9cS+8uT54rs+ziIY3srPy6v0XX5y6pbGT5RFHlZc thamGNKLCvgpITCJjLkCeD0S+b8ZqyQOhdMPfY/hHeFzdPFOFAqICsWRpdFtb/tvnM Z+woG/gDq4rrrL6xj3AKZRw5rv5jb8tBtpoBIcauw2uBhGmesekH9AzOcJk7EleZaz BgiGcCJPVQ4FxXEAX9vkG0pfGVGoxYug09CyX+92/9bAUrbM0BCBzN8Q7ycroh5Gm4 K+ec3FMW2Yvn6rrfwLFEo3wLtZ+qTdhjN6+lbXlcDVUNU3SejLXcoJZopit5E/y37s i6/Rs2t+/hVyg== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Qx0Y16QlVz1Fsy; Wed, 5 Jul 2023 09:16:21 -0400 (EDT) Message-ID: <58fa5c39-1481-58f3-9309-aa03bd3344ce@efficios.com> Date: Wed, 5 Jul 2023 09:16:50 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RFC] Bridging the gap between the Linux Kernel Memory Consistency Model (LKMM) and C11/C++11 atomics Content-Language: en-US To: Boqun Feng , Olivier Dion Cc: rnk@google.com, Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, gcc@gcc.gnu.org, llvm@lists.linux.dev References: <87ttukdcow.fsf@laura> From: Mathieu Desnoyers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/5/23 03:05, Boqun Feng wrote: > On Mon, Jul 03, 2023 at 03:20:31PM -0400, Olivier Dion wrote: > [...] >> NOTE: On x86-64, we found at least one corner case [7] with Clang where >> a RELEASE exchange is optimized to a RELEASE store, when the returned >> value of the exchange is unused, breaking the above expectations. >> Although this type of optimization respect the standard "as-if" >> statement, we question its pertinence since a user should simply do a >> RELEASE store instead of an exchange in that case. With the >> introduction of these new primitives, these type of optimizations should >> be revisited. >> > > FWIW, this is actually a LLVM bug: > > https://github.com/llvm/llvm-project/issues/60418 So it was more than a dubious optimization, it's actually broken as well. I am worried about adding to the compiler's ability to optimize those atomics because of the subtle corner-cases/bugs that can creep up. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com