From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07629219EB for ; Sat, 10 Jan 2026 03:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768016459; cv=none; b=tYX/pRuqIKkUtAus9vJcSe2nw03uyJGtXQMNjfXvFqMaPLCn0TWjF3gHT+Qx2ExGn2Z2O1UL0oErfHdMI6P1NuXSDbWm0+tBDyKkggbcbqi186cENNStTD5hI8iAxvI/0Xq85INLHX3RirSke4HMDKKWAFRYF9Lz/m1BKyUaKXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768016459; c=relaxed/simple; bh=JVxVb23sXUov+716rIr+xlZVWmJ/DHEGP/0PemsgZ8c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lLfe7pN10sdJpn8DNY1obF33UbUVrjYJD8Z+ZdmaoEXHjydBKz6pnZDL0bvkJ+9AbQjdYE/y4UzEC5+E+2E1KC1co30zCOC6HKbSkbwC8zyBlkPzkCqOz11206+Z8AeVm751uzDLaCwZK2lolRETCVQ6rLRx/evdyJhJFSGXivk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=qPPsMkkU; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="qPPsMkkU" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1768016456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=az6dRvvu+knJTaqIBy2vbsedGP1eSuAz0pkWOXUEOs8=; b=qPPsMkkULTYPYrJrq3ipPK35kpAaUhDPHV5nP2nlH0uY8oAZq8F9siZ84dEMzSrMIjbCw0 gVNnE9fxTa2Tv6UicZt7vjI3Z3ktVb7p5Oyfy3NzuIi5HWyISHiZfJLtPoCqRqvqaJwAIs q/plvplOVh7xVJgIgs33N2HnPnEVFks= From: Menglong Dong To: Menglong Dong , Alexei Starovoitov Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Eduard , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , David Ahern , Thomas Gleixner , Ingo Molnar , jiang.biao@linux.dev, Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , bpf , Network Development , LKML Subject: Re: [PATCH bpf-next v8 06/11] bpf,x86: introduce emit_st_r0_imm64() for trampoline Date: Sat, 10 Jan 2026 11:40:29 +0800 Message-ID: <1950001.tdWV9SEqCh@7950hx> In-Reply-To: References: <20260108022450.88086-1-dongml2@chinatelecom.cn> <20260108022450.88086-7-dongml2@chinatelecom.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Migadu-Flow: FLOW_OUT On 2026/1/10 10:45, Alexei Starovoitov wrote: > On Wed, Jan 7, 2026 at 6:26=E2=80=AFPM Menglong Dong wrote: > > > > Introduce the helper emit_st_r0_imm64(), which is used to store a imm64= to > > the stack with the help of r0. > > > > Signed-off-by: Menglong Dong > > --- > > arch/x86/net/bpf_jit_comp.c | 15 +++++++++++---- > > 1 file changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > > index e3b1c4b1d550..a87304161d45 100644 > > --- a/arch/x86/net/bpf_jit_comp.c > > +++ b/arch/x86/net/bpf_jit_comp.c > > @@ -1300,6 +1300,15 @@ static void emit_st_r12(u8 **pprog, u32 size, u3= 2 dst_reg, int off, int imm) > > emit_st_index(pprog, size, dst_reg, X86_REG_R12, off, imm); > > } > > > > +static void emit_st_r0_imm64(u8 **pprog, u64 value, int off) > > +{ > > + /* mov rax, value > > + * mov QWORD PTR [rbp - off], rax > > + */ > > + emit_mov_imm64(pprog, BPF_REG_0, value >> 32, (u32) value); > > + emit_stx(pprog, BPF_DW, BPF_REG_FP, BPF_REG_0, -off); > > +} >=20 > The name is cryptic. > How about emit_store_stack_imm64(pprog, stack_off, imm64) ? > or emit_mov_stack_imm64. emit_store_stack_imm64() sounds fine. I'll use it in the next version. Thanks! Menglong Dong >=20 >=20