From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.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 A6EDCAD24 for ; Wed, 7 Jan 2026 02:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767753875; cv=none; b=WoN0yxvCqC/XKmVB56iRWpTPF2cXnc5d6B9tfQDTREtQaa5QhospVuQw/XImgqyoL/nlhveOyLb1trEZmO2RKtEqKbCBzX3u51aYuA//7Hb7UEHilhNg3zaLLCjMnTMDl4yyDYjmdYv4Zlr1PYizvwwvDXsDnwVHfqjfqotl5QU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767753875; c=relaxed/simple; bh=H2WSDowZ9Yd/XdfZEyaAlHFGYOxomJFEKMh7vrcocT8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FqkQI34Z6xrbaOVHq0AUZu/y4HUeA24+2Tj4QAgTUPJnTOQmH6letLPJuyRQkuLKs/SqyBGDJBPeLjCLPBkJhyqSJr3cHIIYuggsy6CiWm0r7o2ypodlK/+kKk81hAijBiDxn+VpOaigVnupL+GAAku+DOtnDHNoMYG5VmuZgH8= 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=RBrmext4; arc=none smtp.client-ip=209.85.214.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RBrmext4" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2a0d6f647e2so19955485ad.1 for ; Tue, 06 Jan 2026 18:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767753873; x=1768358673; 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=/yQRPN2bRGk3Fc8VecQayp5kHElaztK+y5PRLikB7fk=; b=RBrmext4vnupBYbqEU6kqNv2WvWj8UAglkHPIS1gbUCcoqHmFne4DrvqSdLFUoTxZh BXTd1BSVURtYUTEBG/5gDiMltE7RRnJYsUJTsQepn+vQLcTmu9HPhduNTMERhagYRmvd foz8W3K0v2aHcWsQIkZVWwBrjNLgBAgqPmKz8WPWYNGss/oQWBYOtaGFc53SMjofJrNj pXJf8bObUgbqDRUjq+TFMXrJPYzLhl5vEOrcAj3of64cnsPuZoRf7xCHlDQ43yq7sSwi ZbUDlWIlpxDxDVN6C1oMM5D237b20Nrb7BfWRtQQ34kd5lvle2aI14ICSNVt2nGsa194 o3Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767753873; x=1768358673; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/yQRPN2bRGk3Fc8VecQayp5kHElaztK+y5PRLikB7fk=; b=kHxQjfv7laE+PIiu9f/cdvfhOGTPQhe78qa5XNlVWudsIXMzD6wT617zQk+MyoeAqz HgkLj1Lrks7Fugvv5MQ8Ws5Yns12b8Kanx6dIUkoaI+5RvyG6eb4nkTCE5o6tEEJRbhe iAduDVo+l8oWQ2Ru/D6TTXHKpli7mFmAy9kwJDaGyq9EVdoZ15Jefco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:2df9:c6a3 with SMTP id 6a1803df08f44-890842a264bmr12754276d6.50.1767748105800; Tue, 06 Jan 2026 17:08:25 -0800 (PST) Received: from fauth-a1-smtp.messagingengine.com (fauth-a1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-890772346f8sm24105326d6.35.2026.01.06.17.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 17:08:25 -0800 (PST) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfauth.phl.internal (Postfix) with ESMTP id 81DA5F40068; Tue, 6 Jan 2026 20:08:24 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Tue, 06 Jan 2026 20:08:24 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutddujeduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpefhtedvgfdtueekvdekieetieetjeeihedvteehuddujedvkedtkeefgedvvdeh tdenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvpdhnsggprhgtphhtthho peefvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepjhhhuhgssggrrhgusehnvh hiughirgdrtghomhdprhgtphhtthhopegrlhhitggvrhihhhhlsehgohhoghhlvgdrtgho mhdprhgtphhtthhopehgrghrhiesghgrrhihghhuohdrnhgvthdprhgtphhtthhopegrrd hhihhnuggsohhrgheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepfhhujhhithgrrdht ohhmohhnohhrihesghhmrghilhdrtghomhdprhgtphhtthhopehlhihuuggvsehrvgguhh grthdrtghomhdprhgtphhtthhopeifihhllheskhgvrhhnvghlrdhorhhgpdhrtghpthht ohepphgvthgvrhiisehinhhfrhgruggvrggurdhorhhgpdhrtghpthhtoheprhhitghhrg hrugdrhhgvnhguvghrshhonheslhhinhgrrhhordhorhhg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Jan 2026 20:08:23 -0500 (EST) Date: Wed, 7 Jan 2026 09:08:21 +0800 From: Boqun Feng To: John Hubbard Cc: Alice Ryhl , Gary Guo , Andreas Hindborg , FUJITA Tomonori , lyude@redhat.com, will@kernel.org, peterz@infradead.org, richard.henderson@linaro.org, mattst88@gmail.com, linmag7@gmail.com, catalin.marinas@arm.com, ojeda@kernel.org, bjorn3_gh@protonmail.com, lossin@kernel.org, tmgross@umich.edu, dakr@kernel.org, mark.rutland@arm.com, frederic@kernel.org, tglx@linutronix.de, anna-maria@linutronix.de, jstultz@google.com, sboyd@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 4/5] rust: hrtimer: use READ_ONCE instead of read_volatile Message-ID: References: <20251231-rwonce-v1-0-702a10b85278@google.com> <20251231-rwonce-v1-4-702a10b85278@google.com> <20260101.111123.1233018024195968460.fujita.tomonori@gmail.com> <20260101.130012.2122315449079707392.fujita.tomonori@gmail.com> <87ikdej4s1.fsf@t14s.mail-host-address-is-not-set> <20260106152300.7fec3847.gary@garyguo.net> <4f3f87ad-62f0-4557-8371-123a2306f573@nvidia.com> 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: <4f3f87ad-62f0-4557-8371-123a2306f573@nvidia.com> On Tue, Jan 06, 2026 at 04:47:35PM -0800, John Hubbard wrote: > On 1/6/26 10:43 AM, Alice Ryhl wrote: > > On Tue, Jan 06, 2026 at 03:23:00PM +0000, Gary Guo wrote: > >> On Tue, 06 Jan 2026 13:37:34 +0100 > >> Andreas Hindborg wrote: > >> > >>> "FUJITA Tomonori" writes: > >>>> > >>>> Sorry, of course this should be: > >>>> > >>>> +__rust_helper ktime_t rust_helper_hrtimer_get_expires(const struct hrtimer *timer) > >>>> +{ > >>>> + return hrtimer_get_expires(timer); > >>>> +} > >>>> > >>> > >>> This is a potentially racy read. As far as I recall, we determined that > >>> using read_once is the proper way to handle the situation. > >>> > >>> I do not think it makes a difference that the read is done by C code. > >> > >> If that's the case I think the C code should be fixed by inserting the > >> READ_ONCE? > > > > I maintain my position that if this is what you recommend C code does, > > it's confusing to not make the same recommendation for Rust abstractions > > to the same thing. > > > > After all, nothing is stopping you from calling atomic_read() in C too. > > > > Hi Alice and everyone! > > I'm having trouble fully understanding the latest reply, so maybe what > I'm saying is actually what you just said. > > Anyway, we should use READ_ONCE in both the C and Rust code. Relying > on the compiler for that is no longer OK. We shouldn't be shy about > fixing the C side (not that I think you have been, so far!). > Agreed on most of it, except that we should be more explicit in Rust, by using atomic_load[1] instead of READ_ONCE(). [1]: https://lore.kernel.org/rust-for-linux/aV0FxCRzXFrNLZik@tardis-2.local/ Regards, Boqun > thanks, > -- > John Hubbard >