[PATCH bpf-next v2 4/4] riscv, bpf: Mixing bpf2bpf and tailcalls

Björn Töpel bjorn at kernel.org
Thu Feb 1 02:10:55 PST 2024


Pu Lehui <pulehui at 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



More information about the linux-riscv mailing list