lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <TYZPR03MB880148D071B32806DBB1ACFFD1E52@TYZPR03MB8801.apcprd03.prod.outlook.com>
Date: Sat, 18 Jan 2025 11:29:36 +0800
From: Ethan Zhao <etzhao@...look.com>
To: "H. Peter Anvin" <hpa@...or.com>,
 Ethan Zhao <haifeng.zhao@...ux.intel.com>, Xin Li <xin@...or.com>,
 linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: tglx@...utronix.de, dave.hansen@...ux.intel.com, x86@...nel.org,
 andrew.cooper3@...rix.com, mingo@...hat.com, bp@...en8.de
Subject: Re: [PATCH] x86/fred: Optimize the FRED entry by prioritizing
 high-probability event dispatching


On 1/18/2025 12:24 AM, H. Peter Anvin wrote:
>>
>> In short, seems that __builtin_expect not work with switch(), at 
>> least for
>>   gcc version 8.5.0 20210514(RHEL).
>>
>
> For forward-facing optimizations, please don't use an ancient version 
> of gcc as the benchmark.

Even there is a latest Gcc built-in feature could work for this case, it 
is highly unlikely that Linus would adopt such trick into upstream 
kernel (only works for specific ver compiler). the same resultto those 
downstream vendors/LTS kernels. thus, making an optimization with latest 
only Gcc would construct an impractical benchmark-only performance 
barrier. As to the __builtin_expect(), my understanding, it was designed 
to only work for if(bool value) {
}
else if(bool value) {
} The value of the condition expression returned by __builtin_expect() 
is a bool const. while switch(variable) expects a variable. so it is 
normal for Gcc that it doesn't work with it.

If I got something wrong, please let me know.

Thanks,
Ethan

>
>     -hpa
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ