From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 091DAC54E58 for ; Tue, 26 Mar 2024 00:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jVov3912UCqTZmKvEtmyOZvCuj/Wifmp+O16Eed/wCc=; b=o9YGrotFF1SbMA gzOmh6/JWcFUAsq0lO0Ad2IURDI3L47xeBn5QYu9voHjH24lzxNsTTriuVhqESyhdSbOKiidkE2w9 MmV19P3Lz7sTKc1SztdrkJdphnPFu7ZHbrAxGg9vOFJzApZzRf984gPlRAzUPdaM1qxV6I56roEqu 7TM17JfS6JSRz8dUWgB9k2Wvjqo+U0f9mLz31tGZHzWhQJOHO6WF8Wj9HnFnT7I3D1qTRqQMQKQOH eVUQGVckdnCzfpH3wLZsKB3Sta+cAI69CYLXllIdbAIyQJXdaHzpT+BAgExdUotkqu/jlX6F86WPR lpW2fWC9v2gVzGLaVD9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rouL4-00000002RzN-3Y0C; Tue, 26 Mar 2024 00:06:50 +0000 Received: from mx.treblig.org ([2a00:1098:5b::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rouL1-00000002Rxr-2zx0 for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2024 00:06:49 +0000 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> MIME-Version: 1.0 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_170647_769312_6746C10D X-CRM114-Status: GOOD ( 18.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org * 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 |_______/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel