diff options
author | Leon Hwang <hffilwlqm@gmail.com> | 2023-09-12 23:04:40 +0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-09-12 13:06:12 -0700 |
commit | 2bee9770f3c6be736a28725cb0f93775ed22e720 (patch) | |
tree | 73ce0e5d1303434ef6f1fcc973c12da09cf14347 /arch | |
parent | 96daa9874211d5497aa70fa409b67afc29f0cb86 (diff) | |
download | linux-stable-2bee9770f3c6be736a28725cb0f93775ed22e720.tar.gz linux-stable-2bee9770f3c6be736a28725cb0f93775ed22e720.tar.bz2 linux-stable-2bee9770f3c6be736a28725cb0f93775ed22e720.zip |
bpf, x64: Comment tail_call_cnt initialisation
Without understanding emit_prologue(), it is really hard to figure out
where does tail_call_cnt come from, even though searching tail_call_cnt
in the whole kernel repo.
By adding these comments, it is a little bit easier to understand
tail_call_cnt initialisation.
Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Link: https://lore.kernel.org/r/20230912150442.2009-2-hffilwlqm@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/net/bpf_jit_comp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index a5930042139d..bcca1c9b9a02 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -303,8 +303,12 @@ static void emit_prologue(u8 **pprog, u32 stack_depth, bool ebpf_from_cbpf, prog += X86_PATCH_SIZE; if (!ebpf_from_cbpf) { if (tail_call_reachable && !is_subprog) + /* When it's the entry of the whole tailcall context, + * zeroing rax means initialising tail_call_cnt. + */ EMIT2(0x31, 0xC0); /* xor eax, eax */ else + /* Keep the same instruction layout. */ EMIT2(0x66, 0x90); /* nop2 */ } EMIT1(0x55); /* push rbp */ |