Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3031195lqp; Mon, 25 Mar 2024 17:50:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUe0u0a3g8D9UJRV/QAujlPi7tHuQ55CSOZgdFUi4gNvRhWdRDeYIXMXJkijx7BPun34MD447fjDfJG0C0xzbjrt4sBAwopuSqk3TkVVg== X-Google-Smtp-Source: AGHT+IGbymyTdcREVEdBhZd//OW5WvGIqH0IGGDh/uKJM5dnbGetonCDIDb3YVR76ErVzmAK8z3O X-Received: by 2002:a50:954f:0:b0:565:dfac:a686 with SMTP id v15-20020a50954f000000b00565dfaca686mr5275644eda.38.1711414202357; Mon, 25 Mar 2024 17:50:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711414202; cv=pass; d=google.com; s=arc-20160816; b=UyBZAomtjTfUYfedgTvsu6VRY8WCqlt3/k2paNPg76jRjdZKepyJ5Mn2pzbrOiqhxG F3C9Mq/NMbm7l+NS7rao2rrXmDVW81nC391rWszL+EDR1h/THslIfESCNrNXM2Llw204 i8nnzd8ZUP64hUCOUg9nolEEhHGOebVQC59KpjS+zzjc8mWrSsH3WZMAZvswmQWyqFWd pspnyI+EjqEMXsfu3wscdJWtwZNgwWw980W7IOlbp2fWbc0Apuz+hlCpkWuURKa/2ukk YALtdNKGiInsGgKlHIyxUgMh92Bnusbl3+DVPyOIUezCCJE+D4Tif03qlh1iBTvozBjX KQNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=LuYyrQMyWGMOwe8OrvTO4BN9gtnvAnON7zt9Ixqpfy0=; fh=viOGMbF9TBa5UDdifilfsulvNDMr22UZPA75r55Xcr0=; b=pYQ1p2WyWV4DQFYE+alG84qKWql+RudweDGfecBXvOCOR/+2DEV9UVfbwBAb7YJm/l tqhIxH5rkAf3RCQ/dEQJhY/LNOgup100hcimrTQ++RtFg8MlK6GnEyY287zuPdUXHb0w jbTDMNuNRSJJXw86DxZB7gQcL9wjuylqZ9ZIhYfUv0MIAEt+pdCS1Yc/2JvRAKwRxoj4 aJepyaugJWiEFe/h2UOA/572hhe/XddHD+dLZQCc/JabjVRey9zeVoxMxCLPUbRVGF28 0NRwKTD1WK78fC5TRw7FqJo1OqH93OSlQkyBX3lTftG21HVO/dxqEzckrL3uCBqLZO1U mfTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@treblig.org header.s=bytemarkmx header.b=UEqU8gaE; arc=pass (i=1 spf=pass spfdomain=treblig.org dkim=pass dkdomain=treblig.org dmarc=pass fromdomain=treblig.org); spf=pass (google.com: domain of linux-kernel+bounces-118224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=treblig.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c11-20020a509f8b000000b0056b36524375si2977544edf.657.2024.03.25.17.50.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 17:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@treblig.org header.s=bytemarkmx header.b=UEqU8gaE; arc=pass (i=1 spf=pass spfdomain=treblig.org dkim=pass dkdomain=treblig.org dmarc=pass fromdomain=treblig.org); spf=pass (google.com: domain of linux-kernel+bounces-118224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=treblig.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E3FB71F3EED4 for ; Tue, 26 Mar 2024 00:50:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2E281C69A; Tue, 26 Mar 2024 00:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=treblig.org header.i=@treblig.org header.b="UEqU8gaE" Received: from mx.treblig.org (mx.treblig.org [46.235.229.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B5622F5E; Tue, 26 Mar 2024 00:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.229.95 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711414187; cv=none; b=PiSFtbcINPRJfrXdLD/AzGezBZjseZNFekB1RGzrVOXSK789cmPtWFFK1fTt4ppLP9I9GeFEB8vdwILewckMunRRyp0bO+fqwM0Os5NXXhzLkczPH3aVjzlwhpg9ooNeFYM0ejD61QToM9pXyV7YHAaIQIRE5KexphO3xBS+xDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711414187; c=relaxed/simple; bh=J28s9rQt90wDxj1wBF0s5KRA+1w6ylx+IcrcZNAD8Os=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IPC5up8+fmrsT1a3WzqHKn8ga06sW6xr0bHZen7pK6nBnRFzBqtDh/vmj0T0GmXhS21warX5GsCcA2htnYBnhz0o0bAZGgaSlCr+uW/pwyOmaAn0JtzPsrohD3QuVCvPQDhYJtN+mxZLWPSS8znOrbw2KNxQA/R0fiYCNgQMWDY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=treblig.org; spf=pass smtp.mailfrom=treblig.org; dkim=pass (2048-bit key) header.d=treblig.org header.i=@treblig.org header.b=UEqU8gaE; arc=none smtp.client-ip=46.235.229.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=treblig.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=treblig.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; 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:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=LuYyrQMyWGMOwe8OrvTO4BN9gtnvAnON7zt9Ixqpfy0=; b=UEqU8gaEALfh/lsLw+pY5zIQ1T u896m8WTJTPLEHXWOSyX1qPnueTSgnIxfehy+byLJsQLrgGHw4d8JQ6EblAPMq7jGVTLOt0K1alZx oQecvQaVl2mxSAHuF7TedHkyzZ9hiS2/a09IQMVLdCjwD4GcjxCns7UnSmMkeH4fNUn7ATq+fa2yC 9CAkKcPP0Pn98exNRcHhoehv9QokTjjh3mbKywqZnUIWQE0O1OZYRREakW+ND9T45s3qO47Tn8oLA eyTnVae4NYSI9MpNo6R8dA+MnUegCBPqlvlr///B9QukS35jW7/ASDytmPo37OtHriDk5fGzW7Fnr ox6qMM2Q==; Received: from dg by mx.treblig.org with local (Exim 4.96) (envelope-from ) id 1rouK4-00EnsC-1H; Tue, 26 Mar 2024 00:05:48 +0000 Date: Tue, 26 Mar 2024 00:05:48 +0000 From: "Dr. David Alan Gilbert" To: Linus Torvalds Cc: Kent Overstreet , Philipp Stanner , Boqun Feng , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Nathan Chancellor , Nick Desaulniers , kent.overstreet@gmail.com, Greg Kroah-Hartman , elver@google.com, Mark Rutland , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [WIP 0/3] Memory model and atomic API in Rust Message-ID: References: <20240322233838.868874-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Chocolate: 70 percent or better cocoa solids preferably X-Operating-System: Linux/6.1.0-17-amd64 (x86_64) X-Uptime: 00:03:19 up 83 days, 2:53, 1 user, load average: 0.06, 0.02, 0.00 User-Agent: Mutt/2.2.12 (2023-09-09) * Linus Torvalds (torvalds@linux-foundation.org) wrote: > IOW, the whole access size problem that Boqun described is > *inherently* tied to the fact that the C++ and Rust memory model is > badly designed from the wrong principles. > > Instead of designing it as a "this is an atomic object that you can do > these operations on", it should have been "this is an atomic access, > and you can use this simple object model to have the compiler generate > the accesses for you". Isn't one of the aims of the Rust/C++ idea that you can't forget to access a shared piece of data atomically? If you want to have 'atomic accesses' explicitly, how do you tell the compiler what you can use them on, and when it should stop you mixing them with normal accesses on the same object? Dave > This is why I claim that LKMM is fundamentally better. It didn't start > out from a bass-ackwards starting point of marking objects "atomic". > > And yes, the LKMM is a bit awkward, because we don't have the > shorthands, so you have to write out "atomic_read()" and friends. > > Tough. It's better to be correct than to be simple. > > Linus > -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/