From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1053AC32771 for ; Tue, 27 Sep 2022 03:13:27 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Mc4T133jlz3c87 for ; Tue, 27 Sep 2022 13:13:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=mAJSGTm2; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=bgray@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=mAJSGTm2; dkim-atps=neutral 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 lists.ozlabs.org (Postfix) with ESMTPS id 4Mc4SC03L1z3bgh for ; Tue, 27 Sep 2022 13:12:41 +1000 (AEST) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28R1cZ82023183; Tue, 27 Sep 2022 03:12:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=SrHS4MxbYFs2TqQ8PSJgvFaLMbNIZ+BaSolA6JCd/YY=; b=mAJSGTm2gVMAbMqEVVFY6KMvdzaopm8B5oGq07Hwi+vxoYcd8wkVSIrXisXrgniEQT0o z5u39jKJfilKyflhahYed6Ibt6IKzLxwI0qqLkMVRqLgfQHMnhMSXqfNu2Md9e+TxO11 rcNsqWWlxR5+lG6Ac6/CE0eYux5VeLj9Ix7fqMsAef/SawFSScUe3AjKVhQHmb04Ye6B kS4XBKhFj8hqFPsnB7l2pzM02FS9M9oiqf36H/EHBemkDmpEvSzH1AQuuB+RCWajX4UI 9uLdaVaDMWLZHtwxMirTmlscQcycqnHlMt/w3NfEvPjP2fnmuyYicC03lYiWlcr9dnL9 EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3juqesa76f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 03:12:25 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28R30PsK025454; Tue, 27 Sep 2022 03:12:25 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3juqesa75u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 03:12:24 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28R366PO006159; Tue, 27 Sep 2022 03:12:22 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06ams.nl.ibm.com with ESMTP id 3jss5j36rq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 03:12:22 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28R3CKju59769258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Sep 2022 03:12:20 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F56BA4040; Tue, 27 Sep 2022 03:12:20 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED006A4051; Tue, 27 Sep 2022 03:12:19 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 27 Sep 2022 03:12:19 +0000 (GMT) Received: from [10.61.2.107] (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id C1E0E6057F; Tue, 27 Sep 2022 13:12:18 +1000 (AEST) Message-ID: <4afd73392c4a31916e7aaad7767d5e945a40ddb9.camel@linux.ibm.com> Subject: Re: [PATCH v2 3/6] powerpc/module: Optimise nearby branches in ELF V2 ABI stub From: Benjamin Gray To: Christophe Leroy , "linuxppc-dev@lists.ozlabs.org" Date: Tue, 27 Sep 2022 13:12:18 +1000 In-Reply-To: <44761b8c-f51f-ae32-b0f6-d9ab09670f9b@csgroup.eu> References: <20220926064316.765967-1-bgray@linux.ibm.com> <20220926064316.765967-4-bgray@linux.ibm.com> <44761b8c-f51f-ae32-b0f6-d9ab09670f9b@csgroup.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: nYoLtXSZ17CeqZmVp157o2-U9EeSy1IC X-Proofpoint-GUID: pBtKe_O3u4jKBM9C-v7cNhFDrWj-XoP1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-26_11,2022-09-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=927 spamscore=0 phishscore=0 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209270016 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "ajd@linux.ibm.com" , "peterz@infradead.org" , "npiggin@gmail.com" , "ardb@kernel.org" , "jbaron@akamai.com" , "rostedt@goodmis.org" , "jpoimboe@kernel.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, 2022-09-26 at 14:49 +0000, Christophe Leroy wrote: > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* Replace indirect branch s= equence with direct branch > > where possible */ > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!create_branch(&direct, = jump_seq_addr, addr, 0)) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0if (patch_instruction(jump_seq_addr, direct)) >=20 > Why not use patch_branch() ? I didn't think of it at the time. To get the same abort-if-patch-failed semantics then the following should work int err; ... /* Replace indirect branch sequence with direct branch where=C2=A0 * possible=C2=A0 */ err =3D patch_branch(&entry->jump[PPC64_STUB_MTCTR_OFFSET], addr, 0); if (err && err !=3D -ERANGE) return 0; >=20