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 95C59448D0A; Wed, 29 Jul 2026 09:55:15 +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=1785318919; cv=none; b=pp2NFKLsjbB3u/nE81dRnmvXeei7XBPBSubFleIEHJOGFcZqqlFm1Cyhamms+yM/vykiH+SSjQpZ3lYbw7DpZDusvpeusk6v0zTk9p3h6K4CIK6BLVTRMF3eqHAbOICwhQq3Fv1gDN1Rnju3eXRJMBEC8g9TR5OPgb6GVdhfWrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785318919; c=relaxed/simple; bh=BDMiSovE15fxTD6YDa0mfDjnWJqf1IpRZyrKeRq+0Vc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=nZunHrbVxqXQX7JWighGyRArbc/nKPKYUprtVFn9Dm/j/XBMqspRP+ervZgSoT74z72c0zPm49tFjQHBjRnkN1Auu9ADQRyhBLP8PfnnMsu5HouAr9fRpE37Y1TAqHKhL+OUgrmX/2EuFGBL5t32TKvuZIaGfraomCa3M+RE/2U= 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=Jjujx9pd; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+tc6AMSm; 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="Jjujx9pd"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+tc6AMSm" Date: Wed, 29 Jul 2026 09:55:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1785318912; 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=iTK/X9LVBtAXBWSlUzQGZgIovFDMxPfokOOE+8z6ccU=; b=Jjujx9pdI6RBLexfy2T1t/wzeLJN523RbUTLJM494Gg2VL8ATtqKzFsFI6Of1qoTBf04rp GfYOI7FUwcHvN+A25+Q8X6U9/N0Vkh4i/vYNsgKt/zsdstRGP0Xi451EWohdzpnxJ6ZBrH 2cyUn+kpDP6F8aqf7jSAcpjzSR87oyk2e2dlggcJU+brqa5qIPJSK0UuN3luQGKqoEgt/h oANvCyrXM+YnSOtAld5zgovEK1gk9RDzVtvJtqnebcWbr7o9FUcqHY0Kc3DtUVgI5mI2J/ Q5yHWXtzd3wZup22Xol8Cvy2NZbe9GpCxlKPnoFdf8j50HE4E8GTIDdmRuESbg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1785318912; 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=iTK/X9LVBtAXBWSlUzQGZgIovFDMxPfokOOE+8z6ccU=; b=+tc6AMSmqnnmCLT70CEPPtVs/o1JxgtYz8cABWaOTRbPqq1cyX2+ECY5evd8NAYzjTKTlQ TrGHFGVcrrplvwAg== 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: <178531891114.112641.14905535804797805774.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: 2593da6abcabe0b9d93d1bb9affff5769e16e844 Gitweb: https://git.kernel.org/tip/2593da6abcabe0b9d93d1bb9affff5769e1= 6e844 Author: K Prateek Nayak AuthorDate: Tue, 28 Jul 2026 05:25:38=20 Committer: Peter Zijlstra CommitterDate: Tue, 28 Jul 2026 13:07:15 +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) {