[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0541b782-5289-426a-ad76-83ad4b3a3d6c@suse.com>
Date: Thu, 20 Nov 2025 18:58:52 +0200
From: Nikolay Borisov <nik.borisov@...e.com>
To: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
Cc: x86@...nel.org, David Kaplan <david.kaplan@....com>,
"H. Peter Anvin" <hpa@...or.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, Asit Mallick <asit.k.mallick@...el.com>,
Tao Zhang <tao1.zhang@...el.com>
Subject: Re: [PATCH v4 01/11] x86/bhi: x86/vmscape: Move LFENCE out of
clear_bhb_loop()
On 11/20/25 18:56, Pawan Gupta wrote:
> On Thu, Nov 20, 2025 at 06:15:32PM +0200, Nikolay Borisov wrote:
>>
>>
>> On 11/20/25 08:17, Pawan Gupta wrote:
>>> Currently, BHB clearing sequence is followed by an LFENCE to prevent
>>> transient execution of subsequent indirect branches prematurely. However,
>>> LFENCE barrier could be unnecessary in certain cases. For example, when
>>> kernel is using BHI_DIS_S mitigation, and BHB clearing is only needed for
>>> userspace. In such cases, LFENCE is redundant because ring transitions
>>> would provide the necessary serialization.
>>>
>>> Below is a quick recap of BHI mitigation options:
>>>
>>> On Alder Lake and newer
>>>
>>> - BHI_DIS_S: Hardware control to mitigate BHI in ring0. This has low
>>> performance overhead.
>>> - Long loop: Alternatively, longer version of BHB clearing sequence
>>> on older processors can be used to mitigate BHI. This
>>> is not yet implemented in Linux.
>>
>> I find this description of the Long loop on "ALder lake and newer" somewhat
>> confusing, as you are also referring "older processors". Shouldn't the
>> longer sequence bet moved under "On older CPUs" heading? Or perhaps it must
>> be expanded to say that the long sequence could work on Alder Lake and newer
>> CPUs as well as on older cpus?
>
> Ya, it needs to be rephrased. Would dropping "on older processors" help?
>
> - Long loop: Alternatively, longer version of BHB clearing sequence
> can be used to mitigate BHI. This is not yet implemented
> in Linux.
>
nit: Perhaps a sentence about why long loop version might be used on
newer parts in certain cases or why it shouldn't.
>>>
>>> On older CPUs
>>>
>>> - Short loop: Clears BHB at kernel entry and VMexit.
>
> And also talk about "Long loop" effectiveness here:
>
> On older CPUs
>
> - Short loop: Clears BHB at kernel entry and VMexit. The "Long loop"
> is effective on older CPUs as well, but should be avoided
> because of unnecessary overhead.
>> <snip>
In any case it's much better and indeed clear!
Reviewed-by: Nikolay Borisov <nik.borisov@...e.com>
Powered by blists - more mailing lists