Skip to content

Commit 3f28709

Browse files
seehearfeelborkmann
authored andcommitted
bpf, arm64: Replace STACK_ALIGN() with round_up() to align stack size
Use the common function round_up() directly to show the align size explicitly, the function STACK_ALIGN() is needless, remove it. Other JITs also just rely on round_up(). Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 0303ce1 commit 3f28709

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ static bool is_addsub_imm(u32 imm)
178178
return !(imm & ~0xfff) || !(imm & ~0xfff000);
179179
}
180180

181-
/* Stack must be multiples of 16B */
182-
#define STACK_ALIGN(sz) (((sz) + 15) & ~15)
183-
184181
/* Tail call offset to jump into */
185182
#if IS_ENABLED(CONFIG_ARM64_BTI_KERNEL)
186183
#define PROLOGUE_OFFSET 8
@@ -255,7 +252,8 @@ static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf)
255252
emit(A64_BTI_J, ctx);
256253
}
257254

258-
ctx->stack_size = STACK_ALIGN(prog->aux->stack_depth);
255+
/* Stack must be multiples of 16B */
256+
ctx->stack_size = round_up(prog->aux->stack_depth, 16);
259257

260258
/* Set up function call stack */
261259
emit(A64_SUB_I(1, A64_SP, A64_SP, ctx->stack_size), ctx);

0 commit comments

Comments
 (0)