From: Pu Lehui <pulehui@huawei.com>
To: Xiao Wang <xiao.w.wang@intel.com>, <paul.walmsley@sifive.com>,
<palmer@dabbelt.com>, <aou@eecs.berkeley.edu>,
<luke.r.nels@gmail.com>, <xi.wang@gmail.com>, <bjorn@kernel.org>
Cc: <ast@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
<martin.lau@linux.dev>, <eddyz87@gmail.com>, <song@kernel.org>,
<yonghong.song@linux.dev>, <john.fastabend@gmail.com>,
<kpsingh@kernel.org>, <sdf@google.com>, <haoluo@google.com>,
<jolsa@kernel.org>, <linux-riscv@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org>,
<haicheng.li@intel.com>
Subject: Re: [PATCH] riscv, bpf: Use STACK_ALIGN macro for size rounding up
Date: Wed, 22 May 2024 14:29:55 +0800 [thread overview]
Message-ID: <af4cf420-558a-4893-8469-c354d3e337eb@huawei.com> (raw)
In-Reply-To: <20240522054507.3941595-1-xiao.w.wang@intel.com>
On 2024/5/22 13:45, Xiao Wang wrote:
> Use the macro STACK_ALIGN that is defined in asm/processor.h for stack size
> rounding up, just like bpf_jit_comp32.c does.
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
> arch/riscv/net/bpf_jit_comp64.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> index 39149ad002da..bd869d41612f 100644
> --- a/arch/riscv/net/bpf_jit_comp64.c
> +++ b/arch/riscv/net/bpf_jit_comp64.c
> @@ -858,7 +858,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
> stack_size += 8;
> sreg_off = stack_size;
>
> - stack_size = round_up(stack_size, 16);
> + stack_size = round_up(stack_size, STACK_ALIGN);
>
> if (!is_struct_ops) {
> /* For the trampoline called from function entry,
> @@ -1723,7 +1723,7 @@ void bpf_jit_build_prologue(struct rv_jit_context *ctx, bool is_subprog)
> {
> int i, stack_adjust = 0, store_offset, bpf_stack_adjust;
>
> - bpf_stack_adjust = round_up(ctx->prog->aux->stack_depth, 16);
> + bpf_stack_adjust = round_up(ctx->prog->aux->stack_depth, STACK_ALIGN);
> if (bpf_stack_adjust)
> mark_fp(ctx);
>
> @@ -1743,7 +1743,7 @@ void bpf_jit_build_prologue(struct rv_jit_context *ctx, bool is_subprog)
> if (seen_reg(RV_REG_S6, ctx))
> stack_adjust += 8;
>
> - stack_adjust = round_up(stack_adjust, 16);
> + stack_adjust = round_up(stack_adjust, STACK_ALIGN);
> stack_adjust += bpf_stack_adjust;
>
> store_offset = stack_adjust - 8;
Reviewed-by: Pu Lehui <pulehui@huawei.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-05-22 6:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 5:45 [PATCH] riscv, bpf: Use STACK_ALIGN macro for size rounding up Xiao Wang
2024-05-22 6:29 ` Pu Lehui [this message]
2024-05-23 1:42 ` Pu Lehui
2024-05-23 3:11 ` Wang, Xiao W
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=af4cf420-558a-4893-8469-c354d3e337eb@huawei.com \
--to=pulehui@huawei.com \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haicheng.li@intel.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luke.r.nels@gmail.com \
--cc=martin.lau@linux.dev \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=xi.wang@gmail.com \
--cc=xiao.w.wang@intel.com \
--cc=yonghong.song@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox