From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 7B94044D03E for ; Wed, 21 Jan 2026 13:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769000859; cv=none; b=gPa/7lEWbzwGYIcZewO14jaC6n1vusvEJKSXjhnyKA+9AGxDZF6OpIK6RTVwyOqQnDZPmAk3aLnwwnoC0AZEibmGGiCO2jn8AMv1YD9m2DAKfYAINFUZ1zmhuSPlFDrjpL/DMMnL6hUTy7noU6kyvM7SWLtlAy/CC0JicTfOwEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769000859; c=relaxed/simple; bh=S14KYUopdXTDgC4Cu7mWpisYmEYWvH2eisKCBbQPYjg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ak47xCqYI9zX/nYdN/neKzi3gMtaHInMBLpnJBGytNRf4PyuC5nzyk0wBaCpPPjIOm9pS1FTC3jxd7sL0+fac7U5hcjMY0LsSiv68fDjZai0aRhla118SC9BzhSuNj+duvrK03hNnAYCFq755lNqZDU23T4y1G8gFVq+E1Ma/qA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=MON6q3Ja; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="MON6q3Ja" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-47d3c9b8c56so76144315e9.0 for ; Wed, 21 Jan 2026 05:07:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769000856; x=1769605656; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iQtXgItu1Zy/WBkyH0gCN+HFn5zyM6SkcEvV7kJAMKk=; b=MON6q3JacbbvMaxHiLYYufLn9CIOzdNHOUj1NcphbLFh3JcxSVah3QooDTbXX4YedN WSdNrlSftfuUsKPzvuZGhI+ib+oVdHNdla27NB++pe6gVpFmfO+C4/tFJCrW+gPuCTHx JWlnvuAa2BdE3ORxClN2hSGpGlB5FFMOWp28Ap4VIFwn9S+Ha0Xg2um3yx9OxW4MF0ML XglTrG6ZgU/0hWw+Ormf+3S7qggY2ZY45BB7j6m8VpWVPuEfh2C1v4MbeyOwl/NFeg9G ThPAHbuiYwSxEHaZNAW7FvZTgzc9TCC0+79X/hq/aQyy6EY6DKcEOer2O9gUyvCYtFV/ WGrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769000856; x=1769605656; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iQtXgItu1Zy/WBkyH0gCN+HFn5zyM6SkcEvV7kJAMKk=; b=rG/nPBY4MCW2/brFUgWf6cAtjfrYUgjsUjoYO7RpONA7+ieL0VXfUGhFVOQ4T35hT6 U6XE3tDYTF2rpM/R3stP+XLu4xMB/KsVygauuVqV/GpdlVXOj02ZGijd5zirgwg2LXBM HEJyAIYQsvg1EO3Zx4xvMq5WA0+mNDyn4+ls7jK4VCVkMFfj8GpOUM2QfhBFh4KUMr/d gufT2NIDmagMR5ytl4BzpSZUX9gJcevvsqFnpajcTKYIOGcvIb793Iszja+wLbHQ03Q9 ESZUpFUaAVulSrkHi5Kux9jDSPM5nb6r7XHS/myTkbYsMJ0Wgk0jRZD+HSysVaXo3ubk RMnQ== X-Forwarded-Encrypted: i=1; AJvYcCXXJZnMttMdBRBBHI+ddZhRDjBT8L6wWvJBCEWGgs1Uu+OrXGUXQgDXASDsEIHWWT9CF8zl/rwXZoORfl7+@vger.kernel.org X-Gm-Message-State: AOJu0YwsC1UY2H+nsZGn16nVtC/RYU+uP+705xhZQrDPJilOFMf/bEw7 bm4AjN9O8tSTLE9CeKLiu+BYemx3QsTDNph5m40LDWX9rtZN/7VUS+sUnAqxafp/lApNwgobhAW mUj1PmS3soxUSveNe9g== X-Received: from wmbd16.prod.google.com ([2002:a05:600c:58d0:b0:477:54e1:e29e]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8b82:b0:480:1b65:b744 with SMTP id 5b1f17b1804b1-4801eb0e10emr234136695e9.28.1769000855966; Wed, 21 Jan 2026 05:07:35 -0800 (PST) Date: Wed, 21 Jan 2026 13:07:34 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260120115207.55318-1-boqun.feng@gmail.com> <20260120115207.55318-3-boqun.feng@gmail.com> Message-ID: Subject: Re: [PATCH 2/2] rust: sync: atomic: Add atomic operation helpers over raw pointers From: Alice Ryhl To: Boqun Feng Cc: Marco Elver , Gary Guo , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org, kasan-dev@googlegroups.com, Will Deacon , Peter Zijlstra , Mark Rutland , Miguel Ojeda , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Elle Rhumsaa , "Paul E. McKenney" , FUJITA Tomonori Content-Type: text/plain; charset="utf-8" On Wed, Jan 21, 2026 at 08:51:48PM +0800, Boqun Feng wrote: > On Wed, Jan 21, 2026 at 01:36:04PM +0100, Marco Elver wrote: > [..] > > > > > > > However this will mean that Rust code will have one more ordering than the C > > > > API, so I am keen on knowing how Boqun, Paul, Peter and others think about this. > > > > > > On that point, my suggestion would be to use the standard LKMM naming > > > such as rcu_dereference() or READ_ONCE(). > > I don't think we should confuse Rust users that `READ_ONCE()` has > dependency orderings but `atomc_load()` doesn't. They are the same on > the aspect. One of the reasons that I don't want to introduce > rcu_dereference() and READ_ONCE() on Rust side is exactly this, they are > the same at LKMM level, so should not be treated differently. That's okay with me - I just don't think "relaxed" is a good name for atomic_load() if that's the case. > > > I'm told that READ_ONCE() apparently has stronger guarantees than an > > > atomic consume load, but I'm not clear on what they are. > > > > It's also meant to enforce ordering through control-dependencies, such as: > > > > if (READ_ONCE(x)) WRITE_ONCE(y, 1); > > Note that it also applies to atomic_read() and atomic_set() as well. Just to be completely clear ... am I to understand this that READ_ONCE() and the LKMM's atomic_load() *are* the exact same thing? Because if so, then this was really confusing: > my argument was not about naming, it's > about READ_ONCE() being more powerful than atomic load (no, not because > of address dependency, they are the same on that, it's because of the > behaviors of them regarding a current access on the same memory > location) > https://lore.kernel.org/all/aWuV858wU3MeYeaX@tardis-2.local/ Are they the *exact* same thing or not? Do you mean that they are the same under LKMM, but different under some other context? Alice