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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 70968C5321D for ; Mon, 26 Aug 2024 10:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A6gYBUEuGWO84XCF6qyj03BSMibIUU2PXexM4cFvRZU=; b=ur0eaLSoy+cT+RqEa+NKMSP+L2 ONIXH8O/Y33yFvgckTOWpytLcNTGGFczd0E8Zrs3j8scaZsTGsBZR6MWsbCLpQ7SXmVui+SCGcqwR fVxLgDUNvEeyU7jJGljetrUWf7BbSojLJBhrFW5oyEbmNGHSSo0H9NeA5+1KvlLOAq8JLtVrQHuRI fhHIPkUBeIVaVep1Z/IEHetgiAIX5SO2XUyiC/+fgPXqEj8O1HemFpytsJLMSbI6pv/BHXRZx6qvn X7Hkz18yRqUniY8Appdvi2+L1G8VFzCIBjO3pYhR1JlEcDZDiywnLaik9SJINzKwppYdqM5E5pZIj 1cTbI2Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siX7Z-00000006xaQ-2g3K; Mon, 26 Aug 2024 10:38:49 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siX6h-00000006xRY-2Dsy for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 10:38:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1FB12A42503; Mon, 26 Aug 2024 10:37:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F40DC51401; Mon, 26 Aug 2024 10:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724668672; bh=sPEcrJTwenHdVc/Yfnd8nSY6Fjv0xAC8DC3jZl33GvM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NUTn5898+wFjuV2k1z3xgymggw45/n9c7Mu/tCzpIzQZBPlxDUuaJKGQemJ9W6V1T jdWolTPNWJOYlZ21F3Zn8S0H/B3sJbTB0CdtF+u9ZeMG0e353iALVgZBOV8mi6mQVY D08+Vyvib6R9DtMTOJNAsYK36MUClrDiM6mye/pCJZFyD2trHQBUtf3T8VZ7zV2/XS MvT0/UPtcSwxwuWWZ9ibaCKgR/0DBjVhRjNQquqt8VKfQ1wKMJp2i3kNbTszlNi+Ae nYdAkwWzEv9ky3WbYXM56tii4stF0gB5sJzL87ZZwK8mLPQX0RKg5xX9fdeptf1GKg scScJweFXcCEA== From: Puranjay Mohan To: Xu Kuohai , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Leon Hwang , Catalin Marinas , Will Deacon Subject: Re: [PATCH bpf-next 0/2] bpf, arm64: Simplify jited prologue/epilogue In-Reply-To: <20240826071624.350108-1-xukuohai@huaweicloud.com> References: <20240826071624.350108-1-xukuohai@huaweicloud.com> Date: Mon, 26 Aug 2024 10:37:33 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_033759_160783_D419E12E X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --=-=-= Content-Type: text/plain Xu Kuohai writes: > From: Xu Kuohai > > The arm64 jit blindly saves/restores all callee-saved registers, making > the jited result looks a bit too compliated. For example, for an empty > prog, the jited result is: > > 0: bti jc > 4: mov x9, lr > 8: nop > c: paciasp > 10: stp fp, lr, [sp, #-16]! > 14: mov fp, sp > 18: stp x19, x20, [sp, #-16]! > 1c: stp x21, x22, [sp, #-16]! > 20: stp x26, x25, [sp, #-16]! > 24: mov x26, #0 > 28: stp x26, x25, [sp, #-16]! > 2c: mov x26, sp > 30: stp x27, x28, [sp, #-16]! > 34: mov x25, sp > 38: bti j // tailcall target > 3c: sub sp, sp, #0 > 40: mov x7, #0 > 44: add sp, sp, #0 > 48: ldp x27, x28, [sp], #16 > 4c: ldp x26, x25, [sp], #16 > 50: ldp x26, x25, [sp], #16 > 54: ldp x21, x22, [sp], #16 > 58: ldp x19, x20, [sp], #16 > 5c: ldp fp, lr, [sp], #16 > 60: mov x0, x7 > 64: autiasp > 68: ret > > Clearly, there is no need to save/restore unused callee-saved registers. > This patch does this change, making the jited image to only save/restore > the callee-saved registers it uses. > > Now the jited result of empty prog is: > > 0: bti jc > 4: mov x9, lr > 8: nop > c: paciasp > 10: stp fp, lr, [sp, #-16]! > 14: mov fp, sp > 18: stp xzr, x26, [sp, #-16]! > 1c: mov x26, sp > 20: bti j // tailcall target > 24: mov x7, #0 > 28: ldp xzr, x26, [sp], #16 > 2c: ldp fp, lr, [sp], #16 > 30: mov x0, x7 > 34: autiasp > 38: ret > > Xu Kuohai (2): > bpf, arm64: Get rid of fpb > bpf, arm64: Avoid blindly saving/restoring all callee-saved registers > Acked-by: Puranjay Mohan Thanks, Puranjay Mohan --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIoEARYKADIWIQQ3wHGvVs/5bdl78BKwwPkjG3B2nQUCZsxa7hQccHVyYW5qYXlA a2VybmVsLm9yZwAKCRCwwPkjG3B2nTYrAQCOFfSHVX6+u8xLTQWxqf99QWDFuI0Y G15E57BDE7BLYwEAj0SUSBgdyObJaKXXmWLl9mMK6+EDR99KBGz0ryg5LQw= =vhV4 -----END PGP SIGNATURE----- --=-=-=--