Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1744792lqp; Sat, 23 Mar 2024 07:10:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmZNfR7/neFS2A2rrYNvwfw1a+G7MZ1XJlXy7A5lGrvewXT25/pJ67q5g9NnUoOu2w/7aQadfOvmd/hInPqzKqYoCLvI9fTIcvxYbcjg== X-Google-Smtp-Source: AGHT+IG1/vFFJ0crKUZgDxxbz6vYKALopUsyqvABqF9Gy+LFWvSse8zGEgFPe2lvEwoEsodDVCuN X-Received: by 2002:a05:6402:210e:b0:56b:f54a:6c66 with SMTP id bl14-20020a056402210e00b0056bf54a6c66mr1875570edb.0.1711203047043; Sat, 23 Mar 2024 07:10:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711203047; cv=pass; d=google.com; s=arc-20160816; b=lAD7ppOQRCv0WCugMMBrjWiB8d4zZ5GsAiJ5x0VhKVom76WvESdfc1uKHIOjGug/EZ sCTg1uduU+jS3ZwA37bmj9gdQBQXVuC6jrYkAILPGCDmdk/auz8zHkQmh5vIEClzZoCw G/ZEoHNCj7sT/sT7Pyf9V+U3ZBfFVZ86Wd4Wxhz6gLxp5I40vuCZsSlPk3lpHzEAfyDf /DiT5ol6hM4Ylxc+8V7vsOQmjCGsEIHw9CDWkna3EKMucRaFReer4OLZ1iVRpNPXXwVh AfWXiUZDtwgKmnOiHHL37auALIagulApVhJvN59xJEkqXOZ4YVmes+2RecK2msvaJM61 65fA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mMJIH5/fIvPZW8NeQXlIeeRpf5h3/o6asdfcYdeLYYU=; fh=m2G0KwxK+jY0zcrzFNlAAEWbDHPBtbJhFwRfewp2xhw=; b=GqDN0/CYcmoZpluaS2kNwv4SDr66sJka82OKixzpWfiwNpljCj8BVQR7by14+J43Zs zPykGMuZ3Iz2bFmTK7Wfxbp46iowbxLiZqN6/xDhrhftNgnMQYttlaLzlT2m6LGuioXt alw1w5evRcrcNWEe0GyAFlPuZXJozbY0qlFqJOywFb1Ihzq9tQRIMskReYmLnTNKT5Q9 Pga6wVCsdnJgj/DKPdI4staNlznPuJyHASwk5g+VJoHQ6c9gJ9krLcCNbnHnVDwo7L4F pEke/+Ewo29PuZxCDNGyFPwFjuoGjgWQ+C4zKsw1K2+ID4hG/eabiZDNX5HiItpWzXg1 JMGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Mb97SIkc; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-112364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o13-20020a509b0d000000b00568b3bf415esi847830edi.424.2024.03.23.07.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 07:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112364-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=pass header.i=@lunn.ch header.s=20171124 header.b=Mb97SIkc; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-112364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 A3ABC1F232C2 for ; Sat, 23 Mar 2024 14:10:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 927E43FB02; Sat, 23 Mar 2024 14:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Mb97SIkc" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 9B4421A38F4; Sat, 23 Mar 2024 14:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711203034; cv=none; b=pJO5d9eBlKVfCGxIAHbcSNa48a/J7bPjrvTjkeJFjotbnId4XdtsQUKqxno0Kmag2Hj4VZ+0k3cfcjYJ6I1fmDEAz1idCNVNvehIHqQZqN1RO/Rd6LOSOO63JUHHGGLaas0Xr0cE7pcgeIwg+Qxz/xGoJ64/gHXCT+lGcHzW6eM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711203034; c=relaxed/simple; bh=vpI2jBHlh6dsG2SS2eT9xX6YVg4ZX5BR2WV/eWEg+MA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TjeLqe+Cs3jgklzYbL3cFbL3b7L90JujbgPM6iTgSCFVRXPPuaGT8BkEvRRuqJcGkHF6lJY0c/XpIS8ari/uOLyzckHSfPhray7qJHOV4BYyazOaT/15vQw/Le/v+M5Tn0IE9KU3115tTgzECKZo/H+6M0Egbld4aW3AimpYuI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=Mb97SIkc; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=mMJIH5/fIvPZW8NeQXlIeeRpf5h3/o6asdfcYdeLYYU=; b=Mb 97SIkcFf6RiGosPIvWmz81W9Tp/neBsuP1WTUaUSrsWhsiDdOVBFU6SmKQvKIJU5t9HoTng5vbAHz cee9x2n3fWh4zNNBCVa1YJLNPHa309YzyVDRdbNna5ABsrhzUGFbEqN+NhrfCEvPB8JwkajSLYHwu kDuu1og5p4MP98w=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ro24j-00B3OA-OU; Sat, 23 Mar 2024 15:10:21 +0100 Date: Sat, 23 Mar 2024 15:10:21 +0100 From: Andrew Lunn To: Alice Ryhl Cc: 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 , 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 , torvalds@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [WIP 1/3] rust: Introduce atomic module Message-ID: <497668ec-c2d5-4cb4-9c2d-8e6f7129a42e@lunn.ch> References: <20240322233838.868874-1-boqun.feng@gmail.com> <20240322233838.868874-2-boqun.feng@gmail.com> <068a5983-8216-48a5-9eb5-784a42026836@lunn.ch> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sat, Mar 23, 2024 at 10:58:16AM +0100, Alice Ryhl wrote: > On Sat, Mar 23, 2024 at 12:52 AM Andrew Lunn wrote: > > > > > +//! These primitives should have the same semantics as their C counterparts, for precise definitions > > > +//! of the semantics, please refer to tools/memory-model. Note that Linux Kernel Memory > > > +//! (Consistency) Model is the only model for Rust development in kernel right now, please avoid to > > > +//! use Rust's own atomics. > > > > Is it possible to somehow poison rusts own atomics? I would not be > > too surprised if somebody with good Rust knowledge but new to the > > kernel tries using Rusts atomics. Either getting the compiler to fail > > the build, or it throws an Opps on first invocation would be good. > > We could try to get a flag added to the Rust standard library that > removes the core::sync::atomic module entirely, then pass that flag. Just looking down the road a bit, are there other features in the standard library which are not applicable to Linux kernel space? Ideally we want a solution not just for atomics but a generic solution which can disable a collection of features? Maybe one by one? And i assume somebody will try to use Rust in uboot/barebox. It probably has similar requirements to the Linux kernel? But what about Zephyr? Or VxWorks? Darwin? Andrew