From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D315B182 for ; Sat, 23 Mar 2024 00:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711152219; cv=none; b=cUMNOPlmxsZzPs0isWKc5CLDd1NNIsTdd4Zy2P5OIjDX2D3eRGwEhY/Fcy2x+EZ8+m/eCwHt/DmNk+9thcpbIA3v8T7X7c79gdChg/BqBENayiSdGW3JP0KKt95f5JETmG/ENbx/I5jBolfuNpgr4jEXPuqGXbmhtpsdkA5fy0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711152219; c=relaxed/simple; bh=vW2bvOuQiEcRn8u7kI1XXOFFH3fIHb1PivHG6bJDI6Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=btzD8zPjjwDaoV+4oLVHjzorZSqkRIBXy5a/zxsolCoxlkRz64ddIckKfuEEbQx7hLINdUYnhRZH39/lJMkHLIf//4oY2Oo86v8WEg8NgXryO3MNOlVnWGn0BWO6bH7I6uJZ91UXTFaRFapsckoAkfqgAfRdMoc1Knffs0H5jm8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PxE3S7cy; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PxE3S7cy" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-429f53f0b0bso18486311cf.2 for ; Fri, 22 Mar 2024 17:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711152217; x=1711757017; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=eASLODvGo3GX2Oyfss7PQQhJkyATkdZhH8YczVO2EXo=; b=PxE3S7cyIEpYZhHpfOKd4Sw81cd13js3Wd39O4IwfAgWC5Pm5sbhTNFakO9t9eO6fE tXrsct9+ELKZ6q1ei9U+zgTa/IXLDl99RjS2wDxKrmsnMYv34ismg3hSa9t2OW3RDzNv DiUFFBlL42HilV2Pdowtm/fxbTxMxaC1gBL2KhqYK1DKBw5f94TvZDlhswp128it5MBT v29kpcm4ZwMtcWhe5kUHId2Xb/lfwSRdTeAbtWuO6FggmX+5+4TQ4ZELVpzWPQolnPaw 7AnSWSP2XhZdknEHLmFtSqYeSZ4DP7NaBzTexudHaVBBl9NtMuaFUI7EzyjFmr3kqWhx IfBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711152217; x=1711757017; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eASLODvGo3GX2Oyfss7PQQhJkyATkdZhH8YczVO2EXo=; b=mHIG6gLw8xusrFonOwbD7z0WLHSg4EeL0Yk5zrp/W5V1X4dtrhQ+0pf11nfqhkEo6T hwkUfHVq7yCeeJmeAXCDkPHcih99oLjtxL8yAHS0sLq9roRO1SQLEakttAYIcxysdVZN HmzvKGhxmJY1YYO4HxFHD/elCV5K16QYQergkPlPTVJ+qtS7I4Yqw4gUhsByWoaDw97o 1/5XEK5TvpGwTB5yDE7Z+rCXTZnw+Lh6gOJS/EA08lXje94Xl3vd5dlB42jZ+ZCDx9yS OMcvsdFyNuymyl4nnzTCUR9SRAWtshnzja2fTOAAcypK4D31ej3woddFVxACWrfXQ6B5 Wdbw== X-Forwarded-Encrypted: i=1; AJvYcCUSyGFbXkM/9SjlqALt4nFpBXKE+qrrwGlck8pwpHmw+5Xyl3czuKEeuMPddb5EJOJzmn/a1C9BFpikVW9raF3CDsk7cg== X-Gm-Message-State: AOJu0Yy8fgOjpD/MeeANDRVGCCB0lsX+Lf21UfFIT+jGlpYwEleEay9B hJUs3ZIj+jgwlNwXbbaViE+8kiaTqJHVuqeVPbdr4K7TBBwwtLe5 X-Google-Smtp-Source: AGHT+IHjbUwCnlotNrzEjDqfeNUUku72up8XO+hTXKKrIOT7ksYTxuCesrZTrHymVkrnW/ZbtgJbZw== X-Received: by 2002:a05:622a:14c:b0:431:24c5:9dd0 with SMTP id v12-20020a05622a014c00b0043124c59dd0mr1180573qtw.29.1711152216768; Fri, 22 Mar 2024 17:03:36 -0700 (PDT) Received: from fauth1-smtp.messagingengine.com (fauth1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id d2-20020ac84e22000000b00430cacfe532sm298900qtw.79.2024.03.22.17.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 17:03:36 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfauth.nyi.internal (Postfix) with ESMTP id 5901B1200043; Fri, 22 Mar 2024 20:03:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 22 Mar 2024 20:03:35 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtfedgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehudfgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueeviedu ffeivdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Mar 2024 20:03:33 -0400 (EDT) Date: Fri, 22 Mar 2024 17:03:11 -0700 From: Boqun Feng To: Andrew Lunn Cc: 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 , 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: 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: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <068a5983-8216-48a5-9eb5-784a42026836@lunn.ch> On Sat, Mar 23, 2024 at 12:52:08AM +0100, 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 I can continue to look an elegant way, now since we compile our own `core` crate (where Rust atomic library locates), we can certain do a sed trick to exclude the atomic code from Rust. It's pretty hacky, but maybe others know how to teach linter to help. Regards, Boqun > 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. > > Andrew