[luto:x86/mm 1/7] arch/x86/include/asm/mmu_context.h:95:46: error: 'cpu_tlbstate' undeclared

From: kernel test robot
Date: Wed Sep 29 2021 - 23:23:17 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git x86/mm
head: e69827244c2f1e534aa83a40334ffa00bafe54c2
commit: f11196dfb449b51be4cf583fa343b90e20f95d48 [1/7] x86/ldt: Refactor the LDT loading functions
config: x86_64-rhel-8.3-kselftests (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?id=f11196dfb449b51be4cf583fa343b90e20f95d48
git remote add luto https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git
git fetch --no-tags luto x86/mm
git checkout f11196dfb449b51be4cf583fa343b90e20f95d48
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

In file included from include/asm-generic/percpu.h:7,
from arch/x86/include/asm/percpu.h:390,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from arch/x86/include/asm/mmu.h:5,
from arch/x86/include/asm/desc.h:7,
from arch/x86/include/asm/mmu_context.h:5,
from include/linux/mmu_context.h:5,
from drivers/gpu/drm/i915/gem/i915_gem_userptr.c:7:
arch/x86/include/asm/mmu_context.h: In function 'load_ldt_if_present':
>> arch/x86/include/asm/mmu_context.h:95:46: error: 'cpu_tlbstate' undeclared (first use in this function)
95 | return load_mm_ldt_if_present(this_cpu_read(cpu_tlbstate.loaded_mm));
| ^~~~~~~~~~~~
include/linux/percpu-defs.h:318:9: note: in definition of macro '__pcpu_size_call_return'
318 | typeof(variable) pscr_ret__; \
| ^~~~~~~~
arch/x86/include/asm/mmu_context.h:95:32: note: in expansion of macro 'this_cpu_read'
95 | return load_mm_ldt_if_present(this_cpu_read(cpu_tlbstate.loaded_mm));
| ^~~~~~~~~~~~~
arch/x86/include/asm/mmu_context.h:95:46: note: each undeclared identifier is reported only once for each function it appears in
95 | return load_mm_ldt_if_present(this_cpu_read(cpu_tlbstate.loaded_mm));
| ^~~~~~~~~~~~
include/linux/percpu-defs.h:318:9: note: in definition of macro '__pcpu_size_call_return'
318 | typeof(variable) pscr_ret__; \
| ^~~~~~~~
arch/x86/include/asm/mmu_context.h:95:32: note: in expansion of macro 'this_cpu_read'
95 | return load_mm_ldt_if_present(this_cpu_read(cpu_tlbstate.loaded_mm));
| ^~~~~~~~~~~~~
>> include/linux/percpu-defs.h:317:2: warning: passing argument 1 of 'load_mm_ldt_if_present' makes pointer from integer without a cast [-Wint-conversion]
317 | ({ \
| ~^~~~~~~~~~~
| |
| int
318 | typeof(variable) pscr_ret__; \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319 | __verify_pcpu_ptr(&(variable)); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
320 | switch(sizeof(variable)) { \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
321 | case 1: pscr_ret__ = stem##1(variable); break; \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322 | case 2: pscr_ret__ = stem##2(variable); break; \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323 | case 4: pscr_ret__ = stem##4(variable); break; \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324 | case 8: pscr_ret__ = stem##8(variable); break; \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325 | default: \
| ~~~~~~~~~~~~~~~~
326 | __bad_size_call_parameter(); break; \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
327 | } \
| ~~~~~~~~~~
328 | pscr_ret__; \
| ~~~~~~~~~~~~~~~~~~~
329 | })
| ~~
include/linux/percpu-defs.h:507:29: note: in expansion of macro '__pcpu_size_call_return'
507 | #define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp)
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/mmu_context.h:95:32: note: in expansion of macro 'this_cpu_read'
95 | return load_mm_ldt_if_present(this_cpu_read(cpu_tlbstate.loaded_mm));
| ^~~~~~~~~~~~~
In file included from include/linux/mmu_context.h:5,
from drivers/gpu/drm/i915/gem/i915_gem_userptr.c:7:
arch/x86/include/asm/mmu_context.h:83:61: note: expected 'struct mm_struct *' but argument is of type 'int'
83 | static inline bool load_mm_ldt_if_present(struct mm_struct *mm)
| ~~~~~~~~~~~~~~~~~~^~


vim +/cpu_tlbstate +95 arch/x86/include/asm/mmu_context.h

79
80 #ifdef CONFIG_MODIFY_LDT_SYSCALL
81 extern void load_ldt_struct(struct ldt_struct *ldt);
82 extern void switch_ldt(struct mm_struct *prev, struct mm_struct *next);
83 static inline bool load_mm_ldt_if_present(struct mm_struct *mm)
84 {
85 struct ldt_struct *ldt = smp_load_acquire(&mm->context.ldt);
86
87 if (likely(!ldt))
88 return false;
89
90 load_ldt_struct(ldt);
91 return true;
92 }
93 static inline bool load_ldt_if_present(void)
94 {
> 95 return load_mm_ldt_if_present(this_cpu_read(cpu_tlbstate.loaded_mm));
96 }
97 #else
98 static inline bool load_mm_ldt_if_present(struct mm_struct *mm) { return false; }
99 static inline bool load_ldt_if_present(void) { return false; }
100 static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next)
101 {
102 DEBUG_LOCKS_WARN_ON(preemptible());
103 }
104 #endif
105

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip