bpf: Take advantage of stack_depth tracking in sparc64 JIT
authorDavid S. Miller <davem@davemloft.net>
Thu, 1 Jun 2017 02:35:00 +0000 (19:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Jun 2017 02:35:00 +0000 (19:35 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/net/bpf_jit_comp_64.c

index 4a52d34facf95329aeff85c2a02b856afbdded20..098874a81f6e31cc5e758a682cf459a4c0fb7bb8 100644 (file)
@@ -802,8 +802,13 @@ static void build_prologue(struct jit_ctx *ctx)
 {
        s32 stack_needed = BASE_STACKFRAME;
 
-       if (ctx->saw_frame_pointer || ctx->saw_tail_call)
-               stack_needed += MAX_BPF_STACK;
+       if (ctx->saw_frame_pointer || ctx->saw_tail_call) {
+               struct bpf_prog *prog = ctx->prog;
+               u32 stack_depth;
+
+               stack_depth = prog->aux->stack_depth;
+               stack_needed += round_up(stack_depth, 16);
+       }
 
        if (ctx->saw_tail_call)
                stack_needed += 8;