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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AE8BC433ED for ; Wed, 12 May 2021 21:50:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F076461028 for ; Wed, 12 May 2021 21:50:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242189AbhELVvQ (ORCPT ); Wed, 12 May 2021 17:51:16 -0400 Received: from www62.your-server.de ([213.133.104.62]:46736 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241781AbhELU63 (ORCPT ); Wed, 12 May 2021 16:58:29 -0400 Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lgvuQ-000FjQ-J8; Wed, 12 May 2021 22:56:46 +0200 Received: from [85.7.101.30] (helo=linux.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgvuQ-000Rj0-9d; Wed, 12 May 2021 22:56:46 +0200 Subject: Re: [PATCH bpf-next] bpf: arm64: Replace STACK_ALIGN() with round_up() to align stack size To: Tiezhu Yang , Alexei Starovoitov , Zi Shen Lim , Catalin Marinas , Will Deacon , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1620651119-5663-1-git-send-email-yangtiezhu@loongson.cn> From: Daniel Borkmann Message-ID: Date: Wed, 12 May 2021 22:56:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1620651119-5663-1-git-send-email-yangtiezhu@loongson.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.2/26168/Wed May 12 13:07:33 2021) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 5/10/21 2:51 PM, Tiezhu Yang wrote: > Use the common function round_up() directly to show the align size > explicitly, the function STACK_ALIGN() is needless, remove it. > > Signed-off-by: Tiezhu Yang > --- > arch/arm64/net/bpf_jit_comp.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c > index f7b1948..81c380f 100644 > --- a/arch/arm64/net/bpf_jit_comp.c > +++ b/arch/arm64/net/bpf_jit_comp.c > @@ -178,9 +178,6 @@ static bool is_addsub_imm(u32 imm) > return !(imm & ~0xfff) || !(imm & ~0xfff000); > } > > -/* Stack must be multiples of 16B */ > -#define STACK_ALIGN(sz) (((sz) + 15) & ~15) > - > /* Tail call offset to jump into */ > #if IS_ENABLED(CONFIG_ARM64_BTI_KERNEL) > #define PROLOGUE_OFFSET 8 > @@ -255,7 +252,7 @@ static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf) > emit(A64_BTI_J, ctx); > } > > - ctx->stack_size = STACK_ALIGN(prog->aux->stack_depth); > + ctx->stack_size = round_up(prog->aux->stack_depth, 16); > Applied, thanks! (I retained the comment wrt stack requirement to have it explicitly stated.)