From mboxrd@z Thu Jan 1 00:00:00 1970 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 748FC4749F7; Wed, 29 Jul 2026 11:22:26 +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=1785324148; cv=none; b=jzBu6Df+wqyEdgkJRutB8rHr1bv7dGRBvVEHseP51XFqGPeYkRjJ8NbdqiDi6wRbwiDQrPfqr/mMNhJKq1CGjid+llsnj6OFsPC0qCjndbu/R/YjCbyf15UnORrK+EUN+InT6E0Rcdkfisn2ZH8+PxouR6ny9WWWYh7SBffoX8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785324148; c=relaxed/simple; bh=PGTj2B6ZunnCx4h/3mvQBUyweW1wFtWfn/xFbFctUWA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=uUGOp/H4ZQoZMdkNakouzxjC2Tg3lmaCF+y2ycHBh4pqVhGW9h/2OIUp6DaZLV2BQFcnCEmMT2TXlK/0NyUef9xnZ7ZCz6ofzy6DUcHi8Q6yGtngsG4E1xORvv3wTY2Sou2AjIu+rRXKXQBTXldy1dDZbbYRlGYLKxFMzzNydeU= 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=IIOV1gTr; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RTDQWYDY; 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="IIOV1gTr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RTDQWYDY" Date: Wed, 29 Jul 2026 11:22:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1785324144; 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=KdJytfAcgQvt7wsYq/urtfgXj57DM0iHPdV+Pv3r53Y=; b=IIOV1gTrhTkPdcN55kkr/sv3k3E8/+5gmYrbmqwoyWfgcT/eHx3HZL45dfdWxurqMXKOPt Asjw857vpjx5SWsrdRN5ERAd/isP7cLt0VmznKQ9FlSFaqrK6jmvg0bhyz7ZA3I0J9PNry wRbpKOLV+4PKeAZrMC1ijtN2CjiC0e5PvInrmw6IWSA5m2FfVxQKYatbdd2URyg8dLv19B ++i3Sz/JuNmfisgRHA2C+BodfY8e/Bxv6dHdShmOtUTN2OSHl52DycHmBeYBddybueXFvr cEEMuqqD+LH6fadfxJlZ3hKmn048gj89TwItK5Vxfma7es87F4QRb24CtmNGQA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1785324144; 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=KdJytfAcgQvt7wsYq/urtfgXj57DM0iHPdV+Pv3r53Y=; b=RTDQWYDYdomX4cso4+06DusmuZQ490wVc5L+jCsnkTsO/EPffFdmRZs99gYn62h0R2wrPB 4q6BlWx45LiWOiDA== From: "tip-bot2 for K Prateek Nayak" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] s390/runtime-const: Introduce runtime_const_mask_32() Cc: K Prateek Nayak , "Peter Zijlstra (Intel)" , Heiko Carstens , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260728052540.4728-7-kprateek.nayak@amd.com> References: <20260728052540.4728-7-kprateek.nayak@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178532414301.112641.2041167141528939175.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: cf0de88094a7b4df18008b6efb1290f4efed731f Gitweb: https://git.kernel.org/tip/cf0de88094a7b4df18008b6efb1290f4efe= d731f Author: K Prateek Nayak AuthorDate: Tue, 28 Jul 2026 05:25:38=20 Committer: Peter Zijlstra CommitterDate: Wed, 29 Jul 2026 13:17:52 +02:00 s390/runtime-const: Introduce runtime_const_mask_32() Futex hash computation requires a mask operation with read-only after init data that will be converted to a runtime constant in the subsequent commit. Introduce runtime_const_mask_32 to further optimize the mask operation in the futex hash computation hot path. GCC generates a: nilf %r1, to tackle arbitrary 32-bit masks and the same is implemented here. Immediate patching pattern for __runtime_fixup_mask() has been adopted from __runtime_fixup_ptr(). Signed-off-by: K Prateek Nayak Signed-off-by: Peter Zijlstra (Intel) Acked-by: Heiko Carstens Link: https://patch.msgid.link/20260728052540.4728-7-kprateek.nayak@amd.com --- arch/s390/include/asm/runtime-const.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/s390/include/asm/runtime-const.h b/arch/s390/include/asm/ru= ntime-const.h index 17878b1..7b71156 100644 --- a/arch/s390/include/asm/runtime-const.h +++ b/arch/s390/include/asm/runtime-const.h @@ -33,6 +33,20 @@ __ret; \ }) =20 +#define runtime_const_mask_32(val, sym) \ +({ \ + unsigned int __ret =3D (val); \ + \ + asm_inline( \ + "0: nilf %[__ret],12\n" \ + ".pushsection runtime_mask_" #sym ",\"a\"\n" \ + ".long 0b - .\n" \ + ".popsection" \ + : [__ret] "+d" (__ret) \ + : : "cc"); \ + __ret; \ +}) + #define runtime_const_init(type, sym) do { \ extern s32 __start_runtime_##type##_##sym[]; \ extern s32 __stop_runtime_##type##_##sym[]; \ @@ -43,12 +57,12 @@ __stop_runtime_##type##_##sym); \ } while (0) =20 -/* 32-bit immediate for iihf and iilf in bits in I2 field */ static inline void __runtime_fixup_32(u32 *p, unsigned int val) { s390_kernel_write(p, &val, sizeof(val)); } =20 +/* 32-bit immediate for iihf and iilf in bits in I2 field */ static inline void __runtime_fixup_ptr(void *where, unsigned long val) { __runtime_fixup_32(where + 2, val >> 32); @@ -65,6 +79,12 @@ static inline void __runtime_fixup_shift(void *where, unsi= gned long val) s390_kernel_write(where, &insn, sizeof(insn)); } =20 +/* 32-bit immediate for nilf in bits in I2 field */ +static inline void __runtime_fixup_mask(void *where, unsigned long val) +{ + __runtime_fixup_32(where + 2, val); +} + static inline void runtime_const_fixup(void (*fn)(void *, unsigned long), unsigned long val, s32 *start, s32 *end) {