Re: [PATCH v5 4/6] arch/x86/kvm: Refactor L1D flushing
From: kbuild test robot
Date: Tue May 05 2020 - 09:30:01 EST
Hi Balbir,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/auto-latest]
[also build test WARNING on linus/master v5.7-rc4 next-20200505]
[cannot apply to kvm/linux-next tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Balbir-Singh/Optionally-flush-L1D-on-context-switch/20200505-044116
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 9a31ac1743a00b816d5393acf61ce16713d319a1
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
cppcheck warnings: (new ones prefixed by >>)
>> arch/x86/kernel/l1d_flush.c:7:8: warning: Local variable 'l1d_flush_pages' shadows outer variable [shadowVariable]
void *l1d_flush_pages = NULL;
^
arch/x86/kernel/l1d_flush.c:83:14: note: Shadowed declaration
static void *l1d_flush_pages;
^
arch/x86/kernel/l1d_flush.c:7:8: note: Shadow variable
void *l1d_flush_pages = NULL;
^
vim +/l1d_flush_pages +7 arch/x86/kernel/l1d_flush.c
5228007f200e15 Balbir Singh 2020-05-04 3
604f3d173bf63d Balbir Singh 2020-05-04 4 static void *l1d_flush_alloc_pages(void)
5228007f200e15 Balbir Singh 2020-05-04 5 {
5228007f200e15 Balbir Singh 2020-05-04 6 struct page *page;
5228007f200e15 Balbir Singh 2020-05-04 @7 void *l1d_flush_pages = NULL;
5228007f200e15 Balbir Singh 2020-05-04 8 int i;
5228007f200e15 Balbir Singh 2020-05-04 9
5228007f200e15 Balbir Singh 2020-05-04 10 /*
5228007f200e15 Balbir Singh 2020-05-04 11 * This allocation for l1d_flush_pages is not tied to a VM/task's
5228007f200e15 Balbir Singh 2020-05-04 12 * lifetime and so should not be charged to a memcg.
5228007f200e15 Balbir Singh 2020-05-04 13 */
5228007f200e15 Balbir Singh 2020-05-04 14 page = alloc_pages(GFP_KERNEL, L1D_CACHE_ORDER);
5228007f200e15 Balbir Singh 2020-05-04 15 if (!page)
5228007f200e15 Balbir Singh 2020-05-04 16 return NULL;
5228007f200e15 Balbir Singh 2020-05-04 17 l1d_flush_pages = page_address(page);
5228007f200e15 Balbir Singh 2020-05-04 18
5228007f200e15 Balbir Singh 2020-05-04 19 /*
5228007f200e15 Balbir Singh 2020-05-04 20 * Initialize each page with a different pattern in
5228007f200e15 Balbir Singh 2020-05-04 21 * order to protect against KSM in the nested
5228007f200e15 Balbir Singh 2020-05-04 22 * virtualization case.
5228007f200e15 Balbir Singh 2020-05-04 23 */
5228007f200e15 Balbir Singh 2020-05-04 24 for (i = 0; i < 1u << L1D_CACHE_ORDER; ++i) {
5228007f200e15 Balbir Singh 2020-05-04 25 memset(l1d_flush_pages + i * PAGE_SIZE, i + 1,
5228007f200e15 Balbir Singh 2020-05-04 26 PAGE_SIZE);
5228007f200e15 Balbir Singh 2020-05-04 27 }
5228007f200e15 Balbir Singh 2020-05-04 28 return l1d_flush_pages;
5228007f200e15 Balbir Singh 2020-05-04 29 }
5228007f200e15 Balbir Singh 2020-05-04 30
:::::: The code at line 7 was first introduced by commit
:::::: 5228007f200e157bfc7a4add32def7c7f32c0550 arch/x86/kvm: Refactor l1d flush lifecycle management
:::::: TO: Balbir Singh <sblbir@xxxxxxxxxx>
:::::: CC: 0day robot <lkp@xxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx