From nobody Thu Apr 9 09:27:45 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCD3F426680; Mon, 9 Mar 2026 19:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773085715; cv=none; b=XaEbhjVGnjD7Lig49nRWKMy8Y5LxHjmmn26+G/uQuk4hXwPwNImZHmObeZdsRvwlKPmW9/rDpVKy95CNQio4FN203EqcdF3QWs4bSu52QfVtZPLXe7rMBhwcnFkflPGb6X9wYApIG0fNWxJp/IczVcEwBMN1ok0QWin9/a70Z3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773085715; c=relaxed/simple; bh=AREs3syYIkFJZ6qwI1dGivi3r4ZFxyEyGyVOcAqrNNU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=LitJWWyYjcn63u/kN+orolqboF9SEotBoMygyNB/gMS7TVzk5bjlmpUNCRCisIfJRFqSS9ofs5S8GfRzKEZM+hwZVIIG05D8jPQ1L9GZb/YYLk/i+GpVCFsXVf0guLy5AAZUKGp2v6Ui3UZBhTpsqQO5t632CMBJVFitDwNn4no= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=EC1VPKHd; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=9C40yQNQ; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="EC1VPKHd"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="9C40yQNQ" Date: Mon, 09 Mar 2026 19:48:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773085711; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K0mq7cv3Npj1hewxrhbW2VV4fpi+ald5B76OlNfc6bI=; b=EC1VPKHdW1YmPvgCvCSUnjIiGVmojQaRtRVgjLQL+bHn+teU+ke2tM9G3nYRAuWyr4N1As VdtoyiOsEdhKEGr+SzZLpUqR93B6bWhHWniIHM3l/KAdOz4wuHXJ54UKYQjyEgMywc+i2B yHzc1O3glN6wmb6TqRp3ZeBRRHeBDxeUCC/2d1f5aZM2oRi/oausHakJ36AI2Oc2QyTjMz 1U8FZ6bSnFr/6EKOFQJ6OhhYN5zb639MaLmFzWXk94UA0vd9vpzFP7ybD0da7QlgFTlj8q vMzV3cbzdtG0ZNXQQjy3OZ8hY3iA9Krlo/c6PupS0/rwdH+OKsSdeqCUUn+FBQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773085711; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K0mq7cv3Npj1hewxrhbW2VV4fpi+ald5B76OlNfc6bI=; b=9C40yQNQvEvAuCPpsuAGM3dGuJS3yHFCb6IhVXbVIRvN9L/eTz59lZ1K4bhIIpeBdqeavB hq0qA3iUn/tcwlCg== From: "tip-bot2 for Boqun Feng" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] rust: helpers: Generify the definitions of rust_helper_*_xchg* Cc: Boqun Feng , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260303201701.12204-5-boqun@kernel.org> References: <20260303201701.12204-5-boqun@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177308571037.1647592.9207051302810765638.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the locking/core branch of tip: Commit-ID: f92d22b00e3f75fad2efd965b20d49b4e763b792 Gitweb: https://git.kernel.org/tip/f92d22b00e3f75fad2efd965b20d49b4e= 763b792 Author: Boqun Feng AuthorDate: Tue, 03 Mar 2026 12:16:52 -08:00 Committer: Peter Zijlstra CommitterDate: Sun, 08 Mar 2026 11:06:48 +01:00 rust: helpers: Generify the definitions of rust_helper_*_xchg* To support atomic pointers, more xchg helpers will be introduced, hence define macros to generate these helpers to ease the introduction of the future helpers. Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260117122243.24404-3-boqun.feng@gmail.com Link: https://patch.msgid.link/20260303201701.12204-5-boqun@kernel.org --- rust/helpers/atomic_ext.c | 48 +++++++++----------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/rust/helpers/atomic_ext.c b/rust/helpers/atomic_ext.c index f471c1f..c5f665b 100644 --- a/rust/helpers/atomic_ext.c +++ b/rust/helpers/atomic_ext.c @@ -44,45 +44,21 @@ GEN_READ_SET_HELPERS(i16, s16) * The architectures that currently support Rust (x86_64, armv7, * arm64, riscv, and loongarch) satisfy these requirements. */ -__rust_helper s8 rust_helper_atomic_i8_xchg(s8 *ptr, s8 new) -{ - return xchg(ptr, new); -} - -__rust_helper s16 rust_helper_atomic_i16_xchg(s16 *ptr, s16 new) -{ - return xchg(ptr, new); -} - -__rust_helper s8 rust_helper_atomic_i8_xchg_acquire(s8 *ptr, s8 new) -{ - return xchg_acquire(ptr, new); -} - -__rust_helper s16 rust_helper_atomic_i16_xchg_acquire(s16 *ptr, s16 new) -{ - return xchg_acquire(ptr, new); -} - -__rust_helper s8 rust_helper_atomic_i8_xchg_release(s8 *ptr, s8 new) -{ - return xchg_release(ptr, new); -} - -__rust_helper s16 rust_helper_atomic_i16_xchg_release(s16 *ptr, s16 new) -{ - return xchg_release(ptr, new); +#define GEN_XCHG_HELPER(tname, type, suffix) \ +__rust_helper type \ +rust_helper_atomic_##tname##_xchg##suffix(type *ptr, type new) \ +{ \ + return xchg##suffix(ptr, new); \ } =20 -__rust_helper s8 rust_helper_atomic_i8_xchg_relaxed(s8 *ptr, s8 new) -{ - return xchg_relaxed(ptr, new); -} +#define GEN_XCHG_HELPERS(tname, type) \ + GEN_XCHG_HELPER(tname, type, ) \ + GEN_XCHG_HELPER(tname, type, _acquire) \ + GEN_XCHG_HELPER(tname, type, _release) \ + GEN_XCHG_HELPER(tname, type, _relaxed) \ =20 -__rust_helper s16 rust_helper_atomic_i16_xchg_relaxed(s16 *ptr, s16 new) -{ - return xchg_relaxed(ptr, new); -} +GEN_XCHG_HELPERS(i8, s8) +GEN_XCHG_HELPERS(i16, s16) =20 /* * try_cmpxchg helpers depend on ARCH_SUPPORTS_ATOMIC_RMW and on the