From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 AFE4D50095C for ; Sun, 11 Jan 2026 12:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768132947; cv=none; b=hG6pMHVesBrhyBKj0zkP03KgUAsEJR9ZPRkkugfp7JlI3cahMcqSEEKI2pgoRdKm2tTjjH7Xl28uXvkx6sWgzljh5fzh3RXguVKzm7e9BvyoeYJXCOvAcvgVbtSFQtpqgQ1qHebJEsale2CfbeQqU9HTmPTejJprmgZ29pPMEX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768132947; c=relaxed/simple; bh=9on4ayuVv7+XTrtlfAIj7SsuIWOQRo1Z2nZVwpdRs4w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JEyqomvz6X+9RNwh/UWx9JgLfuB+4wXcd1dn2KIFYcTJQ6uat2qD2a4JO9f7akiEUzplF7wIS2H4wJ2G0PkG3mJwms2af1fmu96Ntb/1VnKjcIt4NrIXGrrA1klgofeUgaq7q32gekKb93LN1dw8/f7dUM8Vvos91yaNZIhfhBo= 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=Z3xhJbCf; arc=none smtp.client-ip=209.85.222.170 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="Z3xhJbCf" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-8bb6a27d407so543914785a.0 for ; Sun, 11 Jan 2026 04:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768132945; x=1768737745; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:from:to:cc:subject :date:message-id:reply-to; bh=2gvqM6cgcNCPewaPlNPRQwapucK6C50wAJVV0/11pk8=; b=Z3xhJbCf07pUy/Fex1tI7B4Whp8wSEn4NlDLaGBLnnr6jjDc9Pvtp4PYC5JcEJ3fPP jbo2kpCieUJgcuW1nOnkp+E3qxuFmJu7y10imc9iTuNAlswZZfmPrCgBSUytHuEeFAwl GK99MLM+3YhIN0RKSqS0OuVswpAZ34isjrIRKYud5qhlJ/RbId9JiOijfiJ5J2xTwzes 4JCiPuOXj1w5easPqRX9J6pFWYGu+n7ma7N0aca45QNpScuO1bhMOQSu8z93/XhqVZLV KdofGdVaEGsHLg+dH8ijjw36ht2+L8l4aem+QH1BIizrzJvUz7npnVFpLhbVNZqupmm/ jhog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768132945; x=1768737745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2gvqM6cgcNCPewaPlNPRQwapucK6C50wAJVV0/11pk8=; b=P5q50mWAg2hwovh+rAo6e81gA9SAp+MlY+kAxO7rcv42fQhnskqi5SQe8TZzatPz2f DExL5a/AHweSzGxlNWlT2GCPB37bbMBM50JAquKpw0G4QaPdJhSIBry1DB6aAMvpR1tj JEDvolnjdOkGCQR7KHljsqJplp6yCA7xu7I/2SWYphbVu1eGP3Mve0zxNosCFTy8v7lY 4bH2uq78evJspBNm9OTpDvuTDg2fLruZfgehCfng/4zvyZUgPCbc8B4l3rW6WJkAzs9E 6NRSVJFOhBF6If1y9hhx6OYblqf73XiY5xvE53xc0GyesHvt5XP3xfJPH41KBYHLh3gi Ua8A== X-Forwarded-Encrypted: i=1; AJvYcCXbeVA7dLU0FYWBInJgMxdg+xDaCCLzgg0IMt6Ze1+MbfEwX0FOVJBJdSnbOYMYo4fkcBN7oB6z/dZZ2r8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1xXSie5yTRELHC++zXazbz0ZYsed4A7kgVEpeDLYK+nZiHndV WAh4IHLU40ApH1oCjKaJSFyUL5AmZqUPGC1F/L6/5crBgk+G4WbQ80j0 X-Gm-Gg: AY/fxX7vAwPJNIpWcH82fid3NVQ1uD949+To+y2iV5dQ8tZY/o6NSM+JNnpfUUlq4yF SCTM/s8rXpm41Nx0Y4CxFreJSjpzNOpVblw1Pr4y8YwpnS9DRc29Qv173qNw+9Tgjzzsj51Q4z3 2K5SuTKi/09QLNNL90h+mrlFFw0nWYEC6gzWO3PA041CFGMp/ezQjy1WPGHqzbBW/6QOLBXSQqq kPDSwFQk2eFaLt5NOZ4dcgxUDuH6yaD6/Qz7qewUKgP2PQpWsWmRwV+wxobffI3bOuv5jpLUYAy t2ngETmG6DNhzQMiiu1mVcOyvUVxtwcicIYnQG9ZkYTx6Z1Y8dYR6kCNNB/fecciAEAr17pVTI0 ZR0MzN690GMTLvGovsoQ5Rfr0gYBeQ3THw19L3UR5qGEZ7wJQB4XrSwKWuHUsukezJMdzrnUiAL K+fH8fxFVYqOvsoJaFH4XQqF/275/QQdNe3xBcx4iEll7TkKXvXoB1PKeh5Ol3nsiQ9SwmEkib+ hP92O6W8gAkYt0= X-Google-Smtp-Source: AGHT+IEDnQUa9zSfL2lUv/4JtoHHxHSNyYruL2hbGDAes18H/X2//8OIQtWXrH+u0RfG3XMQujCiuw== X-Received: by 2002:a05:620a:298c:b0:8a6:e160:9b1e with SMTP id af79cd13be357-8c389368b07mr2071391385a.17.1768132944566; Sun, 11 Jan 2026 04:02:24 -0800 (PST) Received: from fauth-a2-smtp.messagingengine.com (fauth-a2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c37f4a794bsm1304424785a.9.2026.01.11.04.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jan 2026 04:02:24 -0800 (PST) Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfauth.phl.internal (Postfix) with ESMTP id C0773F40068; Sun, 11 Jan 2026 07:02:23 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Sun, 11 Jan 2026 07:02:23 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduudeghedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpedvveekvddtffelffelfedvudefffeuheejgeeivedufffgledvgeduveffueeh leenucffohhmrghinhepmhhsghhiugdrlhhinhhknecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvpdhnsggprhgtphhtthho peduiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvthgvrhiisehinhhfrh gruggvrggurdhorhhgpdhrtghpthhtohepmhhinhhgoheskhgvrhhnvghlrdhorhhgpdhr tghpthhtoheprhhushhtqdhfohhrqdhlihhnuhigsehvghgvrhdrkhgvrhhnvghlrdhorh hgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtohepfihilhhlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehmrg hrkhdrrhhuthhlrghnugesrghrmhdrtghomhdprhgtphhtthhopehtghhlgieslhhinhhu thhrohhnihigrdguvgdprhgtphhtthhopehojhgvuggrsehkvghrnhgvlhdrohhrghdprh gtphhtthhopehgrghrhiesghgrrhihghhuohdrnhgvth X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 11 Jan 2026 07:02:23 -0500 (EST) From: Boqun Feng To: "Peter Zijlstra" , "Ingo Molnar" Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, "Will Deacon" , "Mark Rutland" , "Thomas Gleixner" , "Miguel Ojeda" , "Gary Guo" , "Alice Ryhl" , "Andreas Hindborg" , "Benno Lossin" , "Danilo Krummrich" , FUJITA Tomonori , Joel Fernandes , Boqun Feng Subject: [PATCH 05/36] rust: helpers: Add i8/i16 atomic_read_acquire/atomic_set_release helpers Date: Sun, 11 Jan 2026 20:01:38 +0800 Message-ID: <20260111120209.6133-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260111120209.6133-1-boqun.feng@gmail.com> References: <20260111115808.5702-1-boqun.feng@gmail.com> <20260111120209.6133-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: FUJITA Tomonori Add helper functions to expose smp_load_acquire() and smp_store_release() for i8 and i16 types. The smp_load_acquire() and smp_store_release() macros require type information (sizeof) to generate appropriate architecture-specific memory ordering instructions. Therefore, separate helper functions are needed for each type size. These helpers expose different symbol names than their C counterparts so they are split into atomic_ext.c instead of atomic.c. The symbol names; atomic_[i8|i16]_read_acquire and atomic_[i8|i16]_set_release makes the interface Rust/C clear, consistent with i32/i64. These helpers will be used by the upcoming Atomic and Atomic implementation to provide proper Acquire/Release semantics across all architectures. [boqun: Rename the functions from {load,store} to {read,set} to avoid future adjustment] Signed-off-by: FUJITA Tomonori Reviewed-by: Gary Guo Reviewed-by: Joel Fernandes Signed-off-by: Boqun Feng Link: https://patch.msgid.link/20251211113826.1299077-2-fujita.tomonori@gmail.com --- rust/helpers/atomic_ext.c | 23 +++++++++++++++++++++++ rust/helpers/helpers.c | 1 + 2 files changed, 24 insertions(+) create mode 100644 rust/helpers/atomic_ext.c diff --git a/rust/helpers/atomic_ext.c b/rust/helpers/atomic_ext.c new file mode 100644 index 000000000000..1fb624147aa4 --- /dev/null +++ b/rust/helpers/atomic_ext.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +__rust_helper s8 rust_helper_atomic_i8_read_acquire(s8 *ptr) +{ + return smp_load_acquire(ptr); +} + +__rust_helper s16 rust_helper_atomic_i16_read_acquire(s16 *ptr) +{ + return smp_load_acquire(ptr); +} + +__rust_helper void rust_helper_atomic_i8_set_release(s8 *ptr, s8 val) +{ + smp_store_release(ptr, val); +} + +__rust_helper void rust_helper_atomic_i16_set_release(s16 *ptr, s16 val) +{ + smp_store_release(ptr, val); +} diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 79c72762ad9c..15d75578f459 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -8,6 +8,7 @@ */ #include "atomic.c" +#include "atomic_ext.c" #include "auxiliary.c" #include "barrier.c" #include "binder.c" -- 2.51.0