From nobody Mon Apr 6 12:18:30 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 6FBACD27E; Thu, 19 Mar 2026 15:40:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773934852; cv=none; b=sBQtR4MWsPe7p1OG/TniMcQYjgzUxCSmJaoK0+UkED4Ld1Xxi9xgR8b74vtnSVRhjowDiq0hFLYSKYeNJjq5fP8mxY00yBlfmsy0eGC5FpNOE3djJwde1bGPjo9QgWM0xCsOa/5difMiBMQ1G72n+q0PtmuZZPspnQ9JhZKI6Gc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773934852; c=relaxed/simple; bh=zbaPJrcFeBfd6ic1mIDKYe6pu5kM/gUQS6M2I/ZCfmc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WhY0ykqj7KJI0ufv61F8D33CCPPETH4P9yVOupdFnl/rQH/g4JWrqX2mQGSScc6mnpGcxLeqsiDRfRolIMOZ33eBMBacIUVCTOyC7mWabtQOvAgI5YXGXKah8a/t3ID2VyBOxxCg+GzvxcBuCacqZEbeZssEjHrm+WqEf639V1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=S0621tZm; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="S0621tZm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773934852; x=1805470852; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=zbaPJrcFeBfd6ic1mIDKYe6pu5kM/gUQS6M2I/ZCfmc=; b=S0621tZmY3qrs5vt5rNm0f73koe+87BxLsJdWhSVhFZSMwhG0zgeoV9I iYEtNbd6RXKSmbkNQ+rTlW5OK7CfGxzlN3Oxx8cFY4vhLcsgbEE7VIdz/ KbtVC7TBRqXI89jcS9RexynJ/1FcNJaQboBnln0+T9XiKGn5hbzbefIiq Q4CcFHjles9FpYqAkl08WOR+uQKUmdKAjFl55VNUAAWv11Oi+NmQpodNK swkYtFYxWx+ZxTWfPU5C9UoMZxwjZTj6G2fyQxPY/zcrf68CO503HKH6L 2VfiV/8Ag7HVRzjp+Dhc9+ZYiy2+y/nLq+pHOfW1/LbB/Po972hznFXvN g==; X-CSE-ConnectionGUID: O5RaFb59RKqaeRqc2Jpr/w== X-CSE-MsgGUID: RGMMKjndRf+N6u4xrrlRrg== X-IronPort-AV: E=McAfee;i="6800,10657,11734"; a="86487864" X-IronPort-AV: E=Sophos;i="6.23,129,1770624000"; d="scan'208";a="86487864" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2026 08:40:51 -0700 X-CSE-ConnectionGUID: 28xHweTYQZuiowPonGdLEA== X-CSE-MsgGUID: aYMKjJf5S+qS84XteWAzpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,129,1770624000"; d="scan'208";a="227694563" Received: from guptapa-desk.jf.intel.com (HELO desk) ([10.165.239.46]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2026 08:40:49 -0700 Date: Thu, 19 Mar 2026 08:40:49 -0700 From: Pawan Gupta To: x86@kernel.org, Nikolay Borisov , "H. Peter Anvin" , Josh Poimboeuf , David Kaplan , Sean Christopherson , Borislav Petkov , Dave Hansen , Peter Zijlstra , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , KP Singh , Jiri Olsa , "David S. Miller" , David Laight , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , David Ahern , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , Stanislav Fomichev , Hao Luo , Paolo Bonzini , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Asit Mallick , Tao Zhang , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v7 03/10] x86/bhi: Rename clear_bhb_loop() to clear_bhb_loop_nofence() Message-ID: <20260319-vmscape-bhb-v7-3-b76a777a98af@linux.intel.com> X-Mailer: b4 0.15-dev References: <20260319-vmscape-bhb-v7-0-b76a777a98af@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260319-vmscape-bhb-v7-0-b76a777a98af@linux.intel.com> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To reflect the recent change that moved LFENCE to the caller side. Suggested-by: Borislav Petkov Signed-off-by: Pawan Gupta Reviewed-by: Nikolay Borisov --- arch/x86/entry/entry_64.S | 8 ++++---- arch/x86/include/asm/nospec-branch.h | 6 +++--- arch/x86/net/bpf_jit_comp.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 8128e00ca73f..e9b81b95fcc8 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -1532,7 +1532,7 @@ SYM_CODE_END(rewind_stack_and_make_dead) * Note, callers should use a speculation barrier like LFENCE immediately = after * a call to this function to ensure BHB is cleared before indirect branch= es. */ -SYM_FUNC_START(clear_bhb_loop) +SYM_FUNC_START(clear_bhb_loop_nofence) ANNOTATE_NOENDBR push %rbp /* BPF caller may require %rax to be preserved */ @@ -1579,6 +1579,6 @@ SYM_FUNC_START(clear_bhb_loop) pop %rax pop %rbp RET -SYM_FUNC_END(clear_bhb_loop) -EXPORT_SYMBOL_FOR_KVM(clear_bhb_loop) -STACK_FRAME_NON_STANDARD(clear_bhb_loop) +SYM_FUNC_END(clear_bhb_loop_nofence) +EXPORT_SYMBOL_FOR_KVM(clear_bhb_loop_nofence) +STACK_FRAME_NON_STANDARD(clear_bhb_loop_nofence) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/no= spec-branch.h index 70b377fcbc1c..0f5e6ed6c9c2 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -331,11 +331,11 @@ =20 #ifdef CONFIG_X86_64 .macro CLEAR_BRANCH_HISTORY - ALTERNATIVE "", "call clear_bhb_loop; lfence", X86_FEATURE_CLEAR_BHB_LOOP + ALTERNATIVE "", "call clear_bhb_loop_nofence; lfence", X86_FEATURE_CLEAR_= BHB_LOOP .endm =20 .macro CLEAR_BRANCH_HISTORY_VMEXIT - ALTERNATIVE "", "call clear_bhb_loop; lfence", X86_FEATURE_CLEAR_BHB_VMEX= IT + ALTERNATIVE "", "call clear_bhb_loop_nofence; lfence", X86_FEATURE_CLEAR_= BHB_VMEXIT .endm #else #define CLEAR_BRANCH_HISTORY @@ -389,7 +389,7 @@ extern void entry_untrain_ret(void); extern void write_ibpb(void); =20 #ifdef CONFIG_X86_64 -extern void clear_bhb_loop(void); +extern void clear_bhb_loop_nofence(void); #endif =20 extern void (*x86_return_thunk)(void); diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index e2cceabb23e8..b57e9ab51c5d 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -1614,7 +1614,7 @@ static int emit_spectre_bhb_barrier(u8 **pprog, u8 *i= p, u8 *func; =20 if (cpu_feature_enabled(X86_FEATURE_CLEAR_BHB_LOOP)) { - func =3D (u8 *)clear_bhb_loop; + func =3D (u8 *)clear_bhb_loop_nofence; ip +=3D x86_call_depth_emit_accounting(&prog, func, ip); =20 if (emit_call(&prog, func, ip)) --=20 2.34.1