From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (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 D3F1715746F for ; Mon, 19 Jan 2026 02:36:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768790221; cv=none; b=RX/8a/LVjs6613/9qXGvbm7NgHtjauQAP7AUiEExV33QQJxy713Qc5Qai8JxiRz2s4i7WDYiQX6+bMwbEiTbZlZxlXKDp1GCY+bZf5NPMI7Qo3WvIe82ZPaJNw5lOtkh7YFIUM/HySDVELg6Uog/6YF8PQldGzD30Lq7mYyKWQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768790221; c=relaxed/simple; bh=u6BKctv4khQOGwF3sR58+ZP8VrfFt6vOgdUxnwbyZEE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TkRnkSr7771Wb2CCjqzg2zADE8elfM07RpkuDFlJd8+83mn7arGKI+9LNYggLy5u6SQ2OVCIwWWxxGLX917Ng9RLAgAkMzLKd3nrdAac7YrH1073I7HE/MAQ8opy0qV77KvQbDIQjRD9jJjsz8dInUng12r/1yAQdzP/Bm9Rb3Q= 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=gEi38wbE; arc=none smtp.client-ip=209.85.160.52 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="gEi38wbE" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-4042f55de3aso2984641fac.1 for ; Sun, 18 Jan 2026 18:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768790219; x=1769395019; 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=7Ga4T1rTKShKL1387lYEokMW72Q2esUrK3DVRNtHg3I=; b=gEi38wbEgD+pcxl7tp6D+yesWzqRVlDLP4XmT/hSUdIP9OuD4amh7sUjJGEc3rR5e+ khZ+408D03r4RwnqjYp+eVbkl/S+mji6v34bUTOqB+DDUxNuinpzCC3XfkSEBeozDF3m IEt49G3fJ28qCHzEMw3MWhWE6NyYijwx18Mv47Fgr33bOI89KE+NytRrYucpFXbkhGPu UVlMxfcLbup/JdTrJCOsrRiY/Og0NYr/Xdr1N+IX5nw+uragNNnL+PnCMCI1qHbNQlTj vHX2Z0DG5WsIcqZG/P6YbzC7cO30V6EEDQ4BjniRB1Kl7GkVT7/zGjAMc5xspXDXpIWD cYlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768790219; x=1769395019; 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=7Ga4T1rTKShKL1387lYEokMW72Q2esUrK3DVRNtHg3I=; b=avl22mMTIkWp3NuL5kKvEZEcTm89EyRMlcMsKl8Gtl9SWjwQwTgtgeHumhbxyFyorH s6vWNhtXg8MuC7O7RRfJmo+Bpu2oeYWCR+yIkyU+rNjW9xuCdJR/wRfxqGIlo2Sxo7y3 RW0LsIBfG6LYb/yoI9QjkqILsw/cuc03w0gW8qerAtkJFcbjbdnGFmvG4Mld8xA3TsQp 3Zu9RCo+7ClcDZq5s2kZvcQrn+m0pqDz9kTg/lqbXuHSfLxuq6dVHS023stbMJ/HBJG4 oFLYtaNN9Uuph4RDRvBr3hNO3qOx7YLkPNT+ftF8GhrSn6AdqOxqAt5Rd8Wt0Q9eneLL x7Ng== X-Forwarded-Encrypted: i=1; AJvYcCWGg9ve8sJsRk6oPke9h5NEn+3TtlnGCs/BsxjY1ljsrGUSyPoPsWjg+Rdr4gRB7QdvPLipFmng0ceCFjg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9FP9oVAlcfbia0dd7wEejYK1Yl0E+z/kGQO7YVpOQ48EjCaWX xO8e/wMXVPi55RNk/10FdgFQJyJJ65KYdpFlYRGkkk9OROF667NpxuDaGZUJUw== X-Gm-Gg: AY/fxX76Y23tFvQDokK9a3bjrsVmJYyWoWa1jmWWwWT/jboN6XoflmSeoAqUaVI97w2 GMsZSTuAd0hOnJw9ScKpHau9QP7aLJYoXd4oZZPw6p0Ri7l5GzgWmQzRmdyFhs+HK/sJAJpMDcH tARu29W74GT6tRQOo3s7VbDe0POc7oC26UcbE3wSNiKST/h94oY/ILNc4DxBHdswJnSXMMLwhDp 3pb/8Okzs17MUPa51FuQZ2U3KYHicJTjdk/l9aT2wesXzZ8nS9tVtoeaYeQ85qdQPvKf4yamQPa nqcJZn2Ba0Y2690/04NYiPRBj5SJANZdbnXH9jY9goj1nvkjdYc29IeZVKqeEdF5LASop8nak3r boccLKzte2l01NxEqbrH3bqAg6HP/wRRbJOeSReWaT5hGQEMdOhc6UE3yinzXlZ5cQAf+pVK0Mo NDJIyp94SY1HwajyU6Yd6qYUeLkmQbtrsxHe+iNfPv0KRecU/w/+XK9WhEcGuacFDYzWeHVu+Yd lpqJAd4b0+lWyA= X-Received: by 2002:a05:620a:1911:b0:8c5:33da:219f with SMTP id af79cd13be357-8c6a651dc32mr1341810185a.43.1768784259107; Sun, 18 Jan 2026 16:57:39 -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 af79cd13be357-8c6a72602f3sm701200385a.40.2026.01.18.16.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jan 2026 16:57:38 -0800 (PST) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfauth.phl.internal (Postfix) with ESMTP id CE3E8F4008C; Sun, 18 Jan 2026 19:57:37 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sun, 18 Jan 2026 19:57:37 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufeeiudelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeejiefhtdeuvdegvddtudffgfegfeehgfdtiedvveevleevhfekhefftdekieeh vdenucffohhmrghinheprhhushhtqdhlrghnghdrohhrghenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhht hhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedqudejjeekheehhedvqdgsohhquh hnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvgdpnhgspghrtghp thhtohepvdejpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlohhsshhinheskh gvrhhnvghlrdhorhhgpdhrtghpthhtohepughirhhkrdgsvghhmhgvsehgmhgrihhlrdgt ohhmpdhrtghpthhtoheprhhushhtqdhfohhrqdhlihhnuhigsehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheprhgtuhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehojhgvuggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehgrghrhies ghgrrhihghhuohdrnhgvthdprhgtphhtthhopegsjhhorhhnfegpghhhsehprhhothhonh hmrghilhdrtghomhdprhgtphhtthhopegrrdhhihhnuggsohhrgheskhgvrhhnvghlrdho rhhg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 18 Jan 2026 19:57:37 -0500 (EST) Date: Mon, 19 Jan 2026 08:57:35 +0800 From: Boqun Feng To: Benno Lossin Cc: Dirk Behme , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Miguel Ojeda , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Will Deacon , Peter Zijlstra , Mark Rutland , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , FUJITA Tomonori Subject: Re: [PATCH 4/5] rust: sync: atomic: Add Atomic<*mut T> support Message-ID: References: <20260117122243.24404-1-boqun.feng@gmail.com> <20260117122243.24404-5-boqun.feng@gmail.com> <67e5482b-93ed-4b5f-8375-f7e68c50a436@gmail.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: On Sun, Jan 18, 2026 at 08:59:09PM +0100, Benno Lossin wrote: > On Sun Jan 18, 2026 at 4:05 PM CET, Boqun Feng wrote: > > On Sun, Jan 18, 2026 at 10:57:37PM +0800, Boqun Feng wrote: > >> On Sun, Jan 18, 2026 at 09:38:36AM +0100, Dirk Behme wrote: > >> [...] > >> > > > >> > > +// The current helpers of load/store uses `{WRITE,READ}_ONCE()` hence the atomicity is only > >> > > >> > uses -> use ? > >> > > >> > >> Will fix, thank you! > >> > >> > > +// guaranteed against read-modify-write operations if the architecture supports native atomic RmW. > >> > > +#[cfg(CONFIG_ARCH_SUPPORTS_ATOMIC_RMW)] > >> > > +impl AtomicImpl for *const c_void { > >> > > + type Delta = isize; > >> > > +} > >> > > >> > Are all users of this guarded with CONFIG_ARCH_SUPPORTS_ATOMIC_RMW as > >> > well? Or do we want (need?) to cover the > >> > >> No, the users don't need to guard with CONFIG_ARCH_SUPPORTS_ATOMIC_RMW, > >> the purpose of this #[cfg] is to avoid surprise that when > >> CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=n arch supports Rust, when that happens, > >> we need to add the support to the helpers of i8/i16/ptr. > >> > > > > Hmm... I guess at this moment, I probably should do > > > > #[cfg(not(CONFIG_ARCH_SUPPORTS_ATOMIC_RMW))] > > static_assert!(false, > > "Support of architectures that don't have native atomic needs to implement helpers in atomic_ext.c"); > > > > I can add a patch in the next version if it looks good to everyone. > > I think this is a great idea! > > By the way, did you know about `cfg!` [1]?: > > static_assert!( > cfg!(CONFIG_ARCH_SUPPORTS_ATOMIC_RMW), > "Support of architectures that don't have native atomic needs to implement helpers in atomic_ext.c", > ); > Even better! Thanks. I've added a new patch that converts the existing #[cfg] on impl blocks to this. I've added Suggested-by of both you and Dirk ;-) Regards, Boqun > > [1]: https://doc.rust-lang.org/core/macro.cfg.html > > Cheers, > Benno