Re: [PATCH 0/6] Introduce CET supervisor state support
From: Yang, Weijiang
Date: Mon Jul 08 2024 - 23:18:28 EST
Hi, maintainers,
I recently did some tests for this series, the benchmark is here:
https://github.com/antonblanchard/will-it-scale/blob/master/tests/context_switch1.c
The purpose is to check what's the overall performance impact in thread/process context-
switch when CET supervisor state bit, i.e., RFBM[12], is fixed with 0 or 1 in xsaves/xrstors.
3 cases are tested:
case 1: stock v6.10-rc1 kernel.
case 2: v6.10-rc1 kernel + this patch series so that RFBM[12] == 0 for normal thread/process.
case 3: v6.10-rc1 kernel + this patch series and with patch 3(Introduce XFEATURE_MASK_KERNEL_DYNAMIC
xfeature set) reverted so that RFBM[12] == 1 for normal thread process.
Run below command 10 times in each case:
./context_switch1_processes -s 20 -t 50 -n
Trim the results by removing the top and down 10% of the data in each case, and I got below numbers:
case 1:16444675.45Set as 1
case 2:16412285.61~99.80%
case 3:16405716.19~99.76%
As you can see from the results, in case 2 with optimization based on XFEATURE_MASK_KERNEL_DYNAMIC,
the performance gain is ~0.2%.
So I'm not sure whether XFEATURE_MASK_KERNEL_DYNAMIC and related changes are worth or not
for this series.
Could you share your thoughts?
Thanks a lot!