From: Puranjay Mohan <puranjay@kernel.org>
To: Xu Kuohai <xukuohai@huaweicloud.com>,
bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Leon Hwang <hffilwlqm@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH bpf-next 0/2] bpf, arm64: Simplify jited prologue/epilogue
Date: Mon, 26 Aug 2024 10:37:33 +0000 [thread overview]
Message-ID: <mb61pplpvo9hu.fsf@kernel.org> (raw)
In-Reply-To: <20240826071624.350108-1-xukuohai@huaweicloud.com>
[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]
Xu Kuohai <xukuohai@huaweicloud.com> writes:
> From: Xu Kuohai <xukuohai@huawei.com>
>
> 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 <puranjay@kernel.org>
Thanks,
Puranjay Mohan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]
next prev parent reply other threads:[~2024-08-26 10:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 7:16 [PATCH bpf-next 0/2] bpf, arm64: Simplify jited prologue/epilogue Xu Kuohai
2024-08-26 7:16 ` [PATCH bpf-next 1/2] bpf, arm64: Get rid of fpb Xu Kuohai
2024-08-26 7:16 ` [PATCH bpf-next 2/2] bpf, arm64: Avoid blindly saving/restoring all callee-saved registers Xu Kuohai
2024-08-26 10:37 ` Puranjay Mohan [this message]
2024-08-28 15:50 ` [PATCH bpf-next 0/2] bpf, arm64: Simplify jited prologue/epilogue patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mb61pplpvo9hu.fsf@kernel.org \
--to=puranjay@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=hffilwlqm@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=will@kernel.org \
--cc=xukuohai@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.