arch/sparc/include/asm/mmu_context_64.h:22:37: error: unknown type name 'per_cpu_secondary_mm'

From: kbuild test robot
Date: Sat Sep 23 2017 - 21:01:40 EST


Hi Felix,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cd4175b11685b11c40e31a03e05084cc212b0649
commit: 70539bd79500245cbb4c7af00572fcce540d0105 drm/amd: Update MEC HQD loading code for KFD
date: 6 weeks ago
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 70539bd79500245cbb4c7af00572fcce540d0105
# save the attached .config to linux build tree
make.cross ARCH=sparc64

All errors (new ones prefixed by >>):

In file included from arch/sparc/include/asm/mmu_context.h:4:0,
from include/linux/mmu_context.h:4,
from drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:29,
from drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:23:
>> arch/sparc/include/asm/mmu_context_64.h:22:37: error: unknown type name 'per_cpu_secondary_mm'
DECLARE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm);
^~~~~~~~~~~~~~~~~~~~
arch/sparc/include/asm/mmu_context_64.h: In function 'switch_mm':
>> arch/sparc/include/asm/mmu_context_64.h:79:12: error: implicit declaration of function 'smp_processor_id' [-Werror=implicit-function-declaration]
int cpu = smp_processor_id();
^~~~~~~~~~~~~~~~
>> arch/sparc/include/asm/mmu_context_64.h:81:2: error: implicit declaration of function 'per_cpu' [-Werror=implicit-function-declaration]
per_cpu(per_cpu_secondary_mm, cpu) = mm;
^~~~~~~
>> arch/sparc/include/asm/mmu_context_64.h:81:10: error: 'per_cpu_secondary_mm' undeclared (first use in this function)
per_cpu(per_cpu_secondary_mm, cpu) = mm;
^~~~~~~~~~~~~~~~~~~~
arch/sparc/include/asm/mmu_context_64.h:81:10: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors

vim +/per_cpu_secondary_mm +22 arch/sparc/include/asm/mmu_context_64.h

f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 21
7a5b4bbf4 arch/sparc/include/asm/mmu_context_64.h Pavel Tatashin 2017-05-31 @22 DECLARE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm);
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 23 void get_new_mmu_context(struct mm_struct *mm);
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 24 int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 25 void destroy_context(struct mm_struct *mm);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 26
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 27 void __tsb_context_switch(unsigned long pgd_pa,
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 28 struct tsb_config *tsb_base,
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 29 struct tsb_config *tsb_huge,
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 30 unsigned long tsb_descr_pa,
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 31 unsigned long secondary_ctx);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 32
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 33 static inline void tsb_context_switch_ctx(struct mm_struct *mm,
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 34 unsigned long ctx)
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 35 {
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 36 __tsb_context_switch(__pa(mm->pgd),
4bbc84ffd arch/sparc/include/asm/mmu_context_64.h Mike Kravetz 2016-12-19 37 &mm->context.tsb_block[MM_TSB_BASE],
9e695d2ec arch/sparc/include/asm/mmu_context_64.h David Miller 2012-10-08 38 #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
4bbc84ffd arch/sparc/include/asm/mmu_context_64.h Mike Kravetz 2016-12-19 39 (mm->context.tsb_block[MM_TSB_HUGE].tsb ?
4bbc84ffd arch/sparc/include/asm/mmu_context_64.h Mike Kravetz 2016-12-19 40 &mm->context.tsb_block[MM_TSB_HUGE] :
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 41 NULL)
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 42 #else
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 43 NULL
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 44 #endif
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 45 , __pa(&mm->context.tsb_descr[MM_TSB_BASE]),
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 46 ctx);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 47 }
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 48
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 49 #define tsb_context_switch(X) tsb_context_switch_ctx(X, 0)
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 50
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 51 void tsb_grow(struct mm_struct *mm,
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 52 unsigned long tsb_index,
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 53 unsigned long mm_rss);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 54 #ifdef CONFIG_SMP
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 55 void smp_tsb_sync(struct mm_struct *mm);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 56 #else
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 57 #define smp_tsb_sync(__mm) do { } while (0)
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 58 #endif
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 59
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 60 /* Set MMU context in the actual hardware. */
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 61 #define load_secondary_context(__mm) \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 62 __asm__ __volatile__( \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 63 "\n661: stxa %0, [%1] %2\n" \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 64 " .section .sun4v_1insn_patch, \"ax\"\n" \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 65 " .word 661b\n" \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 66 " stxa %0, [%1] %3\n" \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 67 " .previous\n" \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 68 " flush %%g6\n" \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 69 : /* No outputs */ \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 70 : "r" (CTX_HWBITS((__mm)->context)), \
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 71 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU))
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 72
f05a68653 arch/sparc/include/asm/mmu_context_64.h Sam Ravnborg 2014-05-16 73 void __flush_tlb_mm(unsigned long, unsigned long);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 74
07df84187 arch/sparc/include/asm/mmu_context_64.h Kirill Tkhai 2013-04-09 75 /* Switch the current MM context. */
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 76 static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 77 {
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 78 unsigned long ctx_valid, flags;
7a5b4bbf4 arch/sparc/include/asm/mmu_context_64.h Pavel Tatashin 2017-05-31 @79 int cpu = smp_processor_id();
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 80
7a5b4bbf4 arch/sparc/include/asm/mmu_context_64.h Pavel Tatashin 2017-05-31 @81 per_cpu(per_cpu_secondary_mm, cpu) = mm;
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 82 if (unlikely(mm == &init_mm))
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 83 return;
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 84
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 85 spin_lock_irqsave(&mm->context.lock, flags);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 86 ctx_valid = CTX_VALID(mm->context);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 87 if (!ctx_valid)
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 88 get_new_mmu_context(mm);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 89
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 90 /* We have to be extremely careful here or else we will miss
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 91 * a TSB grow if we switch back and forth between a kernel
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 92 * thread and an address space which has it's TSB size increased
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 93 * on another processor.
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 94 *
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 95 * It is possible to play some games in order to optimize the
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 96 * switch, but the safest thing to do is to unconditionally
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 97 * perform the secondary context load and the TSB context switch.
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 98 *
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 99 * For reference the bad case is, for address space "A":
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 100 *
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 101 * CPU 0 CPU 1
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 102 * run address space A
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 103 * set cpu0's bits in cpu_vm_mask
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 104 * switch to kernel thread, borrow
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 105 * address space A via entry_lazy_tlb
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 106 * run address space A
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 107 * set cpu1's bit in cpu_vm_mask
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 108 * flush_tlb_pending()
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 109 * reset cpu_vm_mask to just cpu1
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 110 * TSB grow
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 111 * run address space A
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 112 * context was valid, so skip
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 113 * TSB context switch
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 114 *
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 115 * At that point cpu0 continues to use a stale TSB, the one from
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 116 * before the TSB grow performed on cpu1. cpu1 did not cross-call
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 117 * cpu0 to update it's TSB because at that point the cpu_vm_mask
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 118 * only had cpu1 set in it.
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 119 */
fc290a114 arch/sparc/include/asm/mmu_context_64.h Rob Gardner 2017-07-17 120 tsb_context_switch_ctx(mm, CTX_HWBITS(mm->context));
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 121
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 122 /* Any time a processor runs a context on an address space
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 123 * for the first time, we must flush that context out of the
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 124 * local TLB.
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 125 */
81f1adf01 arch/sparc/include/asm/mmu_context_64.h Rusty Russell 2009-03-16 126 if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) {
81f1adf01 arch/sparc/include/asm/mmu_context_64.h Rusty Russell 2009-03-16 127 cpumask_set_cpu(cpu, mm_cpumask(mm));
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 128 __flush_tlb_mm(CTX_HWBITS(mm->context),
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 129 SECONDARY_CONTEXT);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 130 }
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 131 spin_unlock_irqrestore(&mm->context.lock, flags);
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 132 }
f5e706ad8 include/asm-sparc/mmu_context_64.h Sam Ravnborg 2008-07-17 133

:::::: The code at line 22 was first introduced by commit
:::::: 7a5b4bbf49fe86ce77488a70c5dccfe2d50d7a2d sparc64: add per-cpu mm of secondary contexts

:::::: TO: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip