Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1759318lqp; Sat, 23 Mar 2024 07:42:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWE6EJXV9sBN/yqyMU6OgOvqeJbeiJZE2VtPcRK6CNvXO5bAXjh09nWA9r7aCjkftptE+0vQz6qr/hp00RxihfaOGPj7qGdBYZ8C+fApw== X-Google-Smtp-Source: AGHT+IEYDGeYNjjLBbKdud0VmWoiX2SwPRGG7ylgRQXU6LVZDogbGD/wVY/OW6Y7taMSiv3ycSgJ X-Received: by 2002:a05:620a:1aa6:b0:78a:48ed:6ef1 with SMTP id bl38-20020a05620a1aa600b0078a48ed6ef1mr1970381qkb.8.1711204928757; Sat, 23 Mar 2024 07:42:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711204928; cv=pass; d=google.com; s=arc-20160816; b=DFVIHLnSnAmruz1wKSPhNmngl4hRWGWD0BJbtPvf8W/c9t+UwkqibCGmznMeT1J0uO 7fRS1ZBGRa744uGu+G1ueT0RNlBo+D5cDWcwNnunGUd3Gs6/sj9kUDflSMruIMfHK50w VBH0HYzC4bBbUXE6yArmXta3LrfL8elOOcj8cF3js1PaN8SWTiRsBn8KXpUS5bVaAQwB NszUVyydlWl2ELG55A36GtDiUA2ULF4LP+3M+GsZfcbPHk6fUj+K0y/K9AY33D1SaA3Q r3bKzKqtj7g8fW1YvkGv12QDWeEUijc4dW6qdOofdS+ASt8OZpYzho5gN9jl85MbzJl9 Go/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=JBoHlroea6/GTbzQ3nCArEwBGcVlF3t6u5u31TFOQ5c=; fh=nSLp+4SU3oxeL8kASvpUM6gUbRfzV1AdvK5mKyeUFjw=; b=zwduW/Bpdzrs95gC61yfnJ/79Iay/LM2IjYE9lnS2rbeNl2yTaarup8LK/3VseRGVn 3rBRQXW/6kUqdQFjkDk031L77VrFqRiH2egDkJl1+8V2xylh1hF1AfIOTFdqln+OD29T PVE7bqpxCyji8uhwtJStS6Ccza8r54ZlPwP7AfkDzYsyruHWvDoJtGBqvmScD7tEMvsA IxzHXkgEBm+9+pgqGhSi3Am/fmXleww3YYysJ/S7v/z5TONSi8X+HfzNZP6YoVsuI4P1 TgYijBMipxKp/mwxThOq1z79aapTjP2y1K6ysLA03s1GyVf6rgaOmnBYvwQB5DBX05g6 TBlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hj6PPlgW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-112380-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i4-20020a37c204000000b0078841225922si1710449qkm.633.2024.03.23.07.42.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 07:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112380-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hj6PPlgW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-112380-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B47861C211B0 for ; Sat, 23 Mar 2024 14:41:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B218743ACA; Sat, 23 Mar 2024 14:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hj6PPlgW" Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 57A4739AFF; Sat, 23 Mar 2024 14:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711204895; cv=none; b=BIY3HEX/XD4mEkWXN5kl0sN91pYnpvqe5eWEXl01a/B+Ct15m+D7F7vhSadWujQZ7RnG/qJSW1D2dTDQAYa49NVfliPamYHp+CoRHl3s/cJVECKb9AIn3CSQ5qnNBrtA29Pnv1zvF0CYoAiwg0hnoMXZ9QlsL4Bn11fE7f91nUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711204895; c=relaxed/simple; bh=3VQPb1kSUvBE9uol6WHaPTW1ils3Q0RNDodZuAFBPrw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EfE3mOcTF/PFksood+qZF2mxYcqyXD6coOURb4ANTnj8LW5bSEMG9izjv2DFwClypEheykfb9+omFFPQe6CWYDrBHsMf4f80HsD5Y6nKVUeUHPWyUQm5I/RiQ0e5MP3Jv6WSKnp+KUJrcfgl8vYdenC3BxPbDIwThHYIknmKk8c= 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=hj6PPlgW; arc=none smtp.client-ip=209.85.222.175 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 Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-78a4b264305so18415685a.1; Sat, 23 Mar 2024 07:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711204893; x=1711809693; darn=vger.kernel.org; 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=JBoHlroea6/GTbzQ3nCArEwBGcVlF3t6u5u31TFOQ5c=; b=hj6PPlgWxEc3chRnGmt2W62JPL7Vkyw92EXLbFwCU82nGwEMgByeV9L8sV99NtgcDu FiAYrfeGOIUFBNR3S2CAZ80eOHPoKX4pr3UNjcGSD9wB9sw8BLaBujgdHGeSzaJDlB9R N3TvwPz5OwFQofbJAz+sLvmrdeQnv0NcWF8JILrKGEIScrjEDXIQXP8/5shuqs+YXFOJ RiQmZ5aY+jIQmc2mZiHPKKLndgLITl0HDhZBMKpQPbdGtFafMNiPdSJm/7u5wCZb+xTI t4XlXpxxqwKj09vnnwZHm5+gJd411XIktX6twYs+uDn0v5E1SaAF0IY7uKxuQ4NOkYQ9 gsRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711204893; x=1711809693; 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=JBoHlroea6/GTbzQ3nCArEwBGcVlF3t6u5u31TFOQ5c=; b=AcLEum6HtWXHmFHiciQkRWi4w+pIivk8yiFwoItGWafe0x7N7EGSqKH/oW1rCAiU14 2WeURqvMz3/5470zqCAAXjXUpXkJYpsJ4RudTc7Qr+x6CX0T+lXUf/BsVmnUmNjuZfoB bVWipmZp4lJjOimWy287SZgIdfHdwEUiw4FiKjFBzvSAwLM7w+24Z7frdAkbEYiBy7sp oNpGugmaLTzLp81MR94dPaqy+4f4DOrKtk7fYVCacklJnnIWNMpCUCoPtN/y8QcP7CrA OQ5Stt3fB/cpAOLvqo5/qqIsv/B3u05nmb29LVah4jnN2NhNk5cfCr9hllRJIQVR5/hI B+mQ== X-Forwarded-Encrypted: i=1; AJvYcCXjJacXPaQCInYwjBsf0/NxUt3m4r+Q9PXhvQR4cMLbHzMdj6ukc0PQMdjsx8rwlI/ropoWvMitu7d0QIexs3Vzi0hxr0YskCzmgeP2pvXrCKi1cHhGmWkHjgtneSUVi9YIJjPaTK6FvW1PLYGzhCAccBr4a62lBiP/3rmrqBrVq3XkjN2bXsN0CgAT8GzupFm/nixLDAsEsXWnEjZMoSMEjeRt4SrDEA== X-Gm-Message-State: AOJu0YyHA6E+a8saLyXD9JwYBlr0sH6GaosjmCl8+jLQa6jnCKWTIamK J9Gbn35QG8QgHhRuPdDGeijeTbkJASTm0Zm+hf2jdu3R3iDrz0ju X-Received: by 2002:a05:620a:a53:b0:789:e5e3:f0f6 with SMTP id j19-20020a05620a0a5300b00789e5e3f0f6mr3057320qka.14.1711204893267; Sat, 23 Mar 2024 07:41:33 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id k26-20020a05620a0b9a00b00789e2961225sm714626qkh.61.2024.03.23.07.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 07:41:32 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfauth.nyi.internal (Postfix) with ESMTP id B26BB1200066; Sat, 23 Mar 2024 10:41:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 23 Mar 2024 10:41:31 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtgedgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehudfgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueeviedu ffeivdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 23 Mar 2024 10:41:29 -0400 (EDT) Date: Sat, 23 Mar 2024 07:41:28 -0700 From: Boqun Feng To: Andrew Lunn Cc: Kent Overstreet , 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 0/3] Memory model and atomic API in Rust Message-ID: References: <20240322233838.868874-1-boqun.feng@gmail.com> <03f629b6-1e4e-4689-9b69-db0b75577822@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=us-ascii Content-Disposition: inline In-Reply-To: <03f629b6-1e4e-4689-9b69-db0b75577822@lunn.ch> On Sat, Mar 23, 2024 at 03:29:11PM +0100, Andrew Lunn wrote: > > There are also issues like where one Rust thread does a store(.., > > RELEASE), and a C thread does a rcu_deference(), in practice, it > > probably works but no one works out (and no one would work out) a model > > to describe such an interaction. > > Isn't that what Paul E. McKenney litmus tests are all about? > Litmus tests (or herd, or any other memory model tools) works for either LKMM or C++ memory model. But there is no model I'm aware of works for the communication between two memory models. So for example: Rust thread: let mut foo: Box = ...; foo.a = 1; let global_ptr: &AtomicPtr = ...; global_ptr.store(foo.leak() as _, RELEASE); C thread: rcu_read_lock(); foo = rcu_dereference(global_ptr); if (foo) { r1 = foo->a; } rcu_read_unlock(); no tool or model yet to guarantee "r1" is 1, but yeah, in practice for the case we care, it's probably guaranteed. But no tool or model means challenging for code reasoning. Regards, Boqun > tools/memory-model/litmus-test > > Andrew