Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2279728pxb; Mon, 19 Apr 2021 01:37:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0hZ+uTKGCefnfwJmE8e8/Vzylyec9BSffDvg49yHL6D2dBQEBCd+QoEeBEyzroAicvC74 X-Received: by 2002:a17:90a:e54c:: with SMTP id ei12mr23456677pjb.164.1618821469022; Mon, 19 Apr 2021 01:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618821469; cv=none; d=google.com; s=arc-20160816; b=ktaW0g7f/7X4ACRM9eGXyQWFEK5kS82UnY8b18oqodpAXsaFdBFV53uAcS6VMtH47B 8NjVhCawbYGowrGZ7UWHMuk+YN9VD/ihy1W85KGqMi7jj2g4aywr8dnFGSXGEWfTHwKi Uzr6G1anfYCIm2fUM1uB3eDhiI89wYp60IlZz6pgE28Or7PbRk7woTm52Pi3nbOuxqHu 8Axt+uVGnv20+3BIYfH6blaKRYFHmzRc/ac/tICo/0zeJ/fIHfoH9vJ5YM3zkZ0XPspM Xke+1BfeSyaacTr4Z1j+EQiBuGwg/QlbvnglPKD/CAawYkPz+BgaL9XvK0/KKFRpFMau uqEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MzstDp0klphgOp7a2sZHFPQlmjiV2TLi0ke2ptY9o0k=; b=Pz3KKXV587EsdOGTvF685SSYJF0bl18H3qEyMoZAqHpE4e41iyAdIPiuwnL1mHR1ky 3OcyUJ0jd6JNOTdJjE/pm1CJcMDt9t8R67lFKAtz0DUXX0gCn5hGd9DR+Ovl3tgNMGAj OsW7pFO0AhO8z0vUxsKgeJUohXzuiZQmUJj33FkSXRZDSN4uErfuzBW4hJ7hebPIe4uj 4JiNsRuTAETNKsIK6e747D5TAYR6+AX/v3Y/Y7KvXwUOrvZggIYMUVY2FTERBBiPWs6D 6BccTlMOcIK+Y+B/tfxZmDPZl96DFCTJWNBCF5R21JenDEb2dB7JQZz31oZt5ff1OT+2 +pRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=aC9S2N9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si17509168pjr.61.2021.04.19.01.37.35; Mon, 19 Apr 2021 01:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=aC9S2N9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbhDSIgI (ORCPT + 99 others); Mon, 19 Apr 2021 04:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238262AbhDSIf4 (ORCPT ); Mon, 19 Apr 2021 04:35:56 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE328C06174A; Mon, 19 Apr 2021 01:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MzstDp0klphgOp7a2sZHFPQlmjiV2TLi0ke2ptY9o0k=; b=aC9S2N9D2XUKcx2oukFZkmx0Ws lK/9B4aUWUI64d7CzgHYvB0yRX7gHRrEoLHHOn6e65yVn4zoVytrteYeC+VGzGI/0yGxGRrXxfoTg X2qCNDlHXGMseBgBLSVPWvet3Dh37edBEQitwC/oqx5HY3gicvhS+rseDsNNIGfaPk0VEWhtGvqge HTKvkpDbsF6bbzOW5aryOFMCkvK5qtBSzcXN34IZmn6/XYrjf2rcjZMHnwvsLMusMdnswnY2mxbIg n+M3NF+hg08LeUnFpJQuMSK8bpIb5qPM232YJ5v4boP+vqK5aSWzEyLO0OJs89m/zAgIznzizvIW9 rrreqJaw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lYPNJ-009RUB-Vt; Mon, 19 Apr 2021 08:35:22 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3AC7630020C; Mon, 19 Apr 2021 10:35:21 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 28F972C14C5BA; Mon, 19 Apr 2021 10:35:21 +0200 (CEST) Date: Mon, 19 Apr 2021 10:35:21 +0200 From: Peter Zijlstra To: Paolo Bonzini Cc: Wedson Almeida Filho , ojeda@kernel.org, Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon Subject: Re: [PATCH 00/13] [RFC] Rust support Message-ID: References: <20210414184604.23473-1-ojeda@kernel.org> <7287eac3-f492-bab1-9ea8-b89ceceed560@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 19, 2021 at 10:26:57AM +0200, Peter Zijlstra wrote: > https://godbolt.org/z/85xoPxeE5 That wants _Atomic on the seq definition for clang. > void writer(void) > { > atomic_store_explicit(&seq, seq+1, memory_order_relaxed); > atomic_thread_fence(memory_order_acquire); > > X = 1; > Y = 2; > > atomic_store_explicit(&seq, seq+1, memory_order_release); > } > > gives: > > writer: > adrp x1, .LANCHOR0 > add x0, x1, :lo12:.LANCHOR0 > ldr w2, [x1, #:lo12:.LANCHOR0] > add w2, w2, 1 > str w2, [x0] > dmb ishld > ldr w1, [x1, #:lo12:.LANCHOR0] > mov w3, 1 > mov w2, 2 > stp w3, w2, [x0, 4] > add w1, w1, w3 > stlr w1, [x0] > ret > > Which, afaict, is completely buggered. What it seems to be doing is > turning the seq load into a load-acquire, but what we really need is to > make sure the seq store (increment) is ordered before the other stores. Put differently, what you seem to want is store-acquire, but there ain't no such thing.