linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Pu Lehui <pulehui@huaweicloud.com>,
	bpf@vger.kernel.org, linux-riscv@lists.infradead.org,
	netdev@vger.kernel.org
Cc: Song Liu <song@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>,
	Luke Nelson <luke.r.nels@gmail.com>,
	Pu Lehui <pulehui@huawei.com>
Subject: Re: [PATCH bpf-next v2 4/4] riscv, bpf: Mixing bpf2bpf and tailcalls
Date: Thu, 01 Feb 2024 11:10:55 +0100	[thread overview]
Message-ID: <878r44mr4g.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <fab22b9e-7b56-4fef-ba92-bf62ec43007d@huaweicloud.com>

Pu Lehui <pulehui@huaweicloud.com> writes:

>>> @@ -252,10 +220,7 @@ static void __build_epilogue(bool is_tail_call, struct rv_jit_context *ctx)
>>>   		emit_ld(RV_REG_S5, store_offset, RV_REG_SP, ctx);
>>>   		store_offset -= 8;
>>>   	}
>>> -	if (seen_reg(RV_REG_S6, ctx)) {
>>> -		emit_ld(RV_REG_S6, store_offset, RV_REG_SP, ctx);
>>> -		store_offset -= 8;
>>> -	}
>>> +	emit_ld(RV_REG_TCC, store_offset, RV_REG_SP, ctx);
>> 
>> Why do you need to restore RV_REG_TCC? We're passing RV_REG_TCC (a6) as
>> an argument at all call-sites, and for tailcalls we're loading from the
>> stack.
>> 
>> Is this to fake the a6 argument for the tail-call? If so, it's better to
>> move it to emit_bpf_tail_call(), instead of letting all programs pay for
>> it.
>
> Yes, we can remove this duplicate load. will do that at next version.

Hmm, no remove, but *move* right? Otherwise a6 can contain gargabe on
entering the tailcall?

Move it before __emit_epilogue() in the tailcall, no?


Björn

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2024-02-01 10:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30  4:09 [PATCH bpf-next v2 0/4] Mixing bpf2bpf and tailcalls for RV64 Pu Lehui
2024-01-30  4:09 ` [PATCH bpf-next v2 1/4] riscv, bpf: Remove redundant ctx->offset initialization Pu Lehui
2024-01-30 16:04   ` Björn Töpel
2024-01-30  4:09 ` [PATCH bpf-next v2 2/4] riscv, bpf: Using kvcalloc to allocate cache buffer Pu Lehui
2024-01-30 16:05   ` Björn Töpel
2024-01-30  4:09 ` [PATCH bpf-next v2 3/4] riscv, bpf: Add RV_TAILCALL_OFFSET macro to format tailcall offset Pu Lehui
2024-01-30 16:05   ` Björn Töpel
2024-01-30  4:09 ` [PATCH bpf-next v2 4/4] riscv, bpf: Mixing bpf2bpf and tailcalls Pu Lehui
2024-01-30 17:30   ` Björn Töpel
2024-02-01  8:22     ` Pu Lehui
2024-02-01 10:10       ` Björn Töpel [this message]
2024-02-01 12:10         ` Pu Lehui
2024-02-01 13:35           ` Björn Töpel
2024-02-02  9:44             ` Pu Lehui
2024-02-02 13:04               ` Björn Töpel

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=878r44mr4g.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=luke.r.nels@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=pulehui@huawei.com \
    --cc=pulehui@huaweicloud.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).