2021-01-16 03:25:25

by kernel test robot

[permalink] [raw]
Subject: [tip:x86/pti 4/5] arch/x86/mm/tlb.c:319:6: warning: variable 'cpu' set but not used

tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/pti
head: 767d46ab566dd489733666efe48732d523c8c332
commit: b6724f118d44606fddde391ba7527526b3cad211 [4/5] prctl: Hook L1D flushing in via prctl
config: i386-randconfig-r026-20210115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=b6724f118d44606fddde391ba7527526b3cad211
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip x86/pti
git checkout b6724f118d44606fddde391ba7527526b3cad211
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

arch/x86/mm/tlb.c: In function 'enable_l1d_flush_for_task':
>> arch/x86/mm/tlb.c:319:6: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
319 | int cpu, ret = 0, i;
| ^~~


vim +/cpu +319 arch/x86/mm/tlb.c

316
317 int enable_l1d_flush_for_task(struct task_struct *tsk)
318 {
> 319 int cpu, ret = 0, i;
320
321 /*
322 * Do not enable L1D_FLUSH_OUT if
323 * b. The CPU is not affected by the L1TF bug
324 * c. The CPU does not have L1D FLUSH feature support
325 * c. The task's affinity is on cores with SMT on.
326 */
327
328 if (!boot_cpu_has_bug(X86_BUG_L1TF) ||
329 !static_cpu_has(X86_FEATURE_FLUSH_L1D))
330 return -EINVAL;
331
332 cpu = get_cpu();
333
334 for_each_cpu(i, &tsk->cpus_mask) {
335 if (cpu_data(i).smt_active == true) {
336 put_cpu();
337 return -EINVAL;
338 }
339 }
340
341 set_ti_thread_flag(&tsk->thread_info, TIF_SPEC_L1D_FLUSH);
342 put_cpu();
343 return ret;
344 }
345

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.09 kB)
.config.gz (34.06 kB)
Download all attachments

2021-01-20 12:04:14

by Singh, Balbir

[permalink] [raw]
Subject: Re: [tip:x86/pti 4/5] arch/x86/mm/tlb.c:319:6: warning: variable 'cpu' set but not used

On Sat, 2021-01-16 at 11:21 +0800, kernel test robot wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/pti
> head: 767d46ab566dd489733666efe48732d523c8c332
> commit: b6724f118d44606fddde391ba7527526b3cad211 [4/5] prctl: Hook L1D flushing in via prctl
> config: i386-randconfig-r026-20210115 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> reproduce (this is a W=1 build):
> # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=b6724f118d44606fddde391ba7527526b3cad211
> git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> git fetch --no-tags tip x86/pti
> git checkout b6724f118d44606fddde391ba7527526b3cad211
> # save the attached .config to linux build tree
> make W=1 ARCH=i386
>

There is a newer revision of the patches posted at
https://lore.kernel.org/lkml/[email protected]/T/

which should not have this problem/issue.

Balbir Singh.