BPF List
 help / color / mirror / Atom feed
From: George Guo <dongtai.guo@linux.dev>
To: yangtiezhu@loongson.cn
Cc: chenhuacai@kernel.org, hengqi.chen@gmail.com, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, kernel@xen0n.name,
	martin.lau@linux.dev, eddyz87@gmail.com, memxor@gmail.com,
	song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
	guodongtai@kylinos.cn, bpf@vger.kernel.org,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 01/11] LoongArch: BPF: Fix tail call count pointer offset for arena programs
Date: Tue,  7 Jul 2026 17:43:54 +0800	[thread overview]
Message-ID: <20260707094354.319438-1-dongtai.guo@linux.dev> (raw)
In-Reply-To: <d7f2c8d3-4a46-e978-5cce-f59b84e632f0@loongson.cn>

Hi Tiezhu,
Thanks for reviewing!

> This introduces a runtime helper to dynamically calculate the stack
> offset. If another optional slot is introduced in the future, this
> helper will need further adjustments.

Fair -- that's exactly the tradeoff. This patch was written to be the
minimal, obviously-correct fix on top of the existing layout (arena slot
above tcc/tcc_ptr) so it could go to the bpf tree as a standalone,
backportable fix. It does mean any future optional slot needs another
"if (...)" in the helper, as you say.

> Please see the following simple and long-term solution, just move
> the arena slot below TCC context slots, this ensures a constant
> offset, reducing complex runtime calculations and eliminating extra
> instructions.
>
>   LoongArch: BPF: Optimize redundant TCC loads in epilogue
>   https://lore.kernel.org/loongarch/20260630022705.11536-2-yangtiezhu@loongson.cn/
>
>   LoongArch: BPF: Move arena register slot below TCC context
>   https://lore.kernel.org/loongarch/20260630022705.11536-3-yangtiezhu@loongson.cn/

I read through both -- the reordering is a nice fix: with the arena slot
moved below tcc_ptr instead of above it, tcc_ptr's offset from $fp stays
a fixed 80 regardless of arena, so the original hardcoded macro is
correct again everywhere and the runtime branch goes away entirely.
Agreed that's the better long-term shape.

One thing to work out: this series (patch 5, exceptions/bpf_throw) also
needs an optional extra slot for exception programs, using the same
mechanism as arena (it currently piggybacks on the same
`ctx->arena_vm_start || is_exception_prog` check your patch 2/4 would
replace). If your reordering lands, I'd extend it the same way --
moving the exception-program slot below tcc_ptr too, rather than adding
a runtime check back in.

Where does your series stand? I'd rather rebase this patch series on
top of your fixed-offset approach once it's in bpf-next than have both
land and immediately conflict. Let me know what's the best way to
sequence these.

Thanks,
George

  reply	other threads:[~2026-07-07  9:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  2:23 [PATCH bpf-next v2 00/11] LoongArch: BPF: arena features, exceptions, private stack and may_goto George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 01/11] LoongArch: BPF: Fix tail call count pointer offset for arena programs George Guo
2026-07-02  2:35   ` sashiko-bot
2026-07-06  4:55   ` Tiezhu Yang
2026-07-07  9:43     ` George Guo [this message]
2026-07-07 10:12       ` Tiezhu Yang
2026-07-02  2:23 ` [PATCH bpf-next v2 02/11] LoongArch: BPF: Support internal-only MOV to resolve per-CPU addrs George Guo
2026-07-06  6:46   ` Tiezhu Yang
2026-07-07 10:22     ` George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 03/11] LoongArch: BPF: Add timed may_goto support George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 04/11] LoongArch: BPF: Add private stack support George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 05/11] LoongArch: BPF: Add exceptions (bpf_throw) support George Guo
2026-07-02  2:39   ` sashiko-bot
2026-07-02  2:23 ` [PATCH bpf-next v2 06/11] LoongArch: BPF: Support sign-extending loads from arena George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 07/11] LoongArch: BPF: Support atomics on arena pointers George Guo
2026-07-02  2:48   ` sashiko-bot
2026-07-06  7:06   ` Tiezhu Yang
2026-07-07 10:55     ` George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 08/11] selftests/bpf: Enable struct_ops private stack test for LoongArch George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 09/11] selftests/bpf: Enable arena LDSX tests on LoongArch George Guo
2026-07-02  2:23 ` [PATCH bpf-next v2 10/11] selftests/bpf: Enable arena atomics " George Guo
2026-07-02  2:49   ` sashiko-bot
2026-07-02  2:23 ` [PATCH bpf-next v2 11/11] selftests/bpf: Add LoongArch deny list George Guo
2026-07-06  6:37   ` Tiezhu Yang
2026-07-03 10:11 ` [PATCH bpf-next v2 00/11] LoongArch: BPF: arena features, exceptions, private stack and may_goto Huacai Chen
2026-07-06  7:15 ` Tiezhu Yang
2026-07-07 11:25   ` George Guo

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=20260707094354.319438-1-dongtai.guo@linux.dev \
    --to=dongtai.guo@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=guodongtai@kylinos.cn \
    --cc=hengqi.chen@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    --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