From nobody Fri Sep 25 02:02:25 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 971164DEC22; Thu, 17 Sep 2026 19:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672976; cv=none; b=ScO3/QhpdKz1xvuaYxxUKkbPsupikxVOCT3sr69VTrhACAUDHOcez+yuNE1GWVMNzJi0lJXHxZLn5CiHkvtc6uX15divTwtH/V3mJnrgz2qBUcxUgz1AHP6VRvjfxpwPz6XQCS3+oT2fEiIc6N/mfBUhx9hWYHqkn2efxBIbi60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672976; c=relaxed/simple; bh=ETfxXUjrRH4J/di1U8Xgg8F4wjJw+tcsn5O1uG+VX9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HiFaCh6atgnTUs4F61X6jvZTjLfhZ2eO/vf9Dkf0iLK6T1KN6FNqUooZ0sO28V7YgD6BQX1Lbi5L7LbEHS6TkF8AoFSHG0GQ/G5hZA9XbDBEEyTHni/jqtSfq+hwgotrtQc9+Myuybag5S9eYx81+IwlVeJtjmYYUWtw8whpPho= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=dAPsSqqF; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="dAPsSqqF" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVWlb3143323; Thu, 17 Sep 2026 19:22:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=hCQN16gxRDgP67dcL modHocT/4BhIAkQwOZ2klcPTOE=; b=dAPsSqqF37MaGJkeOlR6bzRae28DWnt9B UQk4qiABBA8oPhqO+oiepyD8JGpdLn22h+wLENarlI1PhPepLY1cAYl6Q0fKQjEx iIc2Yxwgb88TYWXgYV5rzcGqtHdqHVI8NRy54IoVZD+xWIgs+ddqWf02WkaL3Lcz 4oaXdy5MSEFewp5z+3sgbw5ImtUZJy2Ca+ZY9920E8bSN8SXg15/OhyNU1cym8TR kSBJQsiwjjvWAy5YG/M816YC7/s5BEC2xW2lcTZjztVmTkIY25/LCtAYMOGn9hNR 9ZLTNVHr6GKknvafNTtYUeDk33Rwz2XLhea4RSzepwlNf1cSxgHyA== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmx844d3d-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH93oC3510145; Thu, 17 Sep 2026 19:22:41 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5xa3w6t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:41 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMb5e46661890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:37 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B422C20040; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 849932004B; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 01/12] s390/percpu: Fix comment typo Date: Thu, 17 Sep 2026 21:22:26 +0200 Message-ID: <20260917192237.638324-2-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX8GHBRyZBZLsR xfby9IiJqkI0fIPYYtDu3swJTbzZfgMcgjSrbTN4wjsC1ZOWQsK0HGUx1alk11P+VdIESgeqlEw xAuyFCz+rsesqQCtChuULjEpV0bbYrYIuSt8H1fdwV91OjprSNqIY3Xhoe7wIVX8SqrFwt8E6F+ oCzIUQ9ZO7wGbkqjKqrCzMGh/0JzARr2qJeMEu2DiuWmombgaX1C83ygvBsaL7QYvR0/7MXlm26 dH9ZcA54NHFHdNBtfKai9qT/1atL3RpfhTYCym/FhvfmLzgXH46HVU+yFnUjMHVceTaLDsuoYOn /AOmxWehGS74TXcurL2ERLck1wrkmcqGP5WWkv8tGfPbaDcwiXd/VlT+VNaWQ1HEA2fUTu2Ik1I jn5VUAwZPS9gH9HCMlI29sDvUmpvhlYY3Ayphqki8OT/9uyjnqwcmU6btMopw2KUxzvuiCuZz1+ 9yBBvO2hE8FxlLujRyA== X-Proofpoint-ORIG-GUID: Ydqo8iEA713tMntoaDq8WSN_G6qdUNP7 X-Proofpoint-GUID: Ydqo8iEA713tMntoaDq8WSN_G6qdUNP7 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX439o7aWuBCxj XZiL3oZWGa57t7ns41jbmE+FLJd0a3g0iT7P52OaSJaAaFkp5iWD0sWvz7HuDoyQxAH9ekvjolk IMgbrUVWb/Ql9/X7rYeKO0xejJ+kU1g= X-Authority-Analysis: v=2.4 cv=cY9HPXDM c=1 sm=1 tr=0 ts=6aac3e02 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=I_7Bz9khIIb0WmrdVP8A:9 a=zZCYzV9kfG8A:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 bulkscore=0 clxscore=1015 suspectscore=0 impostorscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" This is all preempt_disable() / preempt_enable() pairs and not preempt_disable() / preempt_disable() pairs. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index feb58acf87d6..31012abe8292 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -63,7 +63,7 @@ /* * Macros to be used for percpu code section based on atomic instructions. * - * Avoid the need to use preempt_disable() / preempt_disable() pairs and t= he + * Avoid the need to use preempt_disable() / preempt_enable() pairs and the * conditional preempt_schedule_notrace() function calls which come with * this. The idea is that this_cpu operations based on atomic instructions= are * guarded with mviy instructions: --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 E02D24DEC1D; Thu, 17 Sep 2026 19:22:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672973; cv=none; b=HQNtkvJ5QxgJxSOUkQa7wEJ7FVjs7j/GFkab2kOgam7/u2jFyzlIFIMaB7AbM0hFsGB8K7FzAt5vvHKu/XE/ljkKT45RiEDbVutEflurnv5GOxxwKjPsunai9uDneyiLhkPim4raj1zUsEAC/jDD2ZeUMWw5Ttm4ozpHlHD9Fdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672973; c=relaxed/simple; bh=Su7sJp4PolGeOOs8L1MNG5ZVxwB1v+NWwbtvFp2GpUk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yo6StarY9xf+gkAjlEcRn+rO76CcO0Q7vKwVpp3QblztlhByFSYk0OiLdiJzm1U4jD7FiZZcjqMJ3lHBbClo3q1tcdDPNqJ0izvyOdi3AyIbHgCWIWPk+MCsWGN0UUXuXZhRg+IsTOOUNs2Q1Krk7wyvmgbr4HvAn9XtajbX5nI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=sQu6NSSr; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="sQu6NSSr" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVe6u2998424; Thu, 17 Sep 2026 19:22:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=O51KxBvtVfbHMzPOo XoHcywhUhm2H4kz862QP8ALIJw=; b=sQu6NSSregPH14u1r3J1aTzMPpCtTNDfL SHp5zHPOgMY8d1Q2KCoMHD04Z4vul5+pX+6c9BGsSPGX31w+aPeOGXfzbURn0HCj MC5toRxRBT0IYlb4HUnVdu7QnFxApK++N4I1yjmnVgm8sA2cUb/oSMPPtXn05aVk mkD31CSI2mR97048IICFpYsjqua8ww61ANFb88vXBVaM5lGpYhAsGXDePFUKSNfY dxcJuUVJ5U0Rb4s6IM54rnpfT/vSbr7ALZFciijmUend6Du71oVpX9YqRu0fHkzZ AKVoD6T98JcglwoOjqnKwOZrjon/k1pxhF8eRUiYrHelK7Zns1p5Q== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmv5j458t-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH940E261585; Thu, 17 Sep 2026 19:22:41 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4gr7gekk3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:41 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMcBP38142426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:38 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E86EC20040; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B892E20049; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 02/12] s390/percpu: Add sanity check to GEN_MVIY macro Date: Thu, 17 Sep 2026 21:22:27 +0200 Message-ID: <20260917192237.638324-3-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX26T6KMKwu6YL 5fXnHdzjJ0WgRn6KaFijtfR+p5zN5rhn430UlQvz/Qifs/4DCMYbktcyjthbheDjh1Bv7i1LUtG TFzDi+PHV5J7iVyUbZ2q0/qVVACLPeb/qJuLQL+zpiMdGZIWsLq0ps+/Fteq1ED0yUMb8fynz3c wp7UCewSBrzTfM4BD0fO2BUKka+LIXmdQ0Q6NHkmj7wE7GgPojXWGj/wrmUEhQzPtDg0mc/y4Es Ofh4krSsfxUItt4Kh3B2G6htTpYTmJZObEB/ULGKXkjybNSg3oP3g4GM/cVhFY0R6BwfuvvolKy 5/KiMEc1REnX2BFzD2TVfuMOLUXrKtOz/G7zFzfdnWlQmfp+oYwtBAogWYV/65pevTuMVi+j2vl CX8gnXeVECs1rrKNdCsE3EPJVcKKvhB8NOqx2vZ0k+kSb6Hsd/FW/eM8cadm52F0+n6OIJdjmHC YAPvm2/MqsrvxznnIlA== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfXwMoLUJW+lmrT UUce9n83t18SokdJfHJ84PBly41zs/zo0PqRM9nbCSziDtY6D/Y98k3xAcbo3kNiCq7zb+g6hQi C1VjTiBddsUsmuhO0yne95Dtdn0W1MU= X-Authority-Analysis: v=2.4 cv=Zsx4uN7G c=1 sm=1 tr=0 ts=6aac3e02 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=nXcjTbxpPpxkwf3kCnwA:9 X-Proofpoint-ORIG-GUID: 9NjdtlrRKsI0NpMQl5AY0ChWIuKUP-Yo X-Proofpoint-GUID: 9NjdtlrRKsI0NpMQl5AY0ChWIuKUP-Yo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Emit an error if the GEN_MVIY macro fails to parse the passed register string. This will make it more obvious if something similar which was fixed with [1] happens again. [1] commit 101782f8945a ("s390/percpu: Fix MVIY_PERCPU() with older binutil= s") Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 31012abe8292..9888b38dedab 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -100,12 +100,17 @@ */ =20 #define MVIY_PERCPU(disp, dispalt, reg) \ - ".macro GEN_MVIY disp reg\n" \ + ".macro GEN_MVIY disp, reg\n" \ + ".set .Lreg,255\n" \ ".irp rs,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n" \ " .ifc \\reg,%%r\\rs\n" \ - " mviy \\disp(%%r0),\\rs\n" \ + " .set .Lreg,\\rs\n" \ " .endif\n" \ ".endr\n" \ + ".if .Lreg =3D=3D 255\n" \ + " .error \"Illegal register number\"\n" \ + ".endif\n" \ + "mviy \\disp(%%r0),.Lreg\n" \ ".endm\n" \ ALTERNATIVE("GEN_MVIY " disp ", " reg "\n", \ "GEN_MVIY " dispalt ", " reg "\n", \ --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 75E3B391E64; Thu, 17 Sep 2026 19:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672975; cv=none; b=mJqHhCbbB53hY53Lh1XBGi5f3bQ3OxWx18sRz2IgrFV96a9REE+nc+8NpfqOk2DVLXs4Bka/tP4BiqznuAmo9YJHO+ngjV+9sIvTxTwVWX39Zz+L2c7sM4tIhU57LoBabL73O3LaH+Nwd6hwWhf4Yz2eUbz9cOsGGOmQ5VT/f0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672975; c=relaxed/simple; bh=QuLPXVAFgIJ9fPxmYJemmPvdwZIjvEMVor4YZEw3MJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GSDUuwUIrmElCT/NZEvhHaiNvKWdOjjp+95sHg0jkBdNUEf33w6aLp0MHq31HqD/WWldeQLynASUla3AxkSIQmUtOkDQRXW3TY9VTd5sGSxxvUZDD0KSyC7Lpp+7S46HQ5Fy6tbqF2ox6AF0ZhdXTVyfwX3m4AoW+e3DBAVS4xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Hqf9UKCs; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Hqf9UKCs" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVUrZ3143304; Thu, 17 Sep 2026 19:22:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=UbSM4J6q9wHJGxcag Fzwg95TRKRs0Sfalw4VwKXSGug=; b=Hqf9UKCsyaWrTkyiSPY6qTCbtlIiXxUIx 7SNqecuB2OWRkFA4BFiBjVp4tO78RFyQs0FvvDCPIl5mjhPprNvDSSNad5lFHp3c MrtGMXpTa2mQGXm4LY0r0Uu5sQCTwc3LA1IflAcdFSVDdBWSRagmMn4OCE6l66x1 bjKLNCiYHiNguyusfle5L7qU9T34AGz0zznrmpGxtKUDzoWYQZcJlevCVeylx3Wx sWAWdDzKf1GwgVugQ2rMf7uEpLU5IvxvmTjqdKjWxlF5tD3GifJ2oaXEWNtc3z4z L6z6PLx7m2u1T9YXEyyGZWw7kG7orYidWb8/hRp4+qTASfBM++xZA== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmx844d3e-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH917C3546859; Thu, 17 Sep 2026 19:22:41 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4gr5ffc0er-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:41 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMcBN38142428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:38 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 263E120040; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC0EF2004B; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:37 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 03/12] s390/lowcore: Remove _AC() from LOWCORE_ALT_ADDRESS Date: Thu, 17 Sep 2026 21:22:28 +0200 Message-ID: <20260917192237.638324-4-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX6Jrqbjt/05P5 x8lgyAuL6TOruU/4vtQ4HWDEHYtwNnG7OMtGxRLf3ny/pL/7crNV+XSRQR08xes2rDLPT6OZLUZ wCUAZ8kDrdwYlGD9cu3zGeZ8iwREWD+YlLctirprHpcBiUI6/gUj4YT/35/QD+qoTK/0qhrIIFH nSqQF4zN7nrRjxTqpyeNS0hJ8uDgx6cesE+CLAlt7flu6jUb+38D01VKQYOvAxbWKMf7z6bS+qt 0lAg1SGrdhA7N2sv5kLboBhsFjO7q9UnSMQhjpIZj0I2anYoTqS1+lTKZvy8iOuVQshYZk8T3rP H9G5Do81/6HjnTFs9Mt2Xkz1CKAWcCOIhDwGZ8H1R+RbrKYsvoKZ3Dq/LQZ8FkolQUzd+csgBDG tZjE1LgPC0XPxA+EuXupTin4+cErwFSSNU53RG3IJh8UviE7Q6464xI/WlAXMRNp6QIt642Ss7u wwHj3B57/aivuqEXOKQ== X-Proofpoint-ORIG-GUID: ABtCn93jc2FTv25Uf-pzxWRJLfvAoC1L X-Proofpoint-GUID: ABtCn93jc2FTv25Uf-pzxWRJLfvAoC1L X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX4KY2WgyJFvfG ICfg8IyDkcWVLJ+BlnDl5heT5bExwt3b24WLgzWpbxz6s8JKnzmgfZTcCibYQZeLY+StPA4zwFL nXp4GNKsNf4cQWGdgWZGenlKNOxoQSY= X-Authority-Analysis: v=2.4 cv=cY9HPXDM c=1 sm=1 tr=0 ts=6aac3e02 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=phCDqYjOjFlr_q_ZZjMA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 bulkscore=0 clxscore=1015 suspectscore=0 impostorscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Remove the _AC() conversion from LOWCORE_ALT_ADDRESS. This changes the type of LOWCORE_ALT_ADDRESS from unsigned long to int in C code, however looking at the current users this should not cause any changes. This allows to use __stringify(LOWCORE_ALT_ADDRESS) for inline assemblies, which otherwise wouldn't work because of the UL suffix. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/lowcore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcor= e.h index 5cef215d30e7..f0364a9f8a19 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h @@ -21,7 +21,7 @@ #define LC_ORDER 1 #define LC_PAGES 2 =20 -#define LOWCORE_ALT_ADDRESS _AC(0x70000, UL) +#define LOWCORE_ALT_ADDRESS 0x70000 =20 #ifndef __ASSEMBLER__ =20 --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 5CC6D4E36F0; Thu, 17 Sep 2026 19:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672982; cv=none; b=nHVL+6zIQRR7bz5kwY/AnMx3fxcWArgRt4PxEYF1zN3CWlo1kQrKS/UysQR52G72+fUM1+4sYH2iRBeiKbv1iNvUUNB1KJVdtEMxeXbcjGng61e2iy2aKiKG2Qe/uzpXeYoi0uhSRHOF3x/YF9CKFQR5g+lURvHD9T4BvLGja1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672982; c=relaxed/simple; bh=L9Ij3getWBZq07w9zFlUy7KUk7sMBLlhVRMHwdYIPrQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FgFU8iTMN1HTcXpaRZLzx4sViojtEGpwMEh4y+9pUYQWtpEYn2rlCFiq1yMMGGleV2NQfgW6h6nXFNwwvHFLsgyqTa/yATSlfoUb5Z21fGcENzYdXS0JD1MVsoo0pb1M+yb4UAt2Vdr1zEZ3OvJyZm0vHtw/8p2PdrtB+VvR9UI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=L3ubibzX; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="L3ubibzX" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVfWd2998433; Thu, 17 Sep 2026 19:22:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=6vkX4/4srtGVL00eB lnDW3Vf7ORPxfh/h7S4hVZQJQs=; b=L3ubibzXtEfUw9jm9eYLv0i+D2BtnQt9v 5iRvU861YJmUV+WWSDiQyXcAIK/0PE1qUGDsNAaXRqQlNgHV0XWmcKWTASa+bhCS VgpLhbGNl/JzPPD/5ZC4Sd2qI2JmHNv0akbOwQ/bkdmJzR7obBk60xfvFnEY5KU8 scUz9xbRviuFVoDmjJnH6B4OmZf/e5HH50TBRbbfYXbT/jMmZsO7vyXdTOC1GMQ/ ONM6ki+GlwUlO1x+6XwJ7LMXvK5pI+e4DQgvN51MgVicXfgfTaGADpmSg81gPXLe bIjr6gpHWRdow3NYN6bp/Msq3TzhvIuhI1KGLqFO/MciGksLuhucg== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmv5j458v-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH9JeC3494081; Thu, 17 Sep 2026 19:22:42 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5fjm08b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMcEv38142430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:38 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 57D5F20040; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 29F8120049; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 04/12] s390/percpu: Let MVIY_PERCPU() calculate alternative displacement Date: Thu, 17 Sep 2026 21:22:29 +0200 Message-ID: <20260917192237.638324-5-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfXzLoyztQWquHV YQUuc8BFkB8TcAJSSG2oZK7IKI0RtPRvCoN9X0sBaG7jC0rp2VAmUcT3eVu72MShl1k2HOW6Jdq LC4O1LK/wDqtiv4eAymznYmEBYvBFmlqzNOTG3qu3xrrSsX+hY9w3flTJbvP1lkLL/LmNMK15kS y0v5pJczrUMQpYTtDM5FVMGPc4u4GYrAZkvIEQ4SC7nAm1Gnf0DTH86+JU62k6Rw5HqcprgmAZ+ ZwI/7IxFlTQe68E3y3whe5KzQLoI8uA2xof1gaqW0ImVOHLKoZDkrxOxrIP0xbbm7YP8hNpcLqz ybEmk7QwjFUvhBG/z6op7uOI2nR2f1zNCvTpfzLbi7mJCSEsOOaCs0YbO7MquBPOHeIpgcRpp5W 81rz6LMRNTWVhJL4A6uKTLmdCSbzyU1YCEkV1ftQsUVLGl9xgOmUdxxkR4R+ugk3uxjAnU2xw9i aMFryAH3KyYO8MotSQQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX8zSHW8tpiZDO WVdkLppdAz3qk+wmZkOFjwBVS87p2TE3yuF6qkhY0qNmNqPssYYgA60wCEkfYyUuKbq8GgDDfwR IQjuVisgf3+WSMW/ABdKRJgHoL+NI/0= X-Authority-Analysis: v=2.4 cv=Zsx4uN7G c=1 sm=1 tr=0 ts=6aac3e02 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=WUj23-fQfn3YcGJ_ZbEA:9 X-Proofpoint-ORIG-GUID: G8b-dYoKcWs_XPiIEYZuDSOAd9XG4bR4 X-Proofpoint-GUID: G8b-dYoKcWs_XPiIEYZuDSOAd9XG4bR4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Let MVIY_PERCPU() calculate the alternative lowcore displacement instead of passing the same value(s) again and again in all percpu inline assemblies. This shortens the inline assemblies and makes them a bit more readable. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 68 +++++++++++++++------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 9888b38dedab..3bc448c4c2dd 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -99,7 +99,9 @@ * MVIY_ALT(...) <- end of percpu code section */ =20 -#define MVIY_PERCPU(disp, dispalt, reg) \ +#define LC_ALT_ADDR __stringify(LOWCORE_ALT_ADDRESS) + +#define MVIY_PERCPU(disp, reg) \ ".macro GEN_MVIY disp, reg\n" \ ".set .Lreg,255\n" \ ".irp rs,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n" \ @@ -112,19 +114,19 @@ ".endif\n" \ "mviy \\disp(%%r0),.Lreg\n" \ ".endm\n" \ - ALTERNATIVE("GEN_MVIY " disp ", " reg "\n", \ - "GEN_MVIY " dispalt ", " reg "\n", \ + ALTERNATIVE("GEN_MVIY " disp " , " reg "\n", \ + "GEN_MVIY " disp "+" LC_ALT_ADDR " , " reg "\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) \ ".purgem GEN_MVIY\n" =20 -#define MVIY_ALT(disp, dispalt) \ - ALTERNATIVE(" mviy " disp "(%%r0),0\n", \ - " mviy " dispalt "(%%r0),0\n", \ +#define MVIY_ALT(disp) \ + ALTERNATIVE(" mviy " disp "(%%r0),0\n", \ + " mviy " disp "+" LC_ALT_ADDR "(%%r0),0\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) =20 -#define AG_ALT(disp, dispalt, reg) \ - ALTERNATIVE(" ag " reg ", " disp "(%%r0)\n", \ - " ag " reg ", " dispalt "(%%r0)\n", \ +#define AG_ALT(disp, reg) \ + ALTERNATIVE(" ag " reg ", " disp "(%%r0)\n", \ + " ag " reg ", " disp "+" LC_ALT_ADDR "(%%r0)\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) =20 #ifndef MARCH_HAS_Z196_FEATURES @@ -153,33 +155,29 @@ do { \ if (__builtin_constant_p(val__) && \ ((szcast)val__ > -129) && ((szcast)val__ < 128)) { \ asm volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\ - AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ + AG_ALT("%[disppcpo]", "%[ptr__]") \ op2 " 0(%[ptr__]),%[val__]\n" \ - MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]") \ + MVIY_ALT("%[disppcpr]") \ : [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "i" ((szcast)val__), \ [disppcpr] "i" (lc_pcpr), \ [disppcpo] "i" (lc_pcpo), \ - [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS), \ - [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } else { \ asm volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\ - AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[disppcpr]", "%[ptr__]") \ + AG_ALT("%[disppcpo]", "%[ptr__]") \ op1 " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]") \ + MVIY_ALT("%[disppcpr]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ [disppcpr] "i" (lc_pcpr), \ [disppcpo] "i" (lc_pcpo), \ - [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS), \ - [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } \ @@ -199,18 +197,16 @@ do { \ lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\ - AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ + AG_ALT("%[disppcpo]","%[ptr__]") \ op " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]") \ + MVIY_ALT("%[disppcpr]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ [disppcpr] "i" (lc_pcpr), \ [disppcpo] "i" (lc_pcpo), \ - [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS), \ - [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ old__ + val__; \ @@ -230,18 +226,16 @@ do { \ lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\ - AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ + AG_ALT("%[disppcpo]","%[ptr__]") \ op " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]") \ + MVIY_ALT("%[disppcpr]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ [disppcpr] "i" (lc_pcpr), \ [disppcpo] "i" (lc_pcpo), \ - [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS), \ - [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } while (0) @@ -263,16 +257,14 @@ do { \ lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\ - AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ + AG_ALT("%[disppcpo]","%[ptr__]") \ op " %[res__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]") \ + MVIY_ALT("%[disppcpr]") \ : [res__] "=3D&d" (res__), [ptr__] "+&a" (ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [disppcpr] "i" (lc_pcpr), \ [disppcpo] "i" (lc_pcpo), \ - [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS), \ - [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS), \ "m" (*ptr__), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ @@ -294,17 +286,15 @@ do { \ lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[dispaltpcpr]", "%[ptr__]")\ - AG_ALT("%[disppcpo]", "%[dispaltpcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ + AG_ALT("%[disppcpo]","%[ptr__]") \ op " %[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]", "%[dispaltpcpr]") \ + MVIY_ALT("%[disppcpr]") \ : [ptr__] "+&a" (ptr__), "=3Dm" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ [disppcpr] "i" (lc_pcpr), \ [disppcpo] "i" (lc_pcpo), \ - [dispaltpcpr] "i" (lc_pcpr + LOWCORE_ALT_ADDRESS), \ - [dispaltpcpo] "i" (lc_pcpo + LOWCORE_ALT_ADDRESS), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } while (0) --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 DB9854E36D6; Thu, 17 Sep 2026 19:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; cv=none; b=MHgNcx96XvmZ0VItowvt8QshsRwhiDLGZ+WRLE8ypSB2KVeLl0EykrHJbk+GeHER6i6CEFW6GF4QO3KB+5zCO6mGMDlbgljANaal0Q33s3up4XTThXkMsmHJshGeuVlnCd8Cu5UAD/TW1ZbqDsvzlM+95SGcjoO+pkACeFXjqJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; c=relaxed/simple; bh=q3feutpAnSLBiMlQsf+M6LwHgqq6gRLSOi0PSsAsJHk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TLsBloguEpzboqqqlQAIlvOmWcTYMCVGd2+wELJh4qGlIcS/TbYWNAFeUHdftU5ZwBd1bJzuRJVDJS87F3MewxdvFEwvQZaLrM6xPXeYZ+JH3GUYpGGUT2zz/GJg6jx0PNLgxYBI7vHngQ7yltD9PQicbIDVYMYMVPDqbC9JVkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=C7JZIyBd; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="C7JZIyBd" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVg5r1272135; Thu, 17 Sep 2026 19:22:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=yFttNDr/jL+XKYy8C gRbemN5SwM72xNcqWL7fq27Vso=; b=C7JZIyBddjSQmGEcSHM0l0mHtz1IlFEx9 7pXIKmFFAt9X67Ua6GA7ZblgBRFrhHBJe2lHadz+sOyrJtpNFmi+Y1KTdJIJxgD4 c2hncQiGZOjQsJR2/n8Rdt2Hu982AOnJ8OUp58drOB+v2+c8YyFQ4IAFViKciSSX YKaSm8QFY4Gzk2vHoZ5+Nm6DTFSivxPqn/k3ffTGFVTiBNILWkvCdhPPgIkFanid BO20sld3yRyNHyAIU7EYaqCvhPdXHhbYxqBKqGLy3H7muz8HFo8sQKDgaK9KmP+2 OJQEVf7l4I5ppoSlsDr6K7gHXdX628KEt56Ja5xyy0KFKSLrG7UWg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmxdqmcjm-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH91VG3546860; Thu, 17 Sep 2026 19:22:42 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4gr5ffc0es-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMcRJ38142432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:38 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A18320049; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C45C2004B; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 05/12] s390/percpu/lowcore: Add and use LC_PERCPU lowcore offset defines Date: Thu, 17 Sep 2026 21:22:30 +0200 Message-ID: <20260917192237.638324-6-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX361+fJENmmY3 l6cvKZJyCX+OHeGiu1mAKHa4IWvTv+Nb69klMT69iUzFA5C77zDsFWBt10YQPezuxNaslY1Y3jZ MZh/iFNZ9lF6wj2e+YxLfka+6UnQcP+JlmhBQw8fR89JJvSCXtzawT+ttlEs9zFCoJ3HbWahVPw 5meICnAXLXWwy/Mf8WQFlTXolz4mA3OddQ0MWhOSvYy4QLzT3cRJ7e4tf7YjjAJTjO8WpREnlKa O/uPgXbUhcVwdJ5qeocsONI9mUNcc1q7/SkwzTJED8Wh3DIgNPLV+tZC7AeO5i8fiEcbJFiZHPl 3XHERwTU/TxRyPXU2owYbXBQZq2boRjvQ4eNodIYHHh07iKi0E+XOXDAXC/CFC1qGz2cdVwMUWG 43OJ4XNCPA6rz/u+C7r7pnJYA6pVWFmsyhibrDlIMuVbRbfvW56sDqhFfPqd35/2Kj71G0ENQG4 RpAk3ebywMfCqiQt1eg== X-Proofpoint-GUID: 7RqiApa8dBMR3LqO6VubE__s_Dm5L4p8 X-Authority-Analysis: v=2.4 cv=DobDa2/+ c=1 sm=1 tr=0 ts=6aac3e03 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=-b3gUV1w4jwK8yCUv9wA:9 X-Proofpoint-ORIG-GUID: 7RqiApa8dBMR3LqO6VubE__s_Dm5L4p8 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX736EFe1lk0Tx mIn8dqECV6c0/mv6m9ulisGOEN2fMzaA1ISALaFe41I9aleROOjOq+jgFyjwCw2JSYm1P4lV7vZ +AUhBJwYGHQBdd0YNNYzRb8cPTgjjj8= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 impostorscore=0 spamscore=0 clxscore=1015 adultscore=0 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Define LC_PERCPU_OFFSET and LC_PERCPU_REGISTER offset defines and use them in percpu code. This shortens the percpu inline assemblies and makes them a bit more readable. Note that because of header dependencies it is not possible to use asm-offsets. However to avoid adding more dependencies to asm-offsets it seems to be preferable to use the current approach in any way. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/entry-percpu.h | 2 +- arch/s390/include/asm/lowcore.h | 3 ++ arch/s390/include/asm/percpu.h | 47 ++++++++++------------------ 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/arch/s390/include/asm/entry-percpu.h b/arch/s390/include/asm/e= ntry-percpu.h index 4ef47265cfce..89c9e44f6f83 100644 --- a/arch/s390/include/asm/entry-percpu.h +++ b/arch/s390/include/asm/entry-percpu.h @@ -49,7 +49,7 @@ static __always_inline bool percpu_code_check(struct pt_r= egs *regs) } if ((insn & 0xff0f) !=3D 0xe300) return true; - disp =3D offsetof(struct lowcore, percpu_offset); + disp =3D LC_PERCPU_OFFSET; if (machine_has_relocated_lowcore()) disp +=3D LOWCORE_ALT_ADDRESS; insn =3D (disp & 0xff000) >> 4 | (disp & 0x00fff) << 16 | 0x8; diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcor= e.h index f0364a9f8a19..f4517bbe405b 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h @@ -222,6 +222,9 @@ struct lowcore { __u8 pad_0x1900[0x2000-0x1900]; /* 0x1900 */ } __packed __aligned(8192); =20 +#define LC_PERCPU_OFFSET offsetof(struct lowcore, percpu_offset) +#define LC_PERCPU_REGISTER offsetof(struct lowcore, percpu_register) + static __always_inline struct lowcore *get_lowcore(void) { struct lowcore *lc; diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 3bc448c4c2dd..770fe4be65dc 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -14,17 +14,16 @@ =20 #define arch_raw_cpu_ptr(_ptr) \ ({ \ - unsigned long lc_percpu, tcp_ptr__; \ + unsigned long tcp_ptr__; \ \ tcp_ptr__ =3D (__force unsigned long)(_ptr); \ - lc_percpu =3D offsetof(struct lowcore, percpu_offset); \ asm_inline volatile( \ ALTERNATIVE("ag %[__ptr__],%[offzero](%%r0)\n", \ "ag %[__ptr__],%[offalt](%%r0)\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) \ : [__ptr__] "+d" (tcp_ptr__) \ - : [offzero] "i" (lc_percpu), \ - [offalt] "i" (lc_percpu + LOWCORE_ALT_ADDRESS), \ + : [offzero] "i" (LC_PERCPU_OFFSET), \ + [offalt] "i" (LC_PERCPU_OFFSET + LOWCORE_ALT_ADDRESS), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__; \ @@ -144,13 +143,10 @@ =20 #define arch_this_cpu_add(pcp, val, op1, op2, szcast) \ do { \ - unsigned long lc_pcpr, lc_pcpo; \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ val__ =3D (val); \ pcp_op_T__ old__, *ptr__; \ \ - lc_pcpr =3D offsetof(struct lowcore, percpu_register); \ - lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ if (__builtin_constant_p(val__) && \ ((szcast)val__ > -129) && ((szcast)val__ < 128)) { \ @@ -162,8 +158,8 @@ do { \ : [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "i" ((szcast)val__), \ - [disppcpr] "i" (lc_pcpr), \ - [disppcpo] "i" (lc_pcpo), \ + [disppcpr] "i" (LC_PERCPU_REGISTER), \ + [disppcpo] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } else { \ @@ -176,8 +172,8 @@ do { \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (lc_pcpr), \ - [disppcpo] "i" (lc_pcpo), \ + [disppcpr] "i" (LC_PERCPU_REGISTER), \ + [disppcpo] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } \ @@ -188,13 +184,10 @@ do { \ =20 #define arch_this_cpu_add_return(pcp, val, op) \ ({ \ - unsigned long lc_pcpr, lc_pcpo; \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ val__ =3D (val); \ pcp_op_T__ old__, *ptr__; \ \ - lc_pcpr =3D offsetof(struct lowcore, percpu_register); \ - lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ @@ -205,8 +198,8 @@ do { \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (lc_pcpr), \ - [disppcpo] "i" (lc_pcpo), \ + [disppcpr] "i" (LC_PERCPU_REGISTER), \ + [disppcpo] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ old__ + val__; \ @@ -217,13 +210,10 @@ do { \ =20 #define arch_this_cpu_to_op(pcp, val, op) \ do { \ - unsigned long lc_pcpr, lc_pcpo; \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ val__ =3D (val); \ pcp_op_T__ old__, *ptr__; \ \ - lc_pcpr =3D offsetof(struct lowcore, percpu_register); \ - lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ @@ -234,8 +224,8 @@ do { \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (lc_pcpr), \ - [disppcpo] "i" (lc_pcpo), \ + [disppcpr] "i" (LC_PERCPU_REGISTER), \ + [disppcpo] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } while (0) @@ -249,12 +239,10 @@ do { \ =20 #define arch_this_cpu_read(pcp, op) \ ({ \ - unsigned long lc_pcpr, lc_pcpo, res__; \ typedef typeof(pcp) pcp_op_T__; \ + unsigned long res__; \ pcp_op_T__ *ptr__; \ \ - lc_pcpr =3D offsetof(struct lowcore, percpu_register); \ - lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ @@ -263,8 +251,8 @@ do { \ MVIY_ALT("%[disppcpr]") \ : [res__] "=3D&d" (res__), [ptr__] "+&a" (ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [disppcpr] "i" (lc_pcpr), \ - [disppcpo] "i" (lc_pcpo), \ + : [disppcpr] "i" (LC_PERCPU_REGISTER), \ + [disppcpo] "i" (LC_PERCPU_OFFSET), \ "m" (*ptr__), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ @@ -278,12 +266,9 @@ do { \ =20 #define arch_this_cpu_write(pcp, val, op) \ do { \ - unsigned long lc_pcpr, lc_pcpo; \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ *ptr__, val__ =3D (val); \ \ - lc_pcpr =3D offsetof(struct lowcore, percpu_register); \ - lc_pcpo =3D offsetof(struct lowcore, percpu_offset); \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ @@ -293,8 +278,8 @@ do { \ : [ptr__] "+&a" (ptr__), "=3Dm" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (lc_pcpr), \ - [disppcpo] "i" (lc_pcpo), \ + [disppcpr] "i" (LC_PERCPU_REGISTER), \ + [disppcpo] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } while (0) --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 E4A2F4E36E5; Thu, 17 Sep 2026 19:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; cv=none; b=CXapN6FjmXpYXjLdC3pAIEN0g4SYVlVlwLVar1eT0jZ/SgQZCH6j8/QYf6LMb7hjaLIWuptbumiV7+Mv4IFe9LMJBl4VOYPG/RF0QmB1dgghLg3Sq+oJWW++WqsGHVzTIHtTDQV1KcgTbWTGd5fgQx6jVJtysfpmuhXOJ07tEZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; c=relaxed/simple; bh=eRKI4hMcS2Wg6ZS51a9HVHd1Gm00mnYcLUI0HEzLMX4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fyrl7bQwomudNwsdnVq9vxxXqryaDWSv/OxPXFFcOy4IqT8JZq5fr94cew/qruocyKCHXCKuV6/kaNLD9HhNDZ9Var9VrIAZN43w8gmGVDg29vImAZ5lNch7W/Eq/KBc5pRVDx0Xj2vgnnicYP/a7OIV8IaG2sqsFTQ6LbxGcrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=ptE01mX8; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ptE01mX8" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVXJA3155780; Thu, 17 Sep 2026 19:22:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=t7kkPPAQLSU9pnkgf BPz6kp1jSQR3q76w6P8dKTtqXQ=; b=ptE01mX8LsThg6vToattb2KVExpbt88uf mujX7LA/6a0d4VqlCgwugkB1DNDtbArtde/IokdpDP7TF7QP4kvnJgDq3t59x2aT 4tXB3Q/YqWu8HjuCdD5JXDKOd33Jb+SfPOI1dcLyahv2QxRWIcfdxusRMR4PnrXL qi6NJNLsO0eLLLY01LfqZarlqw1wSRmVs1yIcGHIQQMrXJo+xQq0eRjuIvdNQdLW OXqgLHs007FlTf1pCTQfI26P5VUnWxvyCjbpo/ajGcckfh1uNli6M8AiEWjOo88m yDUysCkxroMUa3FyDMLzUz8RkFe1BwvrpjC2xHHljVj1h0lB8EyLQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmxf5cdux-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH9QkA3494183; Thu, 17 Sep 2026 19:22:42 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5fjm08c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMccn38142434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:38 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B306220040; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EA352004D; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 06/12] s390/percpu: Rename inline assembly symbolic names Date: Thu, 17 Sep 2026 21:22:31 +0200 Message-ID: <20260917192237.638324-7-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lCq8UJc3IrJJXkLYxL4uN7esy56C0Hiq X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX1gm0t6taxM/u C2ROMKgH2wNYvt75JOboO1Kbrs3GSLTtKdT3xZC62bmdEXlCfVp7O5HBpovYJvmZwCS0885wDEF JKRn6GgMJ/xV6ZC+aymDYdDFDrFgC98= X-Authority-Analysis: v=2.4 cv=cvgOAF4i c=1 sm=1 tr=0 ts=6aac3e03 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=4HBEOGDHSRqv0w81nQsA:9 X-Proofpoint-ORIG-GUID: lCq8UJc3IrJJXkLYxL4uN7esy56C0Hiq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX13sM+hitwvKJ rk8+f/d/MnCbP1a8TeDTDyumIHKhjBnWaPgcyu7avK6BxvDq/UbcZ+tgXuV2PL9Qwznj4M/i365 6h+4mKpnqV4M2dWdGdzJ+d/g6Z398tG7hobw3tGWVZFIlwAIBFp+nASwrCc0IA0Q/SxynMbrvaL YzMmmzpmzDduUYXDnLYsFi4TLMnHZ7Rw45L9zPq6oZgG+UZd+xpGT731Mod25SpQQGrffliF4i1 VEGr449DQFBG4kKOM/HLnNIxs8R4bGq6QhnuEIma9umuhRIAYhdVSPZ6mZfocMyH8rDDwRpUZxg dsiQxq7WEB4bOC5EVD38+uX9tTY4rRu8iFeCFWCoGS3MhXhFMSpWpmlTiK9zvsMUJO5e8iXp0nk wMpXuYo8iBAVo5q4mkuqrG5G7+zIWhB0GuD+MNq7U124I1NLWXOv3EdmnlMRinBks3JG2C6LJRb WCtdQbtNmy+9SPNCkWQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Rename perpcu inline assembly symbolic names so they match (more) what is specified with input operands. A trivial change which is supposed to make the code a bit more readable. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 770fe4be65dc..0df47ec2e6c7 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -151,29 +151,29 @@ do { \ if (__builtin_constant_p(val__) && \ ((szcast)val__ > -129) && ((szcast)val__ < 128)) { \ asm volatile( \ - MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ - AG_ALT("%[disppcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[lcreg]","%[ptr__]") \ + AG_ALT("%[lcoff]", "%[ptr__]") \ op2 " 0(%[ptr__]),%[val__]\n" \ - MVIY_ALT("%[disppcpr]") \ + MVIY_ALT("%[lcreg]") \ : [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "i" ((szcast)val__), \ - [disppcpr] "i" (LC_PERCPU_REGISTER), \ - [disppcpo] "i" (LC_PERCPU_OFFSET), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } else { \ asm volatile( \ - MVIY_PERCPU("%[disppcpr]", "%[ptr__]") \ - AG_ALT("%[disppcpo]", "%[ptr__]") \ + MVIY_PERCPU("%[lcreg]", "%[ptr__]") \ + AG_ALT("%[lcoff]", "%[ptr__]") \ op1 " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]") \ + MVIY_ALT("%[lcreg]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (LC_PERCPU_REGISTER), \ - [disppcpo] "i" (LC_PERCPU_OFFSET), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } \ @@ -190,16 +190,16 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ - AG_ALT("%[disppcpo]","%[ptr__]") \ + MVIY_PERCPU("%[lcreg]","%[ptr__]") \ + AG_ALT("%[lcoff]","%[ptr__]") \ op " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]") \ + MVIY_ALT("%[lcreg]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (LC_PERCPU_REGISTER), \ - [disppcpo] "i" (LC_PERCPU_OFFSET), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ old__ + val__; \ @@ -216,16 +216,16 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ - AG_ALT("%[disppcpo]","%[ptr__]") \ + MVIY_PERCPU("%[lcreg]","%[ptr__]") \ + AG_ALT("%[lcoff]","%[ptr__]") \ op " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]") \ + MVIY_ALT("%[lcreg]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (LC_PERCPU_REGISTER), \ - [disppcpo] "i" (LC_PERCPU_OFFSET), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } while (0) @@ -245,14 +245,14 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ - AG_ALT("%[disppcpo]","%[ptr__]") \ + MVIY_PERCPU("%[lcreg]","%[ptr__]") \ + AG_ALT("%[lcoff]","%[ptr__]") \ op " %[res__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]") \ + MVIY_ALT("%[lcreg]") \ : [res__] "=3D&d" (res__), [ptr__] "+&a" (ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [disppcpr] "i" (LC_PERCPU_REGISTER), \ - [disppcpo] "i" (LC_PERCPU_OFFSET), \ + : [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (*ptr__), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ @@ -271,15 +271,15 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[disppcpr]","%[ptr__]") \ - AG_ALT("%[disppcpo]","%[ptr__]") \ + MVIY_PERCPU("%[lcreg]","%[ptr__]") \ + AG_ALT("%[lcoff]","%[ptr__]") \ op " %[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[disppcpr]") \ + MVIY_ALT("%[lcreg]") \ : [ptr__] "+&a" (ptr__), "=3Dm" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ - [disppcpr] "i" (LC_PERCPU_REGISTER), \ - [disppcpo] "i" (LC_PERCPU_OFFSET), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } while (0) --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 5CDCE4E36F3; Thu, 17 Sep 2026 19:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; cv=none; b=OinNxC69r6PBlhGHQpa44MPknIz0RG8/XOKqfVVN9YDvn0lKmQdX63cnjIzNzV+QFbeZhdRWA3Ja/THNk+vs55C1lKD8k4BCvGiOe8NP7xSmNnN7Qpj3YZUmAneD2wBQx1a7bqcLc9DKyrTRTpBUX4Ka3yQaPMdgyw3fW7Rsuvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; c=relaxed/simple; bh=t9TxXk816GExzNpVYSmqUlYBgG7VeW2N+Tjgtmdde0Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qHuGPofu5ucFnvGgFsHCpEk2NCq1XtR6rRVEYx07rbxLikZvmAOCYPx1pKk2tx4aKeG8/wm4cg4fzxVSo9ovYBwMtTaz/vMU6X4DVAPoMW0Jal1x0AnKfV9DkMaYFzTt3Uh6XYfmBh57/C9+wRvREoVwvlfLZarCoVM/WhZFRuM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=kYqzGkID; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="kYqzGkID" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVcwu1980413; Thu, 17 Sep 2026 19:22:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=I+wMOHFy9NdvIWSnv NOdy1HIVwDhgSU6cyZy/p8fcK0=; b=kYqzGkIDmKOzrwugfeKs9FnwsKQa2rtP8 dypjanoLXwF18xRRxB2UKrw7U1YRjvD7eENXrFOugkvjRUd/N4HKN6hNuWLjxF7U KzgZC/DDHl5ua5NO63QJp3EyL2WG8V4LgRAtHSRF8k1AACNUXC+RMGKrd3JXA+0z +noYba/6n78iorg/VYexkG7/XtSGYh0HtmoYuLFPW9fhOuuQHT11KPs3avUcWJ5Y pT/tCr4RSDgg3yY8os585/K6PwBdzPco1x9bucxJg1h4VVP5Ynug6EqpZuW3v4JW aMdt3EOa3U8w+2UB4Li5jNGHc/kQkw7XBjn2Qozodmxrlf3DWD0hw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmw5ebxs5-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH8xZF3510057; Thu, 17 Sep 2026 19:22:42 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5xa3w6v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:42 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMcK647710642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:39 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DBDBF20049; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B78E72004B; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 07/12] s390/percpu: Use __PCPU_BEGIN() and __PCPU_END() for inline assemblies Date: Thu, 17 Sep 2026 21:22:32 +0200 Message-ID: <20260917192237.638324-8-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX1bbLuoX+RnbN Pjgw34L+QwfQbGki6BLLAqXq18/QBlrhQvnjRujUTxGdQmCvaSYr65fUEivZ5c3vDAMSLCpcgvz fsBkUf18xU6DjO5p+uxBZA3QFpuIYIhmzFcB1eqDUxGHI3My3rapwYkoekl23EZVXIAdY3a7v5+ mSIq5Drd6D1kvA2EV57Z7f5m5TxqQ3hFRbOzvo4JJc51h0UR60sqqLhDjWDMeKijE412Runu4bc h1RTlaT+v6+iB5OR3n+1kSkzecvvqL+QJHqGNvUVjTWH3hPbBgQt6oKFKsgeJvnYVpnlOTRhcS2 FVRJxLMBawpt8TdbA8rcBjPgLelYpx1SLr/xniSSoReH/BBS2rWtIq4Zivr4jS0Rs0K1xmjdlSH +QefJ6KEarsbjJh5aK5lA2kMu5Zu4Cp7s7z5aVZfbLa+uHfcueiUPe1Zd8QSqG9AEouywWOW4gU GNpE4Yi+ZBAZQ54PzEQ== X-Authority-Analysis: v=2.4 cv=E/NYNqdl c=1 sm=1 tr=0 ts=6aac3e03 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=7qROLAO0VneCJbZu0JoA:9 X-Proofpoint-ORIG-GUID: fnSa-aIYxZQm0fSJXsjITVIlcfzmiC0C X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX46Vhj4syEfgQ XLyIIPcSCxDoxv6QwC7Vxk/e2hJrfM65ITd9RySZ64Hyrrc14BVXl54luL0sT1Tm4zNmQ/oZEnr aLdDnJpImy8sg52oKPZXgqWHpuM1lSI= X-Proofpoint-GUID: fnSa-aIYxZQm0fSJXsjITVIlcfzmiC0C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 clxscore=1015 bulkscore=0 malwarescore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Replace the use of MVIY_PERCPU(), AG_ALT(), and MVIY_ALT() within all percpu inline assemblies with __PCPU_BEGIN() and __PCPU_END(), since the begin and end of each inline assembly is the same. Also use consistent names: e.g. __PCPU_MVIY() and __PCPU_AG() instead of the previous MVIY_PERCPU() and AG_ALT(). Furthermore extract DEFINE_GR_NUM and UNDEF_GR_NUM which are used to convert register strings to register numbers. All of this should make the code more readable. No functional change. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 83 +++++++++++++++++----------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 0df47ec2e6c7..78c3aaa138f7 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -92,42 +92,49 @@ * * Inline assemblies making use of this typically have a code sequence lik= e: * - * MVIY_PERCPU(...) <- start of percpu code section - * AG_ALT(...) <- add percpu offset; must be the second instruction - * atomic_op <- atomic op - * MVIY_ALT(...) <- end of percpu code section + * __PCPU_BEGIN(...) <- start of percpu code section + * atomic_op <- atomic op + * __PCPU_END(...) <- end of percpu code section */ =20 #define LC_ALT_ADDR __stringify(LOWCORE_ALT_ADDRESS) =20 -#define MVIY_PERCPU(disp, reg) \ - ".macro GEN_MVIY disp, reg\n" \ - ".set .Lreg,255\n" \ - ".irp rs,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n" \ - " .ifc \\reg,%%r\\rs\n" \ - " .set .Lreg,\\rs\n" \ +#define DEFINE_GR_NUM \ + ".macro _GR_NUM opd, gr\n" \ + ".set \\opd,255\n" \ + ".irp rs,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n" \ + " .ifc \\gr,%%r\\rs\n" \ + " \\opd =3D \\rs\n" \ " .endif\n" \ ".endr\n" \ - ".if .Lreg =3D=3D 255\n" \ + ".if \\opd =3D=3D 255\n" \ " .error \"Illegal register number\"\n" \ ".endif\n" \ - "mviy \\disp(%%r0),.Lreg\n" \ - ".endm\n" \ - ALTERNATIVE("GEN_MVIY " disp " , " reg "\n", \ - "GEN_MVIY " disp "+" LC_ALT_ADDR " , " reg "\n", \ - ALT_FEATURE(MFEATURE_LOWCORE)) \ - ".purgem GEN_MVIY\n" + ".endm\n" =20 -#define MVIY_ALT(disp) \ - ALTERNATIVE(" mviy " disp "(%%r0),0\n", \ - " mviy " disp "+" LC_ALT_ADDR "(%%r0),0\n", \ +#define UNDEF_GR_NUM \ + ".purgem _GR_NUM\n" + +#define __PCPU_MVIY(lcreg, imm) \ + ALTERNATIVE(" mviy " lcreg "(%%r0)," imm "\n", \ + " mviy " lcreg "+" LC_ALT_ADDR "(%%r0)," imm "\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) =20 -#define AG_ALT(disp, reg) \ - ALTERNATIVE(" ag " reg ", " disp "(%%r0)\n", \ - " ag " reg ", " disp "+" LC_ALT_ADDR "(%%r0)\n", \ +#define __PCPU_AG(reg, lcoff) \ + ALTERNATIVE(" ag " reg ", " lcoff "(%%r0)\n", \ + " ag " reg ", " lcoff "+" LC_ALT_ADDR "(%%r0)\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) =20 +#define __PCPU_BEGIN(lcreg, lcoff, reg) \ + DEFINE_GR_NUM \ + "_GR_NUM .Lreg, " reg "\n" \ + UNDEF_GR_NUM \ + __PCPU_MVIY(lcreg, ".Lreg") \ + __PCPU_AG(reg, lcoff) + +#define __PCPU_END(lcreg) \ + __PCPU_MVIY(lcreg, "0") + #ifndef MARCH_HAS_Z196_FEATURES =20 #define this_cpu_add_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +) @@ -151,10 +158,9 @@ do { \ if (__builtin_constant_p(val__) && \ ((szcast)val__ > -129) && ((szcast)val__ < 128)) { \ asm volatile( \ - MVIY_PERCPU("%[lcreg]","%[ptr__]") \ - AG_ALT("%[lcoff]", "%[ptr__]") \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ op2 " 0(%[ptr__]),%[val__]\n" \ - MVIY_ALT("%[lcreg]") \ + __PCPU_END("%[lcreg]") \ : [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "i" ((szcast)val__), \ @@ -164,10 +170,9 @@ do { \ : "cc"); \ } else { \ asm volatile( \ - MVIY_PERCPU("%[lcreg]", "%[ptr__]") \ - AG_ALT("%[lcoff]", "%[ptr__]") \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ op1 " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[lcreg]") \ + __PCPU_END("%[lcreg]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ @@ -190,10 +195,9 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[lcreg]","%[ptr__]") \ - AG_ALT("%[lcoff]","%[ptr__]") \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ op " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[lcreg]") \ + __PCPU_END("%[lcreg]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ @@ -216,10 +220,9 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[lcreg]","%[ptr__]") \ - AG_ALT("%[lcoff]","%[ptr__]") \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ op " %[old__],%[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[lcreg]") \ + __PCPU_END("%[lcreg]") \ : [old__] "=3D&d" (old__), \ [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ @@ -245,10 +248,9 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[lcreg]","%[ptr__]") \ - AG_ALT("%[lcoff]","%[ptr__]") \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ op " %[res__],0(%[ptr__])\n" \ - MVIY_ALT("%[lcreg]") \ + __PCPU_END("%[lcreg]") \ : [res__] "=3D&d" (res__), [ptr__] "+&a" (ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [lcreg] "i" (LC_PERCPU_REGISTER), \ @@ -271,10 +273,9 @@ do { \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - MVIY_PERCPU("%[lcreg]","%[ptr__]") \ - AG_ALT("%[lcoff]","%[ptr__]") \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ op " %[val__],0(%[ptr__])\n" \ - MVIY_ALT("%[lcreg]") \ + __PCPU_END("%[lcreg]") \ : [ptr__] "+&a" (ptr__), "=3Dm" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ : [val__] "d" (val__), \ --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 4D1284E06E5; Thu, 17 Sep 2026 19:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; cv=none; b=ueoPGY/MzQTvqBgAwhMOj42c5YYQlpR1lDRLFekq6Ysilt39nlgmY9VFnoFfuL+AsyIFT/OEU2qk3/CRYFt0G6Ov8iuz7hFhsVCSn5DMz+G8pYdB4sTN9HYDjOWwakhaDdeW2UlnqvnVXJa/LH22jXGclDIb9Zb8gSvpzSJiP74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672980; c=relaxed/simple; bh=o9hPxOU9kHloIARfub1Nrx5KK2t//Hd+uRzDHhtzPxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=msVgjurc3Ud6cvpu5sETCJJ3pT5U8xvPhEH2sWwGbMdnjQZgTdiAQz6KLFM5Wf8Cq/TK2lQSuRtfLiUTurSJQyCVoJCsJdR4Qgk2UUXGze1bBMLb3AGWDusMW70U7ElZtq6SbzYYYa019YqpdPH9UJpRPFmiCi/V5YIBZ0aP/Wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=ApGRfPH+; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ApGRfPH+" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVc0V2998394; Thu, 17 Sep 2026 19:22:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=Vfh+Ku1qHAtSrYARs L7UNTW+AGUl1eoke7UXxnSuWjU=; b=ApGRfPH+gTXBRZWoL3qhbYb86SjWM22Bv D0mlhAgiPqzgIxUcREuGQa9m45GwuXcOmxrRlUsS45wB/es04vGEuddT0B4OcDGO 1mXdKt0S+lP86JWhWoLWv+3+qcXZwNeEgS/+xkogvgLFyoZmHwYZXxRilhHGqory dW5+D2cpSG3dvtdm0N8Qu2SKp/W0SGFNGmZg72sGcVGxBeYI9+RFFqsPCQ6aTY45 vObtKniW+8v3IvfV9GbGaYIROuDm6b1oLGTVTbFnZtpwj8N1qyxwlYoTalShEsi6 3G6puTDnM/ptYMM1m4gJcrBmEB2JPydk7aq6kU01fvgfZMrMpx73A== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmv5j458w-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH90Uv3474533; Thu, 17 Sep 2026 19:22:43 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gra3fb26q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMd3D13173218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:39 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FC8820040; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFDC12004D; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:38 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 08/12] s390/percpu: Use percpu code section for this_cpu_cmpxchg128() Date: Thu, 17 Sep 2026 21:22:33 +0200 Message-ID: <20260917192237.638324-9-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX0nt+bWlPJbuJ aYvYi7VPC8u3HHyryDd/rwiMwE/gXZE7jhi7DqsIIgVC9xevin/bPZh+2bNh/pMGjWjzwuGkOHl oobC0ZJYzfP5+QzinlpbUXi0Z0UBxNnNmXWeafiRug1yyYpnBbzc9Xp+MtDk8xka4cjeTnYhDmM bU4SYVRpbJuOrqB2ScCsYQ0zVVJHCKt0ImTUvAVCAuXTkq5EzbcPBfr/FpTO1SGWaLKmaDM/t59 UZxWigS+S4fRKn2S1amNzNkl+exT1gCdTf2N5lkXy22aCJKcMLeubZCWSQ1ApGGdavXMScpN+VO aQCJ7+syiVdrky7iepYlHokq9QS7RqblmosVi5kNlArGSmb3u2g+nR90sRv/90sAkCVZ7HK+jk7 VPD17ak8v8oRKvDmBwtc8rLsAKKugkYjhOP/kmwTNaeAdGjg3xXdu79b+MkP1lm9Md+Bx3GiNNe EodTK3BW7m5X8YYoIQA== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX7LmyaVWNu2ei 39BFGoea9fQDdVxxtajbqTvjH4RE2naaMKwRpbQriIj/0FHXuw8+u+uKMx6aolXCiZ4/JB0VS7v VASzRwkWPHtTAL1RqXX8qns5XUoRhJg= X-Authority-Analysis: v=2.4 cv=Zsx4uN7G c=1 sm=1 tr=0 ts=6aac3e03 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=sJK1A0fQ-n6IDXIElG0A:9 X-Proofpoint-ORIG-GUID: AHmXrSgG0nezzWDFeu38CZGapwlWUFRM X-Proofpoint-GUID: AHmXrSgG0nezzWDFeu38CZGapwlWUFRM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Convert this_cpu_cmpxchg128() to make use of percpu code section functionality. This is just for the sake of completeness, since currently there is no in-kernel user of this_cpu_cmpxchg128(). Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 78c3aaa138f7..0eae65937c0d 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -312,15 +312,23 @@ do { \ #define this_cpu_cmpxchg128(pcp, oval, nval) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ - u128 old__, new__, ret__; \ + u128 old__ =3D (oval), new__ =3D (nval); \ pcp_op_T__ *ptr__; \ - old__ =3D oval; \ - new__ =3D nval; \ - preempt_disable_notrace(); \ - ptr__ =3D raw_cpu_ptr(&(pcp)); \ - ret__ =3D cmpxchg128((void *)ptr__, old__, new__); \ - preempt_enable_notrace(); \ - ret__; \ + \ + ptr__ =3D PERCPU_PTR(&(pcp)); \ + asm_inline volatile( \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ + " cdsg %[old__],%[new__],0(%[ptr__])\n" \ + __PCPU_END("%[lcreg]") \ + : [old__] "+&d" (old__), [ptr__] "+&a" (ptr__), \ + "+m" (*ptr__), \ + "=3Dm" (((struct lowcore *)0)->percpu_register) \ + : [new__] "d" (new__), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ + "m" (((struct lowcore *)0)->percpu_offset) \ + : "memory", "cc"); \ + old__; \ }) =20 #define arch_this_cpu_xchg(pcp, nval) \ --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 E92FB3DFC80; Thu, 17 Sep 2026 19:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672976; cv=none; b=ubBdR2WfD2NpZRWMuGDSWfF7GAzTjrG3aZrWN90g768LG8CK51y6oSGwhc7S8wum7pygI2VTV/wkr+XVUXBJC11Te1QW1/sYv4XEjFpGQ3MigZ4bWnKkwdjdO9L651IANeaAhu00Y4LKURwbJVsiUG8Mq83KSjM1KspX5KQ+rlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672976; c=relaxed/simple; bh=hsSTMnOkgCVsq5THFPEcnlXpX+RhuzOtkcCqcE7Vxus=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XFKpfYWaoFuQqUC+Fl646rCluwMKIGz3OSQpN//sdm5/21OY17Cx/WjzQGBZUwZiKTRtYeLGDlghWCEz01g3VB3nz7gVQrgIiBMTb5PQiey1BYadskx1w/hWg/BwcQmNqUyRH6Uz1LoriZToZFzzMBU6bjj5oAv/wLKjZC/yEnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=n/L4MLtT; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="n/L4MLtT" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVdtn3182136; Thu, 17 Sep 2026 19:22:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=+aIXhE5xATl253AJX z4Do+ZDyBBQmjcdPIpnowKqkeI=; b=n/L4MLtT2KjsVN1O3i3FDSrtlpROp5lm4 SwiilECJJ/o37omv0Aon2cIQgbR1QTYbQEUyaNjbUm1i55oQVcrM1EjaBe4rSQTK sM0Pj24NSl4+MUmodOUV/s/Vr6zGK7I5Wme+/Z8AMlcqmao3u+mN+CdEn2Db06Lw RTwO0d/1spgqAyVuYlOhaE0VVUmpW5TJ3H+fDYsHqcxdg+pkm9ZS3cRoiZ6L8Lm+ ZUSR688Ghwfmcwxt6pAVwWuUbuqx/NM+CSTT6+41XZ7slKXBQF8EPjRa6qAsF4UH eBKf3BJZsaKk8QGfBoZFgAGM4W4wbQ06T/lwIh9MI+1TzsvNZopJw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmxcvbsx6-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH9PIc3494176; Thu, 17 Sep 2026 19:22:43 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5fjm08e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMdRP31982272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:39 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36EDD20049; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1342C2004B; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 09/12] s390/percpu: Use percpu code section for this_cpu_xchg() Date: Thu, 17 Sep 2026 21:22:34 +0200 Message-ID: <20260917192237.638324-10-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX3QHPknr7cEJz 6L0LZ5YmRMl+tEaYyXR6zJKIWSoutX35wzN5ZGKIK2OWNu3Z8f3OHgGERq6QCzg016nMNqQp7j1 veIP51iXHD+eOZHF2E5SV8W/FWCpjyw= X-Proofpoint-ORIG-GUID: TCcKDj5cmfRI2xw_Y22lf4eCEGg5O8rp X-Proofpoint-GUID: TCcKDj5cmfRI2xw_Y22lf4eCEGg5O8rp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX2ymYAGTR0oSl lh3bbLP6d1aNQqpUXO+oNmptI/aPPfvjXR8DLiM1Xga6S0TlO4yNVvWYeSbxGK7d4PM4uLGbTS0 o6u2Yz//LWGzsGUj37hEnC53gge3I0z0fjcSsTOSRsCcBF1rZt95h5OGO95qjQpVWRizaPnbi2T 6IURG503oqZXbzA+vjq6gf3tSJSWPJKYzwtMc6qyyrd/F9w6L5CX9F/XtqtXPDW30H0WMLHQYyC 7XREnMB28ofANUJMlpwMzWnvOLbiy1yaOyMhvPEoKndh15rJX1IBdauUv8iYQB39OmXBRF60hY6 AjQhfa2JjC0kX2roL0WbfVYg5QJGsNDShL96YCQjCHe2yBGZ4GGA2TyjxFHgBMUA6gQUwNdB3Og A2wSB9t1jcfEjDxrNwk3R/6LiQGZm+Gn3TDoMfUu4Jrw8X72sU79J4Vgj90iNzAnbcfxQomBhnn MZkLB3Ez9dEsPjc887w== X-Authority-Analysis: v=2.4 cv=F+7C5ahN c=1 sm=1 tr=0 ts=6aac3e03 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=CR6qe3_hcmaCbRXVjxMA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Convert this_cpu_xchg() to make use of percpu code section functionality in order to get rid of preempt_disable() and preempt_enable() calls. Consider only four and eight byte usages, since there are compare and swap instructions for one and two bytes available. For one and two byte use the previous simple implementation. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 0eae65937c0d..237bf8c80843 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -331,7 +331,7 @@ do { \ old__; \ }) =20 -#define arch_this_cpu_xchg(pcp, nval) \ +#define arch_this_cpu_xchg_simple(pcp, nval) \ ({ \ typeof(pcp) *ptr__; \ typeof(pcp) ret__; \ @@ -342,10 +342,34 @@ do { \ ret__; \ }) =20 -#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg(pcp, nval) -#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg(pcp, nval) -#define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval) -#define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval) +#define arch_this_cpu_xchg(pcp, nval, ldop, csop) \ +({ \ + typedef typeof(pcp) pcp_op_T__; \ + pcp_op_T__ old__, new__ =3D (nval); \ + pcp_op_T__ *ptr__; \ + \ + ptr__ =3D PERCPU_PTR(&(pcp)); \ + asm_inline volatile( \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ + " " ldop " %[old__],0(%[ptr__])\n" \ + "0: " csop " %[old__],%[new__],0(%[ptr__])\n"\ + " jnz 0b\n" \ + __PCPU_END("%[lcreg]") \ + : [old__] "=3D&d" (old__), \ + [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + "=3Dm" (((struct lowcore *)0)->percpu_register) \ + : [new__] "d" (new__), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ + "m" (((struct lowcore *)0)->percpu_offset) \ + : "memory", "cc"); \ + old__; \ +}) + +#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) +#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) +#define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval, "l", "cs= ") +#define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval, "lg", "cs= g") =20 #include =20 --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 5F7B54E1C76; Thu, 17 Sep 2026 19:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672978; cv=none; b=ZeSFLo6vywi8Hafgz+S7gWvnPHmW3+0f7H3EFnJuiXq/F2pBbCAGjjkJV5FxzcWonqiCvTU1NyRuI/Mcv/u8kUYYosQox46eewszmd7y+H6V6iUHNuRGmqN/HEv4+/3u6a2QTjajHne9LfB6F8CTLHWOhg6tahS9UfjZwBWRzu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672978; c=relaxed/simple; bh=xrGN8LeijjnGj5GORr4MnMawzfd6noZ622OIpsikzOE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oWwhT/uKFpiif4LBqzi1krfBtwQ1Pommg1ULNUsY2UkPLXmGDkyQszsyafGA/O2mhxT2GVDvM1re5ANCFhMjE3mI5NR/6m+W0K9LkxeNyO84Kp7M998zhXbwTVJfmhhRZmZJzSbPOFJXNCE5K4C2Bppd7vzJVibQWOY9SKnEq1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=hWfyszTJ; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="hWfyszTJ" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVQ7P3143228; Thu, 17 Sep 2026 19:22:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=RmfRlMunYDrgwFNZI BvZC4D83yPI7wHTx0KNdHPuDbA=; b=hWfyszTJgvZkBwYxw7orB2SMD1jt6uPas ewYR+WyP4ose1xd9Fd/frJa/FvwTk2gS1krD69kFcP/sqEHxUoITwi+uibTj6/vv iNtRfzYfSV1TM7TDBlGnWRsvcssKCykfi0PpPJs05cFwJuHgo0bQRUi/0L8mrTfM VpsCk9+xl7rwLxIW1qqadoFjx/is9E2RA6trdmONhlC+e5kqp3RruM8VqS/z9EPl Y3vdW6l29MjXCyn8M0PearBq7Hr1QQzFqN1k9AvOmeazJds76NpfS6N8Bo3sdeJD ZqYf1fYVa7Ztdkt1IDjM2s45ADUuWBXZEhama58Uj+1gf6a3T7Hcg== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmx844d3j-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:44 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH93oD3510145; Thu, 17 Sep 2026 19:22:43 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5xa3w6y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMd3V31982274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:39 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5EA3420040; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3ACC82004D; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 10/12] s390/percpu: Use percpu code section for this_cpu_cmpxchg() Date: Thu, 17 Sep 2026 21:22:35 +0200 Message-ID: <20260917192237.638324-11-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX/eTf3YqBsNZ7 r1TYqhX5BZFX8j0eFiA6xfJf6ofhvYDf+Av0DQFYeGtyQO0X9xITaqMr40gSIAfjH/478UzJOqy W3JjAz/SUehQkXhA6oaou/Ub5WAD87xr0c2fY47+Fm2s3P3ElzE/mDiRamCFnplD/pDBBu8Yy4E ubOGyYVyKBDURTYLNS+hJfioxAwmFTG2pWzXSx5k2SfHdcC2Gz+xTVOrdFszYhFyBroV+YzZRyx 81rD1y+fapKPSzvOZZrE078AdAbFrMfEGM2RmKswIzXR+nm+0cHgYJViAmKHA7OsqEEmvdE6rVY zx15t8/YfWyuwGjKMR7XcIlbxBDN96h+hRRXGaVS443Hr4h5NGcQr7uLkBiiCYcaJzn1KZp/ZBC 4nj+PyW792R8Y1oLW/NWfmGYg9WMq/7MIZAXdHGraG3DkcHwLprza3tcbwWKpyc4TktGsMNsQrl M9dGCVo2dm0LfNcyc5w== X-Proofpoint-ORIG-GUID: OGhhr72x05ULRZljzmO0-9yE9jjXbEZp X-Proofpoint-GUID: OGhhr72x05ULRZljzmO0-9yE9jjXbEZp X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX4XyAM7d/6XhG zLGJHDJ5jn8s8oMgYdPCMNyFyyX9447vDBLZosMirFNv+zkn8NaK5w5SC1IHW61x7zCUf+9ViT9 pNNiKWDmKQEsBEZDeagQe1WFJfXroGs= X-Authority-Analysis: v=2.4 cv=cY9HPXDM c=1 sm=1 tr=0 ts=6aac3e04 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=xum8VS0YelhL0tLUZrYA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 bulkscore=0 clxscore=1015 suspectscore=0 impostorscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Convert this_cpu_cmpxchg() to make use of percpu code section functionality in order to get rid of preempt_disable() and preempt_enable() calls. Consider only four and eight byte usages, since there are no compare and swap instructions for one and two bytes available. For one and two bytes use the previous simple implementation. Signed-off-by: Heiko Carstens --- arch/s390/include/asm/percpu.h | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 237bf8c80843..46368131b932 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -290,7 +290,7 @@ do { \ #define this_cpu_write_4(pcp, val) arch_this_cpu_write(pcp, val, "st") #define this_cpu_write_8(pcp, val) arch_this_cpu_write(pcp, val, "stg") =20 -#define arch_this_cpu_cmpxchg(pcp, oval, nval) \ +#define arch_this_cpu_cmpxchg_simple(pcp, oval, nval) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ ret__; \ @@ -302,10 +302,32 @@ do { \ ret__; \ }) =20 -#define this_cpu_cmpxchg_1(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval) -#define this_cpu_cmpxchg_2(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval) -#define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval) -#define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval) +#define arch_this_cpu_cmpxchg(pcp, oval, nval, op) \ +({ \ + typedef typeof(pcp) pcp_op_T__; \ + pcp_op_T__ old__ =3D (oval), new__ =3D (nval); \ + pcp_op_T__ *ptr__; \ + \ + ptr__ =3D PERCPU_PTR(&(pcp)); \ + asm_inline volatile( \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ + op " %[old__],%[new__],0(%[ptr__])\n" \ + __PCPU_END("%[lcreg]") \ + : [old__] "+&d" (old__), \ + [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + "=3Dm" (((struct lowcore *)0)->percpu_register) \ + : [new__] "d" (new__), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ + [lcoff] "i" (LC_PERCPU_OFFSET), \ + "m" (((struct lowcore *)0)->percpu_offset) \ + : "memory", "cc"); \ + old__; \ +}) + +#define this_cpu_cmpxchg_1(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) +#define this_cpu_cmpxchg_2(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) +#define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval, "cs") +#define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval, "csg") =20 #define this_cpu_cmpxchg64(pcp, o, n) this_cpu_cmpxchg_8(pcp, o, n) =20 --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 8A7444E0B8F; Thu, 17 Sep 2026 19:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672978; cv=none; b=F54rWKl9yfA/Xnev07PalhxoC9VZiJkLUz2Iir6PX9bF1Q5bWRXIFNx+dMidm76V/ZiMsL4SYhehon18D8QyVJl1SU8Zb4yLZeTRTI2QqDffJIyQ1b/qr5gcAgU4LJgSG5IU5DvKlODHJPv4DyYAVtmLGWHO8buw3YXW23xZSso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672978; c=relaxed/simple; bh=l5cSCb4nn5yHpguCzR5EHEKzQduv+MVNUnXV52VBGTE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YcKIWF8R2FOQcMik9XDfwBHZXcApmCIpgISrugctw3lfwvqiokjplXxb504p23h6rLmyN8oI/zvdAii6cRyUfTMYlN0/Qy7RIiS+HaSRqKJWl6UBIDw48ZlJFaFL+cAO4fVXPeBXWDQMFx/0vvAuIWxxrd3fQYo9ZU9pIObI2jQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=W/c8V+Dx; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="W/c8V+Dx" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVZcd3182086; Thu, 17 Sep 2026 19:22:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=RXLRT6WBMUNAq53iP hiF3ryWPK+yl4SQ+KIVUWG1A4s=; b=W/c8V+DxupugGKXX+jA2Bg2BiCLiW3LKW KILzUHyc0LF1tZ5z/A3YlfnUfO2/4mg+zjET+eyKtiOswSEte+xowjfN0IfA2/Hy PWndo0up0+e9GSjEV//TCYNxqiITM6GC1JLJ5L70Fynvi/2hEKCZHLlRwKPG1jTc 7R8UMMwl4DjL3kv8s+g8fFCG2yskSCpfYH+5utQEqH2w6CgObRISY4jozQXXG6Mg TrO7oZKdznAZj9a3rlBpF7IBuCJVMomWHW4NRT9XY/g3BxZ+stRx/xojDuFEbbk3 +xjvuJux/spzD7+kZha3PsS8d2z0Zl4MtB/vYdJiB0eZ3SuI/bg1g== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmxcvbsx8-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:44 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH9CwU3474937; Thu, 17 Sep 2026 19:22:43 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gra3fb26s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMdmE10158424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:39 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8FF6E20040; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 629942004B; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 11/12] s390: Add CC_HAS_ASM_M_FORMAT_FLAG config option Date: Thu, 17 Sep 2026 21:22:36 +0200 Message-ID: <20260917192237.638324-12-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX/n86JsQX/nLg T4++vqeA4r3dzP2MAoGYII95waFFyOTEcckYVHymYlojpwE76MJ5qozb1VIpGY+K6M5Rjb8zmoY FGXaIOqoFPIQMYW5qAVxDg+Fayi6dWY= X-Proofpoint-ORIG-GUID: XXRLb-Neclnh0-qQAeM2qL-wPo23XNoa X-Proofpoint-GUID: XXRLb-Neclnh0-qQAeM2qL-wPo23XNoa X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX7JhqGzbH3mjT l8PHrZ/1npt9OEb/ipouNM0cziTHHcYc1SUJ1+ktW0of6cgcKPPiYKoefrf57UtS6wiczjnls6C /fm6NwogKH4/aLZwCyWSyqtRBS31oMDmt6FnBeN5jN6zY3uYbKeFNDfadO+VC0LW6mq3Fn3+YD3 wFuO8PstF9lOiD2gdNS6pIZ9dDZ+O842pHH68qbJcXHhflevoCGzA9wgPcXf7w63y0NgHoCBqXH kyrhq8xaEQilt3dRMsVhc+JmlZBjiPhttWKFVl4cWu2eSg1tWtXlmpza6fN+3XnyjvkUMKQYDmW DePxRfmkO6+Xl4KWHDpGa68vYDkQiKFTz9XNQwQtSh/nFFX3oCLlRAHs3DzG5PRCXfYdoedBXKy oE+AFlLzqR3sXonv1vTK9MzYVlQENx2E6IUWGeq7yk5fX8shezpW86OsxWFVV3bujrmCu1NvZMS BSAMo+DEy+0wZAbbrlg== X-Authority-Analysis: v=2.4 cv=F+7C5ahN c=1 sm=1 tr=0 ts=6aac3e04 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=FPxSlPHqShoRM3yPCfIA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" Add CONFIG_CC_HAS_ASM_M_FORMAT_FLAG as an indicator if the compiler supports the 'M' operand modifier in inline assemblies. The 'M' modifier allows to access the odd register of a TImode operand. Clang support for this modifier was added recently to llvm-project [1]. The config option can be used to write conditional code depending on compiler features. [1] 28c23411e15f ("[SystemZ] Support the 'M' code for the odd register in i= nline-asm (#215481)") Signed-off-by: Heiko Carstens --- arch/s390/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 4b51bc6e8948..f1fbbf6eb50a 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -66,6 +66,12 @@ config CC_HAS_ASM_AOR_FORMAT_FLAGS Clang versions before 19.1.0 do not support A, O, and R inline assembly format flags. =20 +config CC_HAS_ASM_M_FORMAT_FLAG + def_bool !(CC_IS_CLANG && CLANG_VERSION < 240100) + help + Clang versions before 24.1.0 do not support the + M inline assembly format flags. + config CC_HAS_ASM_IMMEDIATE_STRINGS def_bool !(CC_IS_GCC && GCC_VERSION < 90000) help --=20 2.53.0 From nobody Fri Sep 25 02:02:25 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 E94364E0B7D; Thu, 17 Sep 2026 19:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672977; cv=none; b=ov012nZyp1Fd3YjTFTvM39HmLgY9Hv36+CJOMDH+hfl3jmCP4rIiHUyV+5kBIJIPyQ8FVN4WFS8KXwgzvd6usVsdBfrk/AjeWsNj9Q8i4rGl5TLGKtDELcGtiPaix4gy2VfmBmzslngSqZ59mc5RHSh+s6iA/qRYADco3zu/zXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789672977; c=relaxed/simple; bh=EO1iyrDI5OeQk/LXBuby9pe9hBP33O0dg7m13AVRE+A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WJ9h8vy0GfKDIBJ7mkgKOsSrCN4ucPUoPmHQAYqetkm54dPYP4HF0l5tctMhQZR08DCsfPAtkJZ8pfyCCwmpFDmSxsLP0AaWgLviXNIBTvbGjzPwtMMHyN0Mm8zxB27RK7V9WPyIlWVg00VeRNzFSCX1IRZXHKSrbaOFfz9bgFY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=JHvqwkVk; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="JHvqwkVk" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68HHVXfa1980294; Thu, 17 Sep 2026 19:22:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=iXFxEDCyqV/ZXAY3C +c31u4YyNdH3+Ubv/LmA1cwqDo=; b=JHvqwkVk33aOaiB8CF0WFXGM9Cyr62IH6 7mxJrwAQz+qDe53mblUZmnpXooDjVWUjU2E0DB5gXRRH9hVUJglIedgLLFKodbiW RUzrz0yxhppr20JbO0SQzHzieGOlgte0XctKkE8VAZvYHFAXl0TV07m2edQ1EP2r JkRvboQ6vt+86JX1qvpQwwCX5N8sqnnNav0FiMttWkna2DSEdBz4QMuJiZsw3WM1 piAJaXS1u37bGcFmX2ZzDP6x/3xCP72YhR/uGDbOMi2hhnEYuk0q4YbD3cZEu9eo 7U2Rs/0dVRlCqp8xLphKG/PQIkr9IX4cjSqRKj5MdoMpzkgkpKBtw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmw5ebxs6-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:44 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68HH9G2j3494061; Thu, 17 Sep 2026 19:22:43 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4gr5fjm08g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2026 19:22:43 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68HJMd5L31982278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2026 19:22:40 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB0042004B; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94A7C20049; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2026 19:22:39 +0000 (GMT) From: Heiko Carstens To: Alexander Gordeev , Sven Schnelle , Vasily Gorbik , Christian Borntraeger , Mete Durlu , Peter Zijlstra , Mark Rutland , Juergen Christ , Ilya Leoshkevich Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH 12/12] s390/percpu: Rework to simplify percpu_entry() and percpu_exit() Date: Thu, 17 Sep 2026 21:22:37 +0200 Message-ID: <20260917192237.638324-13-hca@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917192237.638324-1-hca@linux.ibm.com> References: <20260917192237.638324-1-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX7Jr0MQJi1XV3 BW36glItumtxbZcd2Fppc3XiK5gNzV0t44TVXeOCC8TAMnuC1deKFsqpsfvwSApZVR4ayIJWJMO nd3uIu4LIg5ze5qPuMU/F4ZCiScRgih9lohwo7D6zAP8PMnCAMwgqsHA1vFqIFv3sCc45mM3xJx 7HkyQrkBgUtvoWj6reqtq6gQO7KSQuUigMlMaPjaztiTZsC6hbPDkWbzoQc6UfhuhmzG/TNBs+Q /FpEbG2BU+mRGFtSWJRVjzkxkQxPemCsnL1dc7b5e5WxVY8YImFgINWCn8cTEtaVJYnZwf/APh0 dLX5vemIYkX3umNA/2XA+oBFlKTwgO5iIr3lzE6HIDPcWRgUZ+5rJS5koqi7AJmv7quRU/vsJ17 mnz4w0akKoo9JnVPOkYZvWIBYQsgO/hBLb6gkk+ApqIjJze6IxFKQ43pQrYM2PBbgFBo++0wlpk dtyr/UQiYl8Y4dKLxTw== X-Authority-Analysis: v=2.4 cv=E/NYNqdl c=1 sm=1 tr=0 ts=6aac3e04 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=7CQSdrXTAAAA:8 a=VnNF1IyMAAAA:8 a=nX91KqSqHLHixs4I5UoA:9 a=ZBt6NyxRiIMNS_uD:21 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-ORIG-GUID: HPv2FiqBHl2aHnEEXtEAJfK6zufHc2eH X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDI3MiBTYWx0ZWRfX6VaHPDQkHOzo bmevZtmPHZ40vLzt9eeRMuD1t2MdUDiHINKZi7JvVOnobOdD5FBb7Ajn2yH+Pw/OctmoKhT+DHC cD7xEedS/H5ySgpMXwXWodKYlZkwz/c= X-Proofpoint-GUID: HPv2FiqBHl2aHnEEXtEAJfK6zufHc2eH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_04,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 clxscore=1015 bulkscore=0 malwarescore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170272 Content-Type: text/plain; charset="utf-8" The percpu code section functionality uses a rather complex method to figure out if the register, which contains the address of the current cpu's percpu variable, needs to be adjusted. If an interrupt happens within a percpu code section (indicated by a lowcore field), the instruction at the interrupted location is checked. If it is not a specific AG instruction, the register needs to be updated. This mechanism needs to take kprobes into account, and enforces a specific instruction ordering. Mark Rutland provided with a different solution for arm64 [1] which comes without such limitations, but requires to use one more instruction, and two more registers. Given that this simplifies percpu_entry() and percpu_exit() it seems to be worth to go that route. Change s390 to implement a similar approach. This requires to encode three register numbers into the "percpu_register" field, which is used to indicate if a percpu code section is executed. The used mviy instruction can write only one byte, which allows to encode only two register numbers. Use a register pair for the inline assemblies, and only encode the even register number of the register pair to work around this. The generated code changes like this for e.g. a simple this_cpu_inc(): Old: c0 20 00 00 00 00 larl %r2,c6 <-- load address of percpu var b9 04 00 32 lgr %r3,%r2 <-- pointless copy of address eb 03 03 c0 00 52 mviy 960,3 <-- start of percpu code section - gpr 3 contains percpu var= address e3 30 03 b8 00 08 ag %r3,952 <-- add percpu offset eb 01 30 00 00 7a agsi 0(%r3),1 <-- atomic inc eb 00 03 c0 00 52 mviy 960,0 <-- end of percpu code section New: c0 10 00 00 00 00 larl %r1,c6 <-- load address of percpu var eb 21 03 c0 00 52 mviy 960,33 <-- start of percpu code section 33 =3D=3D 0x21: - gpr 1 contains percpu var address - gpr 2 used for percpu offset - gpr 2+1 =3D=3D 3 used for current cpu's percpu var address e3 20 03 b8 00 04 lg %r2,952 <-- load percpu offset b9 e8 20 31 agrk %r3,%r1,%r2 <-- generate current cpu's perc= pu var address eb 01 30 00 00 7a agsi 0(%r3),1 <-- atomic inc eb 00 03 c0 00 52 mviy 960,0 <-- end of percpu code section In the above "new" code example 33 (0x21) is used as indicator value to mark that a percpu code section is executed. This value implies that registers 2 and 3 will (only) hold the percpu offset and the current cpu's percpu var address. Those registers will always be updated by the percpu_exit() code to contain the percpu offset and percpu var address of the current cpu. Note that because of the pointless lgr instruction in the "old" code example the two code sequences have identical size, and it looks like only one more register is used. However this is because of suboptimal gcc code generation. [1] https://lore.kernel.org/all/20260908151741.394589-1-mark.rutland@arm.co= m/ Signed-off-by: Heiko Carstens --- arch/s390/include/asm/entry-percpu.h | 74 ++------- arch/s390/include/asm/percpu.h | 222 ++++++++++++++++++--------- arch/s390/include/asm/ptrace.h | 1 - arch/s390/kernel/irq.c | 10 +- arch/s390/kernel/nmi.c | 4 +- arch/s390/kernel/traps.c | 4 +- 6 files changed, 172 insertions(+), 143 deletions(-) diff --git a/arch/s390/include/asm/entry-percpu.h b/arch/s390/include/asm/e= ntry-percpu.h index 89c9e44f6f83..7ec5d976db47 100644 --- a/arch/s390/include/asm/entry-percpu.h +++ b/arch/s390/include/asm/entry-percpu.h @@ -2,79 +2,39 @@ #ifndef ARCH_S390_ENTRY_PERCPU_H #define ARCH_S390_ENTRY_PERCPU_H =20 -#include +#include #include #include #include -#include =20 static __always_inline void percpu_entry(struct pt_regs *regs) { struct lowcore *lc =3D get_lowcore(); =20 - if (user_mode(regs)) - return; - regs->cpu =3D lc->cpu_nr; regs->percpu_register =3D lc->percpu_register; lc->percpu_register =3D 0; } =20 -static __always_inline bool percpu_code_check(struct pt_regs *regs) -{ - unsigned int insn, disp; - struct kprobe *p; - - if (likely(user_mode(regs) || !regs->percpu_register)) - return false; - /* - * Within a percpu code section - check if the percpu base register - * needs to be updated. This is the case if the PSW does not point to - * the ADD instruction within the section. - * - AG %rx,percpu_offset_in_lowcore(%r0,%r0) - * which adds the percpu offset to the percpu base register. - */ - lockdep_assert_preemption_disabled(); -again: - insn =3D READ_ONCE(*(u16 *)psw_bits(regs->psw).ia); - if (unlikely(insn =3D=3D BREAKPOINT_INSTRUCTION)) { - p =3D get_kprobe((void *)psw_bits(regs->psw).ia); - /* - * If the kprobe is concurrently removed on a different CPU - * it might not be found anymore. However text must have - * been restored - try again. - */ - if (!p) - goto again; - insn =3D p->opcode; - } - if ((insn & 0xff0f) !=3D 0xe300) - return true; - disp =3D LC_PERCPU_OFFSET; - if (machine_has_relocated_lowcore()) - disp +=3D LOWCORE_ALT_ADDRESS; - insn =3D (disp & 0xff000) >> 4 | (disp & 0x00fff) << 16 | 0x8; - if (*(u32 *)(psw_bits(regs->psw).ia + 2) !=3D insn) - return true; - return false; -} - -static __always_inline void percpu_exit(struct pt_regs *regs, bool needs_f= ixup) +static __always_inline void percpu_exit(struct pt_regs *regs) { + unsigned char regval, regpcp, regoff, regptr; struct lowcore *lc =3D get_lowcore(); - unsigned char reg; =20 - if (user_mode(regs)) + if (!regs->percpu_register) return; - reg =3D regs->percpu_register; - lc->percpu_register =3D reg; - if (likely(!needs_fixup)) - return; - /* Check if process has been migrated to a different CPU. */ - if (regs->cpu =3D=3D lc->cpu_nr) - return; - /* Fixup percpu base register */ - regs->gprs[reg] -=3D __per_cpu_offset[regs->cpu]; - regs->gprs[reg] +=3D lc->percpu_offset; + regval =3D regs->percpu_register; + lc->percpu_register =3D regval; + regpcp =3D FIELD_GET(PCPU_REG_PCP, regval); + regoff =3D FIELD_GET(PCPU_REG_OFF, regval); + regptr =3D regoff + 1; + + /* + * Update register 'regoff' which contains the current CPU's percpu + * offset, and recalculate and update current CPU's percpu variable + * address contained in register 'regptr'. + */ + regs->gprs[regoff] =3D lc->percpu_offset; + regs->gprs[regptr] =3D regs->gprs[regpcp] + regs->gprs[regoff]; } =20 #endif diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 46368131b932..ea9448009468 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -67,28 +67,31 @@ * this. The idea is that this_cpu operations based on atomic instructions= are * guarded with mviy instructions: * - * - The first mviy instruction writes the register number, which contains= the - * percpu address variable to lowcore. This also indicates that a percpu - * code section is executed. + * - The first mviy instruction writes the register number of the percpu a= ddress + * variable and the even register number of a register pair (which encod= es two + * registers: the even register for the percpu offset and the odd regist= er for + * the percpu pointer) to lowcore. This also indicates that a percpu code + * section is executed. * - * - The first mviy instruction following the mviy instruction must be the= ag - * instruction which adds the percpu offset to the percpu address regist= er. + * - The mviy instruction is followed by the lg instruction which loads the + * percpu offset into the even register of the pair and the agrk instruc= tion + * which adds the percpu offset and the percpu address into the odd regi= ster + * of the pair (the percpu pointer register). * * - Afterwards the atomic percpu operation follows. * * - Then a second mviy instruction writes a zero to lowcore, which indica= tes * the end of the percpu code section. * - * - In case of an interrupt/exception/nmi the register number which was - * written to lowcore is copied to the exception frame (pt_regs), and a = zero - * is written to lowcore. + * - In case of an interrupt/exception/nmi the encoded register numbers wh= ich + * were written to lowcore are copied to the exception frame (pt_regs), = and a + * zero is written to lowcore. * * - On return to the previous context it is checked if a percpu code sect= ion - * was executed (saved register number not zero), and if the process was - * migrated to a different cpu. If the percpu offset was already added to - * the percpu address register (instruction address does _not_ point to = the - * ag instruction) the content of the percpu address register is adjuste= d so - * it points to percpu variable of the new cpu. + * was executed (saved register value not zero). The content of the perc= pu + * offset register (even register of the pair) is reloaded with the curr= ent + * cpu's percpu offset and the percpu pointer register (odd register of = the + * pair) is recalculated so it points to the percpu variable of the new = cpu. * * Inline assemblies making use of this typically have a code sequence lik= e: * @@ -115,27 +118,45 @@ #define UNDEF_GR_NUM \ ".purgem _GR_NUM\n" =20 +#define PCPU_REG_PCP_SHIFT 0 +#define PCPU_REG_PCP GENMASK(3, 0) +#define PCPU_REG_OFF_SHIFT 4 +#define PCPU_REG_OFF GENMASK(7, 4) + #define __PCPU_MVIY(lcreg, imm) \ ALTERNATIVE(" mviy " lcreg "(%%r0)," imm "\n", \ " mviy " lcreg "+" LC_ALT_ADDR "(%%r0)," imm "\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) =20 -#define __PCPU_AG(reg, lcoff) \ - ALTERNATIVE(" ag " reg ", " lcoff "(%%r0)\n", \ - " ag " reg ", " lcoff "+" LC_ALT_ADDR "(%%r0)\n", \ +#define __PCPU_MVIY_REGS(lcreg, regpcp, regoff) \ + DEFINE_GR_NUM \ + "_GR_NUM .Lregpcp, " regpcp "\n" \ + "_GR_NUM .Lregoff, " regoff "\n" \ + UNDEF_GR_NUM \ + ".if .Lregpcp =3D=3D .Lregoff\n" \ + " .error \"Registers must not be identical\"\n" \ + ".endif\n" \ + ".set .Lregval, ((.Lregpcp << " __stringify(PCPU_REG_PCP_SHIFT) ") |" \ + " (.Lregoff << " __stringify(PCPU_REG_OFF_SHIFT) "))\n" \ + __PCPU_MVIY(lcreg, ".Lregval") + +#define __PCPU_LG(regoff, lcoff) \ + ALTERNATIVE("lg " regoff ", " lcoff "(%%r0)\n", \ + "lg " regoff ", " lcoff "+" LC_ALT_ADDR "(%%r0)\n", \ ALT_FEATURE(MFEATURE_LOWCORE)) =20 -#define __PCPU_BEGIN(lcreg, lcoff, reg) \ - DEFINE_GR_NUM \ - "_GR_NUM .Lreg, " reg "\n" \ - UNDEF_GR_NUM \ - __PCPU_MVIY(lcreg, ".Lreg") \ - __PCPU_AG(reg, lcoff) +#define __PCPU_AGRK(regptr, regpcp, regoff) \ + " agrk " regptr "," regpcp "," regoff "\n" + +#define __PCPU_BEGIN(lcreg, lcoff, regpcp, regoff, regptr) \ + __PCPU_MVIY_REGS(lcreg, regpcp, regoff) \ + __PCPU_LG(regoff, lcoff) \ + __PCPU_AGRK(regptr, regpcp, regoff) =20 #define __PCPU_END(lcreg) \ __PCPU_MVIY(lcreg, "0") =20 -#ifndef MARCH_HAS_Z196_FEATURES +#if !defined(MARCH_HAS_Z196_FEATURES) || !defined(CONFIG_CC_HAS_ASM_M_FORM= AT_FLAG) =20 #define this_cpu_add_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +) #define this_cpu_add_8(pcp, val) arch_this_cpu_to_op_simple(pcp, val, +) @@ -146,11 +167,12 @@ #define this_cpu_or_4(pcp, val) arch_this_cpu_to_op_simple(pcp, val, |) #define this_cpu_or_8(pcp, val) arch_this_cpu_to_op_simple(pcp, val, |) =20 -#else /* MARCH_HAS_Z196_FEATURES */ +#else /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ =20 #define arch_this_cpu_add(pcp, val, op1, op2, szcast) \ do { \ typedef typeof(pcp) pcp_op_T__; \ + union register_pair pair__; \ pcp_op_T__ val__ =3D (val); \ pcp_op_T__ old__, *ptr__; \ \ @@ -158,25 +180,27 @@ do { \ if (__builtin_constant_p(val__) && \ ((szcast)val__ > -129) && ((szcast)val__ < 128)) { \ asm volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op2 " 0(%[ptr__]),%[val__]\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op2 " 0(%M[pair__]),%[val__]\n" \ __PCPU_END("%[lcreg]") \ - : [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + : [pair__] "=3D&d" (pair__), "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [val__] "i" ((szcast)val__), \ + : [val__] "i" ((szcast)val__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ : "cc"); \ } else { \ asm volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op1 " %[old__],%[val__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op1 " %[old__],%[val__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [old__] "=3D&d" (old__), \ - [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + : [old__] "=3D&d" (old__), [pair__] "=3D&d" (pair__), \ + "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [val__] "d" (val__), \ + : [val__] "d" (val__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -190,18 +214,20 @@ do { \ #define arch_this_cpu_add_return(pcp, val, op) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ + union register_pair pair__; \ pcp_op_T__ val__ =3D (val); \ pcp_op_T__ old__, *ptr__; \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op " %[old__],%[val__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op " %[old__],%[val__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [old__] "=3D&d" (old__), \ - [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + : [old__] "=3D&d" (old__), [pair__] "=3D&d" (pair__), \ + "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [val__] "d" (val__), \ + : [val__] "d" (val__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -215,18 +241,20 @@ do { \ #define arch_this_cpu_to_op(pcp, val, op) \ do { \ typedef typeof(pcp) pcp_op_T__; \ + union register_pair pair__; \ pcp_op_T__ val__ =3D (val); \ pcp_op_T__ old__, *ptr__; \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op " %[old__],%[val__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op " %[old__],%[val__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [old__] "=3D&d" (old__), \ - [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + : [old__] "=3D&d" (old__), [pair__] "=3D&d" (pair__), \ + "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [val__] "d" (val__), \ + : [val__] "d" (val__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -238,22 +266,23 @@ do { \ #define this_cpu_or_4(pcp, val) arch_this_cpu_to_op(pcp, val, "lao") #define this_cpu_or_8(pcp, val) arch_this_cpu_to_op(pcp, val, "laog") =20 -#endif /* MARCH_HAS_Z196_FEATURES */ - #define arch_this_cpu_read(pcp, op) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ + union register_pair pair__; \ unsigned long res__; \ pcp_op_T__ *ptr__; \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op " %[res__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op " %[res__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [res__] "=3D&d" (res__), [ptr__] "+&a" (ptr__), \ + : [res__] "=3D&d" (res__), [pair__] "=3D&d" (pair__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [lcreg] "i" (LC_PERCPU_REGISTER), \ + : [ptr__] "d" (ptr__), \ + [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (*ptr__), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -269,16 +298,18 @@ do { \ #define arch_this_cpu_write(pcp, val, op) \ do { \ typedef typeof(pcp) pcp_op_T__; \ + union register_pair pair__; \ pcp_op_T__ *ptr__, val__ =3D (val); \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op " %[val__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op " %[val__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [ptr__] "+&a" (ptr__), "=3Dm" (*ptr__), \ + : [pair__] "=3D&d" (pair__), "=3Dm" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [val__] "d" (val__), \ + : [val__] "d" (val__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -290,6 +321,8 @@ do { \ #define this_cpu_write_4(pcp, val) arch_this_cpu_write(pcp, val, "st") #define this_cpu_write_8(pcp, val) arch_this_cpu_write(pcp, val, "stg") =20 +#endif /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + #define arch_this_cpu_cmpxchg_simple(pcp, oval, nval) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ @@ -302,21 +335,33 @@ do { \ ret__; \ }) =20 +#define this_cpu_cmpxchg_1(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) +#define this_cpu_cmpxchg_2(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) + +#if !defined(MARCH_HAS_Z196_FEATURES) || !defined(CONFIG_CC_HAS_ASM_M_FORM= AT_FLAG) + +#define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) +#define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) + +#else /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + #define arch_this_cpu_cmpxchg(pcp, oval, nval, op) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ old__ =3D (oval), new__ =3D (nval); \ + union register_pair pair__; \ pcp_op_T__ *ptr__; \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - op " %[old__],%[new__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + op " %[old__],%[new__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [old__] "+&d" (old__), \ - [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + : [old__] "+&d" (old__), [pair__] "=3D&d" (pair__), \ + "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [new__] "d" (new__), \ + : [new__] "d" (new__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -324,28 +369,45 @@ do { \ old__; \ }) =20 -#define this_cpu_cmpxchg_1(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) -#define this_cpu_cmpxchg_2(pcp, oval, nval) arch_this_cpu_cmpxchg_simple(p= cp, oval, nval) #define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval, "cs") #define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, ova= l, nval, "csg") =20 +#endif /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + #define this_cpu_cmpxchg64(pcp, o, n) this_cpu_cmpxchg_8(pcp, o, n) =20 +#if !defined(MARCH_HAS_Z196_FEATURES) || !defined(CONFIG_CC_HAS_ASM_M_FORM= AT_FLAG) + +#define this_cpu_cmpxchg128(pcp, oval, nval) \ +({ \ + u128 *ptr__, ret__; \ + \ + preempt_disable_notrace(); \ + ptr__ =3D raw_cpu_ptr(&(pcp)); \ + ret__ =3D arch_cmpxchg128(ptr__, oval, nval); \ + preempt_enable_notrace(); \ + ret__; \ +}) + +#else /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + #define this_cpu_cmpxchg128(pcp, oval, nval) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ u128 old__ =3D (oval), new__ =3D (nval); \ + union register_pair pair__; \ pcp_op_T__ *ptr__; \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - " cdsg %[old__],%[new__],0(%[ptr__])\n" \ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + " cdsg %[old__],%[new__],0(%M[pair__])\n" \ __PCPU_END("%[lcreg]") \ - : [old__] "+&d" (old__), [ptr__] "+&a" (ptr__), \ + : [old__] "+&d" (old__), [pair__] "=3D&d" (pair__), \ "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [new__] "d" (new__), \ + : [new__] "d" (new__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -353,6 +415,8 @@ do { \ old__; \ }) =20 +#endif /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + #define arch_this_cpu_xchg_simple(pcp, nval) \ ({ \ typeof(pcp) *ptr__; \ @@ -364,23 +428,35 @@ do { \ ret__; \ }) =20 -#define arch_this_cpu_xchg(pcp, nval, ldop, csop) \ +#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) +#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) + +#if !defined(MARCH_HAS_Z196_FEATURES) || !defined(CONFIG_CC_HAS_ASM_M_FORM= AT_FLAG) + +#define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) +#define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) + +#else /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + +#define arch_this_cpu_xchg(pcp, nval, lop, cop) \ ({ \ typedef typeof(pcp) pcp_op_T__; \ pcp_op_T__ old__, new__ =3D (nval); \ + union register_pair pair__; \ pcp_op_T__ *ptr__; \ \ ptr__ =3D PERCPU_PTR(&(pcp)); \ asm_inline volatile( \ - __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]") \ - " " ldop " %[old__],0(%[ptr__])\n" \ - "0: " csop " %[old__],%[new__],0(%[ptr__])\n"\ + __PCPU_BEGIN("%[lcreg]","%[lcoff]","%[ptr__]", \ + "%[pair__]","%M[pair__]") \ + " " lop " %[old__],0(%M[pair__])\n" \ + "0: " cop " %[old__],%[new__],0(%M[pair__])\n" \ " jnz 0b\n" \ __PCPU_END("%[lcreg]") \ - : [old__] "=3D&d" (old__), \ - [ptr__] "+&a" (ptr__), "+m" (*ptr__), \ + : [old__] "=3D&d" (old__), [pair__] "=3D&d" (pair__), \ + "+m" (*ptr__), \ "=3Dm" (((struct lowcore *)0)->percpu_register) \ - : [new__] "d" (new__), \ + : [new__] "d" (new__), [ptr__] "d" (ptr__), \ [lcreg] "i" (LC_PERCPU_REGISTER), \ [lcoff] "i" (LC_PERCPU_OFFSET), \ "m" (((struct lowcore *)0)->percpu_offset) \ @@ -388,11 +464,11 @@ do { \ old__; \ }) =20 -#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) -#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg_simple(pcp, nval) #define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval, "l", "cs= ") #define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval, "lg", "cs= g") =20 +#endif /* MARCH_HAS_Z196_FEATURES || CONFIG_CC_HAS_ASM_M_FORMAT_FLAG */ + #include =20 #endif /* __ARCH_S390_PERCPU__ */ diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h index 6411e3584283..84e58d3a0008 100644 --- a/arch/s390/include/asm/ptrace.h +++ b/arch/s390/include/asm/ptrace.h @@ -132,7 +132,6 @@ struct pt_regs { }; unsigned long flags; unsigned long last_break; - unsigned int cpu; unsigned char percpu_register; }; =20 diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index c923496aa7b4..8f21bea349a6 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c @@ -144,9 +144,9 @@ static int irq_pending(struct pt_regs *regs) =20 void noinstr do_io_irq(struct pt_regs *regs) { - bool from_idle, percpu_needs_fixup; struct pt_regs *old_regs; irqentry_state_t state; + bool from_idle; =20 percpu_entry(regs); state =3D irqentry_enter(regs); @@ -174,21 +174,20 @@ void noinstr do_io_irq(struct pt_regs *regs) do_irq_async(regs, IO_INTERRUPT); } while (machine_is_lpar() && irq_pending(regs)); =20 - percpu_needs_fixup =3D percpu_code_check(regs); irq_exit_rcu(); set_irq_regs(old_regs); irqentry_exit(regs, state); =20 if (from_idle) regs->psw.mask &=3D ~(PSW_MASK_EXT | PSW_MASK_IO | PSW_MASK_WAIT); - percpu_exit(regs, percpu_needs_fixup); + percpu_exit(regs); } =20 void noinstr do_ext_irq(struct pt_regs *regs) { - bool from_idle, percpu_needs_fixup; struct pt_regs *old_regs; irqentry_state_t state; + bool from_idle; =20 percpu_entry(regs); state =3D irqentry_enter(regs); @@ -214,14 +213,13 @@ void noinstr do_ext_irq(struct pt_regs *regs) =20 do_irq_async(regs, EXT_INTERRUPT); =20 - percpu_needs_fixup =3D percpu_code_check(regs); irq_exit_rcu(); set_irq_regs(old_regs); irqentry_exit(regs, state); =20 if (from_idle) regs->psw.mask &=3D ~(PSW_MASK_EXT | PSW_MASK_IO | PSW_MASK_WAIT); - percpu_exit(regs, percpu_needs_fixup); + percpu_exit(regs); } =20 static void show_msi_interrupt(struct seq_file *p, int irq) diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index 17297a8b63d9..56a15edc65d7 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c @@ -361,7 +361,6 @@ NOKPROBE_SYMBOL(s390_backup_mcck_info); */ void notrace s390_do_machine_check(struct pt_regs *regs) { - bool percpu_needs_fixup; static int ipd_count; static DEFINE_SPINLOCK(ipd_lock); static unsigned long long last_ipd; @@ -495,9 +494,8 @@ void notrace s390_do_machine_check(struct pt_regs *regs) if (mcck_pending) schedule_mcck_handler(); =20 - percpu_needs_fixup =3D percpu_code_check(regs); irqentry_nmi_exit(regs, irq_state); - percpu_exit(regs, percpu_needs_fixup); + percpu_exit(regs); } NOKPROBE_SYMBOL(s390_do_machine_check); =20 diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index b6ba4465f59d..dd051046170b 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -338,7 +338,6 @@ static void (*pgm_check_table[128])(struct pt_regs *reg= s); void noinstr __do_pgm_check(struct pt_regs *regs, unsigned long flags) { struct lowcore *lc =3D get_lowcore(); - bool percpu_needs_fixup; irqentry_state_t state; struct pgm_stat *stat; unsigned int trapnr; @@ -400,9 +399,8 @@ void noinstr __do_pgm_check(struct pt_regs *regs, unsig= ned long flags) pgm_check_table[trapnr](regs); out: local_irq_disable(); - percpu_needs_fixup =3D percpu_code_check(regs); irqentry_exit(regs, state); - percpu_exit(regs, percpu_needs_fixup); + percpu_exit(regs); } =20 static int pgm_check_stat_show(struct seq_file *p, void *v) --=20 2.53.0