diff mbox series

[v2,05/23] arm64: use asm-generic/mmu_context.h for no-op implementations

Message ID 20200826145249.745432-6-npiggin@gmail.com (mailing list archive)
State New, archived
Headers show
Series Use asm-generic for mmu_context no-op functions | expand

Commit Message

Nicholas Piggin Aug. 26, 2020, 2:52 p.m. UTC
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/arm64/include/asm/mmu_context.h | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Catalin Marinas Aug. 26, 2020, 3:25 p.m. UTC | #1
On Thu, Aug 27, 2020 at 12:52:31AM +1000, Nicholas Piggin wrote:
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Nicholas Piggin Aug. 26, 2020, 4:20 p.m. UTC | #2
Excerpts from Catalin Marinas's message of August 27, 2020 1:25 am:
> On Thu, Aug 27, 2020 at 12:52:31AM +1000, Nicholas Piggin wrote:
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> 
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> 

Thank you, I see I stupidly mis-rebased this patch too :( Sorry
I'll fix that.

Thanks,
Nick
kernel test robot Aug. 26, 2020, 6:42 p.m. UTC | #3
Hi Nicholas,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.9-rc2 next-20200826]
[cannot apply to sparc/master asm-generic/master sparc-next/master xtensa/for_next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200826-225632
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ac69819ba9e3d8d550bb5d2d2df74848e556812
config: arm64-randconfig-r013-20200826 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

   In file included from arch/arm64/kernel/process.c:54:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/process.c: At top level:
   arch/arm64/kernel/process.c:260:6: warning: no previous prototype for '__show_regs' [-Wmissing-prototypes]
     260 | void __show_regs(struct pt_regs *regs)
         |      ^~~~~~~~~~~
   arch/arm64/kernel/process.c:352:5: warning: no previous prototype for 'arch_dup_task_struct' [-Wmissing-prototypes]
     352 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
         |     ^~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/process.c:554:41: warning: no previous prototype for '__switch_to' [-Wmissing-prototypes]
     554 | __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
         |                                         ^~~~~~~~~~~
   arch/arm64/kernel/process.c:692:25: warning: no previous prototype for 'arm64_preempt_schedule_irq' [-Wmissing-prototypes]
     692 | asmlinkage void __sched arm64_preempt_schedule_irq(void)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arm64/include/asm/efi.h:10,
                    from arch/arm64/kernel/setup.c:50:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arm64/kernel/cpu_errata.c:111:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c: At top level:
   arch/arm64/kernel/cpu_errata.c:295:13: warning: no previous prototype for 'arm64_update_smccc_conduit' [-Wmissing-prototypes]
     295 | void __init arm64_update_smccc_conduit(struct alt_instr *alt,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:317:13: warning: no previous prototype for 'arm64_enable_wa2_handling' [-Wmissing-prototypes]
     317 | void __init arm64_enable_wa2_handling(struct alt_instr *alt,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arm64/include/asm/kvm_mmu.h:90,
                    from arch/arm64/kernel/smp.c:43:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/smp.c: At top level:
   arch/arm64/kernel/smp.c:842:6: warning: no previous prototype for 'arch_irq_work_raise' [-Wmissing-prototypes]
     842 | void arch_irq_work_raise(void)
         |      ^~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/smp.c:863:6: warning: no previous prototype for 'panic_smp_self_stop' [-Wmissing-prototypes]
     863 | void panic_smp_self_stop(void)
         |      ^~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arm64/kernel/suspend.c:14:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/suspend.c: At top level:
   arch/arm64/kernel/suspend.c:32:13: warning: no previous prototype for 'cpu_suspend_set_dbg_restorer' [-Wmissing-prototypes]
      32 | void __init cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arm64/kernel/machine_kexec.c:21:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/machine_kexec.c: At top level:
   arch/arm64/kernel/machine_kexec.c:250:6: warning: no previous prototype for 'machine_crash_shutdown' [-Wmissing-prototypes]
     250 | void machine_crash_shutdown(struct pt_regs *regs)
         |      ^~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arm64/mm/context.c:16:
   arch/arm64/include/asm/mmu_context.h: In function '__switch_mm':
>> arch/arm64/include/asm/mmu_context.h:226:2: error: too few arguments to function 'check_and_switch_context'
     226 |  check_and_switch_context(next);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/mmu_context.h:177:6: note: declared here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/mm/context.c: At top level:
>> arch/arm64/mm/context.c:201:6: error: conflicting types for 'check_and_switch_context'
     201 | void check_and_switch_context(struct mm_struct *mm)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/arm64/mm/context.c:16:
   arch/arm64/include/asm/mmu_context.h:177:6: note: previous declaration of 'check_and_switch_context' was here
     177 | void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/b7168fc5046fd65223bdc51ef411e157939433b6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200826-225632
git checkout b7168fc5046fd65223bdc51ef411e157939433b6
vim +/check_and_switch_context +226 arch/arm64/include/asm/mmu_context.h

d96cc49bff5a77 Will Deacon     2017-12-06  214  
39bc88e5e38e9b Catalin Marinas 2016-09-02  215  static inline void __switch_mm(struct mm_struct *next)
39bc88e5e38e9b Catalin Marinas 2016-09-02  216  {
e53f21bce4d35a Catalin Marinas 2015-03-23  217  	/*
e53f21bce4d35a Catalin Marinas 2015-03-23  218  	 * init_mm.pgd does not contain any user mappings and it is always
e53f21bce4d35a Catalin Marinas 2015-03-23  219  	 * active for kernel addresses in TTBR1. Just set the reserved TTBR0.
e53f21bce4d35a Catalin Marinas 2015-03-23  220  	 */
e53f21bce4d35a Catalin Marinas 2015-03-23  221  	if (next == &init_mm) {
e53f21bce4d35a Catalin Marinas 2015-03-23  222  		cpu_set_reserved_ttbr0();
e53f21bce4d35a Catalin Marinas 2015-03-23  223  		return;
e53f21bce4d35a Catalin Marinas 2015-03-23  224  	}
e53f21bce4d35a Catalin Marinas 2015-03-23  225  
c4885bbb3afee8 Pingfan Liu     2020-07-10 @226  	check_and_switch_context(next);
b3901d54dc4f73 Catalin Marinas 2012-03-05  227  }
b3901d54dc4f73 Catalin Marinas 2012-03-05  228  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Aug. 26, 2020, 6:57 p.m. UTC | #4
Hi Nicholas,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.9-rc2 next-20200826]
[cannot apply to sparc/master asm-generic/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200826-225632
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ac69819ba9e3d8d550bb5d2d2df74848e556812
config: arm64-randconfig-r002-20200826 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

   In file included from arch/arm64/kernel/process.c:54:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/process.c:260:6: warning: no previous prototype for function '__show_regs' [-Wmissing-prototypes]
   void __show_regs(struct pt_regs *regs)
        ^
   arch/arm64/kernel/process.c:260:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __show_regs(struct pt_regs *regs)
   ^
   static 
   arch/arm64/kernel/process.c:352:5: warning: no previous prototype for function 'arch_dup_task_struct' [-Wmissing-prototypes]
   int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
       ^
   arch/arm64/kernel/process.c:352:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
   ^
   static 
   arch/arm64/kernel/process.c:554:41: warning: no previous prototype for function '__switch_to' [-Wmissing-prototypes]
   __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
                                           ^
   arch/arm64/kernel/process.c:554:21: note: declare 'static' if the function is not intended to be used outside of this translation unit
   __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
                       ^
                       static 
   arch/arm64/kernel/process.c:692:25: warning: no previous prototype for function 'arm64_preempt_schedule_irq' [-Wmissing-prototypes]
   asmlinkage void __sched arm64_preempt_schedule_irq(void)
                           ^
   arch/arm64/kernel/process.c:692:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
   asmlinkage void __sched arm64_preempt_schedule_irq(void)
              ^
              static 
   4 warnings and 1 error generated.
--
   In file included from arch/arm64/kernel/setup.c:50:
   In file included from arch/arm64/include/asm/efi.h:10:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   1 error generated.
--
   In file included from arch/arm64/kernel/cpu_errata.c:111:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/cpu_errata.c:295:13: warning: no previous prototype for function 'arm64_update_smccc_conduit' [-Wmissing-prototypes]
   void __init arm64_update_smccc_conduit(struct alt_instr *alt,
               ^
   arch/arm64/kernel/cpu_errata.c:295:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init arm64_update_smccc_conduit(struct alt_instr *alt,
   ^
   static 
   arch/arm64/kernel/cpu_errata.c:317:13: warning: no previous prototype for function 'arm64_enable_wa2_handling' [-Wmissing-prototypes]
   void __init arm64_enable_wa2_handling(struct alt_instr *alt,
               ^
   arch/arm64/kernel/cpu_errata.c:317:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init arm64_enable_wa2_handling(struct alt_instr *alt,
   ^
   static 
   arch/arm64/kernel/cpu_errata.c:747:3: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
                   ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:506:2: note: expanded from macro 'ERRATA_MIDR_REV_RANGE'
           ERRATA_MIDR_RANGE(m, var, r_min, var, r_max)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:498:2: note: expanded from macro 'ERRATA_MIDR_RANGE'
           CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:486:13: note: expanded from macro 'CAP_MIDR_RANGE'
           .matches = is_affected_midr_range,                      \
                      ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:746:14: note: previous initialization is here
                   .matches = is_affected_midr_range,
                              ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:753:3: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
                   ERRATA_MIDR_REV(MIDR_BRAHMA_B53, 0, 0),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:510:2: note: expanded from macro 'ERRATA_MIDR_REV'
           ERRATA_MIDR_RANGE(model, var, rev, var, rev)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:498:2: note: expanded from macro 'ERRATA_MIDR_RANGE'
           CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:486:13: note: expanded from macro 'CAP_MIDR_RANGE'
           .matches = is_affected_midr_range,                      \
                      ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:752:14: note: previous initialization is here
                   .matches = is_affected_midr_range,
                              ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:913:11: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
                   .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU |
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:912:3: note: previous initialization is here
                   ERRATA_MIDR_RANGE_LIST(erratum_1418040_list),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:519:10: note: expanded from macro 'ERRATA_MIDR_RANGE_LIST'
           .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,                 \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/cpufeature.h:258:2: note: expanded from macro 'ARM64_CPUCAP_LOCAL_CPU_ERRATUM'
           (ARM64_CPUCAP_SCOPE_LOCAL_CPU | ARM64_CPUCAP_OPTIONAL_FOR_LATE_CPU)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   5 warnings and 1 error generated.
--
   In file included from arch/arm64/kernel/smp.c:43:
   In file included from arch/arm64/include/asm/kvm_mmu.h:90:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/smp.c:842:6: warning: no previous prototype for function 'arch_irq_work_raise' [-Wmissing-prototypes]
   void arch_irq_work_raise(void)
        ^
   arch/arm64/kernel/smp.c:842:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void arch_irq_work_raise(void)
   ^
   static 
   arch/arm64/kernel/smp.c:863:6: warning: no previous prototype for function 'panic_smp_self_stop' [-Wmissing-prototypes]
   void panic_smp_self_stop(void)
        ^
   arch/arm64/kernel/smp.c:863:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void panic_smp_self_stop(void)
   ^
   static 
   arch/arm64/kernel/smp.c:1067:5: warning: no previous prototype for function 'setup_profiling_timer' [-Wmissing-prototypes]
   int setup_profiling_timer(unsigned int multiplier)
       ^
   arch/arm64/kernel/smp.c:1067:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int setup_profiling_timer(unsigned int multiplier)
   ^
   static 
   3 warnings and 1 error generated.
--
   In file included from arch/arm64/kernel/suspend.c:14:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/suspend.c:32:13: warning: no previous prototype for function 'cpu_suspend_set_dbg_restorer' [-Wmissing-prototypes]
   void __init cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
               ^
   arch/arm64/kernel/suspend.c:32:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from arch/arm64/kernel/machine_kexec.c:21:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/machine_kexec.c:250:6: warning: no previous prototype for function 'machine_crash_shutdown' [-Wmissing-prototypes]
   void machine_crash_shutdown(struct pt_regs *regs)
        ^
   arch/arm64/kernel/machine_kexec.c:250:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void machine_crash_shutdown(struct pt_regs *regs)
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from arch/arm64/mm/mmu.c:35:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/mm/mmu.c:1135:6: warning: no previous prototype for function 'vmemmap_free' [-Wmissing-prototypes]
   void vmemmap_free(unsigned long start, unsigned long end,
        ^
   arch/arm64/mm/mmu.c:1135:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void vmemmap_free(unsigned long start, unsigned long end,
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from arch/arm64/mm/context.c:16:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/mm/context.c:201:6: error: conflicting types for 'check_and_switch_context'
   void check_and_switch_context(struct mm_struct *mm)
        ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: previous declaration is here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   2 errors generated.
--
   In file included from arch/arm64/kvm/va_layout.c:13:
   In file included from arch/arm64/include/asm/kvm_mmu.h:90:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kvm/va_layout.c:137:6: warning: no previous prototype for function 'kvm_patch_vector_branch' [-Wmissing-prototypes]
   void kvm_patch_vector_branch(struct alt_instr *alt,
        ^
   arch/arm64/kvm/va_layout.c:137:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void kvm_patch_vector_branch(struct alt_instr *alt,
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from arch/arm64/kvm/handle_exit.c:19:
   In file included from arch/arm64/include/asm/kvm_mmu.h:90:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kvm/handle_exit.c:178:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_WFx]        = kvm_handle_wfx,
                                     ^~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:179:25: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_CP15_32]    = kvm_handle_cp15_32,
                                     ^~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:180:25: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_CP15_64]    = kvm_handle_cp15_64,
                                     ^~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:181:25: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_CP14_MR]    = kvm_handle_cp14_32,
                                     ^~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:182:25: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_CP14_LS]    = kvm_handle_cp14_load_store,
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:183:25: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_CP14_64]    = kvm_handle_cp14_64,
                                     ^~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:184:23: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_HVC32]      = handle_hvc,
                                     ^~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:185:23: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_SMC32]      = handle_smc,
                                     ^~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:186:23: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_HVC64]      = handle_hvc,
                                     ^~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:187:23: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_SMC64]      = handle_smc,
                                     ^~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:188:23: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_SYS64]      = kvm_handle_sys_reg,
                                     ^~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:189:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_SVE]        = handle_sve,
                                     ^~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:190:26: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_IABT_LOW]   = kvm_handle_guest_abort,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:191:26: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_DABT_LOW]   = kvm_handle_guest_abort,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:192:28: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_SOFTSTP_LOW]= kvm_handle_guest_debug,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,
                                     ^~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:193:28: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [ESR_ELx_EC_WATCHPT_LOW]= kvm_handle_guest_debug,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/handle_exit.c:177:27: note: previous initialization is here
           [0 ... ESR_ELx_EC_MAX]  = kvm_handle_unknown_ec,

# https://github.com/0day-ci/linux/commit/b7168fc5046fd65223bdc51ef411e157939433b6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200826-225632
git checkout b7168fc5046fd65223bdc51ef411e157939433b6
vim +226 arch/arm64/include/asm/mmu_context.h

d96cc49bff5a77 Will Deacon     2017-12-06  214  
39bc88e5e38e9b Catalin Marinas 2016-09-02  215  static inline void __switch_mm(struct mm_struct *next)
39bc88e5e38e9b Catalin Marinas 2016-09-02  216  {
e53f21bce4d35a Catalin Marinas 2015-03-23  217  	/*
e53f21bce4d35a Catalin Marinas 2015-03-23  218  	 * init_mm.pgd does not contain any user mappings and it is always
e53f21bce4d35a Catalin Marinas 2015-03-23  219  	 * active for kernel addresses in TTBR1. Just set the reserved TTBR0.
e53f21bce4d35a Catalin Marinas 2015-03-23  220  	 */
e53f21bce4d35a Catalin Marinas 2015-03-23  221  	if (next == &init_mm) {
e53f21bce4d35a Catalin Marinas 2015-03-23  222  		cpu_set_reserved_ttbr0();
e53f21bce4d35a Catalin Marinas 2015-03-23  223  		return;
e53f21bce4d35a Catalin Marinas 2015-03-23  224  	}
e53f21bce4d35a Catalin Marinas 2015-03-23  225  
c4885bbb3afee8 Pingfan Liu     2020-07-10 @226  	check_and_switch_context(next);
b3901d54dc4f73 Catalin Marinas 2012-03-05  227  }
b3901d54dc4f73 Catalin Marinas 2012-03-05  228  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Aug. 26, 2020, 11:55 p.m. UTC | #5
Hi Nicholas,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.9-rc2 next-20200826]
[cannot apply to sparc/master asm-generic/master sparc-next/master xtensa/for_next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200826-225632
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ac69819ba9e3d8d550bb5d2d2df74848e556812
config: arm64-randconfig-r036-20200826 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

   In file included from arch/arm64/mm/mmu.c:35:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   1 error generated.
--
   In file included from arch/arm64/mm/context.c:16:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
>> arch/arm64/mm/context.c:201:6: error: conflicting types for 'check_and_switch_context'
   void check_and_switch_context(struct mm_struct *mm)
        ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: previous declaration is here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   2 errors generated.
--
   In file included from arch/arm64/kernel/process.c:54:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/process.c:260:6: warning: no previous prototype for function '__show_regs' [-Wmissing-prototypes]
   void __show_regs(struct pt_regs *regs)
        ^
   arch/arm64/kernel/process.c:260:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __show_regs(struct pt_regs *regs)
   ^
   static 
   arch/arm64/kernel/process.c:352:5: warning: no previous prototype for function 'arch_dup_task_struct' [-Wmissing-prototypes]
   int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
       ^
   arch/arm64/kernel/process.c:352:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
   ^
   static 
   arch/arm64/kernel/process.c:554:41: warning: no previous prototype for function '__switch_to' [-Wmissing-prototypes]
   __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
                                           ^
   arch/arm64/kernel/process.c:554:21: note: declare 'static' if the function is not intended to be used outside of this translation unit
   __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
                       ^
                       static 
   arch/arm64/kernel/process.c:692:25: warning: no previous prototype for function 'arm64_preempt_schedule_irq' [-Wmissing-prototypes]
   asmlinkage void __sched arm64_preempt_schedule_irq(void)
                           ^
   arch/arm64/kernel/process.c:692:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
   asmlinkage void __sched arm64_preempt_schedule_irq(void)
              ^
              static 
   4 warnings and 1 error generated.
--
   In file included from arch/arm64/kernel/cpu_errata.c:111:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/cpu_errata.c:295:13: warning: no previous prototype for function 'arm64_update_smccc_conduit' [-Wmissing-prototypes]
   void __init arm64_update_smccc_conduit(struct alt_instr *alt,
               ^
   arch/arm64/kernel/cpu_errata.c:295:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init arm64_update_smccc_conduit(struct alt_instr *alt,
   ^
   static 
   arch/arm64/kernel/cpu_errata.c:317:13: warning: no previous prototype for function 'arm64_enable_wa2_handling' [-Wmissing-prototypes]
   void __init arm64_enable_wa2_handling(struct alt_instr *alt,
               ^
   arch/arm64/kernel/cpu_errata.c:317:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init arm64_enable_wa2_handling(struct alt_instr *alt,
   ^
   static 
   arch/arm64/kernel/cpu_errata.c:747:3: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
                   ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:506:2: note: expanded from macro 'ERRATA_MIDR_REV_RANGE'
           ERRATA_MIDR_RANGE(m, var, r_min, var, r_max)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:498:2: note: expanded from macro 'ERRATA_MIDR_RANGE'
           CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:486:13: note: expanded from macro 'CAP_MIDR_RANGE'
           .matches = is_affected_midr_range,                      \
                      ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:746:14: note: previous initialization is here
                   .matches = is_affected_midr_range,
                              ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:753:3: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
                   ERRATA_MIDR_REV(MIDR_BRAHMA_B53, 0, 0),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:510:2: note: expanded from macro 'ERRATA_MIDR_REV'
           ERRATA_MIDR_RANGE(model, var, rev, var, rev)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:498:2: note: expanded from macro 'ERRATA_MIDR_RANGE'
           CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:486:13: note: expanded from macro 'CAP_MIDR_RANGE'
           .matches = is_affected_midr_range,                      \
                      ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:752:14: note: previous initialization is here
                   .matches = is_affected_midr_range,
                              ^~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:938:14: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
                   .matches = needs_tx2_tvm_workaround,
                              ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:937:3: note: previous initialization is here
                   ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:520:2: note: expanded from macro 'ERRATA_MIDR_RANGE_LIST'
           CAP_MIDR_RANGE_LIST(midr_list)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kernel/cpu_errata.c:501:13: note: expanded from macro 'CAP_MIDR_RANGE_LIST'
           .matches = is_affected_midr_range_list,                 \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   5 warnings and 1 error generated.
--
   In file included from arch/arm64/kernel/smp.c:43:
   In file included from arch/arm64/include/asm/kvm_mmu.h:90:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/smp.c:842:6: warning: no previous prototype for function 'arch_irq_work_raise' [-Wmissing-prototypes]
   void arch_irq_work_raise(void)
        ^
   arch/arm64/kernel/smp.c:842:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void arch_irq_work_raise(void)
   ^
   static 
   arch/arm64/kernel/smp.c:863:6: warning: no previous prototype for function 'panic_smp_self_stop' [-Wmissing-prototypes]
   void panic_smp_self_stop(void)
        ^
   arch/arm64/kernel/smp.c:863:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void panic_smp_self_stop(void)
   ^
   static 
   2 warnings and 1 error generated.
--
   In file included from arch/arm64/kernel/suspend.c:14:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/suspend.c:32:13: warning: no previous prototype for function 'cpu_suspend_set_dbg_restorer' [-Wmissing-prototypes]
   void __init cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
               ^
   arch/arm64/kernel/suspend.c:32:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from arch/arm64/kernel/machine_kexec.c:21:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   arch/arm64/kernel/machine_kexec.c:250:6: warning: no previous prototype for function 'machine_crash_shutdown' [-Wmissing-prototypes]
   void machine_crash_shutdown(struct pt_regs *regs)
        ^
   arch/arm64/kernel/machine_kexec.c:250:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void machine_crash_shutdown(struct pt_regs *regs)
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from kernel/fork.c:101:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   kernel/fork.c:743:20: warning: no previous prototype for function 'arch_task_cache_init' [-Wmissing-prototypes]
   void __init __weak arch_task_cache_init(void) { }
                      ^
   kernel/fork.c:743:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init __weak arch_task_cache_init(void) { }
   ^
   static 
   kernel/fork.c:834:12: warning: no previous prototype for function 'arch_dup_task_struct' [-Wmissing-prototypes]
   int __weak arch_dup_task_struct(struct task_struct *dst,
              ^
   kernel/fork.c:834:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int __weak arch_dup_task_struct(struct task_struct *dst,
   ^
   static 
   2 warnings and 1 error generated.
--
   In file included from kernel/sched/core.c:13:
   In file included from kernel/sched/sched.h:54:
   In file included from include/linux/mmu_context.h:5:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   kernel/sched/core.c:2380:6: warning: no previous prototype for function 'sched_set_stop_task' [-Wmissing-prototypes]
   void sched_set_stop_task(int cpu, struct task_struct *stop)
        ^
   kernel/sched/core.c:2380:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void sched_set_stop_task(int cpu, struct task_struct *stop)
   ^
   static 
   kernel/sched/core.c:4635:35: warning: no previous prototype for function 'schedule_user' [-Wmissing-prototypes]
   asmlinkage __visible void __sched schedule_user(void)
                                     ^
   kernel/sched/core.c:4635:22: note: declare 'static' if the function is not intended to be used outside of this translation unit
   asmlinkage __visible void __sched schedule_user(void)
                        ^
                        static 
   2 warnings and 1 error generated.
--
   In file included from kernel/sched/fair.c:23:
   In file included from kernel/sched/sched.h:54:
   In file included from include/linux/mmu_context.h:5:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   kernel/sched/fair.c:5364:6: warning: no previous prototype for function 'init_cfs_bandwidth' [-Wmissing-prototypes]
   void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
        ^
   kernel/sched/fair.c:5364:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
   ^
   static 
   kernel/sched/fair.c:11108:6: warning: no previous prototype for function 'free_fair_sched_group' [-Wmissing-prototypes]
   void free_fair_sched_group(struct task_group *tg) { }
        ^
   kernel/sched/fair.c:11108:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void free_fair_sched_group(struct task_group *tg) { }
   ^
   static 
   kernel/sched/fair.c:11110:5: warning: no previous prototype for function 'alloc_fair_sched_group' [-Wmissing-prototypes]
   int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
       ^
   kernel/sched/fair.c:11110:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
   ^
   static 
   kernel/sched/fair.c:11115:6: warning: no previous prototype for function 'online_fair_sched_group' [-Wmissing-prototypes]
   void online_fair_sched_group(struct task_group *tg) { }
        ^
   kernel/sched/fair.c:11115:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void online_fair_sched_group(struct task_group *tg) { }
   ^
   static 
   kernel/sched/fair.c:11117:6: warning: no previous prototype for function 'unregister_fair_sched_group' [-Wmissing-prototypes]
   void unregister_fair_sched_group(struct task_group *tg) { }
        ^
   kernel/sched/fair.c:11117:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void unregister_fair_sched_group(struct task_group *tg) { }
   ^
   static 
   5 warnings and 1 error generated.
--
   In file included from kernel/sched/rt.c:6:
   In file included from kernel/sched/sched.h:54:
   In file included from include/linux/mmu_context.h:5:
>> arch/arm64/include/asm/mmu_context.h:226:31: error: too few arguments to function call, expected 2, have 1
           check_and_switch_context(next);
           ~~~~~~~~~~~~~~~~~~~~~~~~     ^
   arch/arm64/include/asm/mmu_context.h:177:6: note: 'check_and_switch_context' declared here
   void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
        ^
   kernel/sched/rt.c:253:6: warning: no previous prototype for function 'free_rt_sched_group' [-Wmissing-prototypes]
   void free_rt_sched_group(struct task_group *tg) { }
        ^
   kernel/sched/rt.c:253:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void free_rt_sched_group(struct task_group *tg) { }
   ^
   static 
   kernel/sched/rt.c:255:5: warning: no previous prototype for function 'alloc_rt_sched_group' [-Wmissing-prototypes]
   int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
       ^
   kernel/sched/rt.c:255:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
   ^
   static 
   kernel/sched/rt.c:668:6: warning: no previous prototype for function 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
   bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
        ^
   kernel/sched/rt.c:668:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
   ^
   static 
   3 warnings and 1 error generated.

# https://github.com/0day-ci/linux/commit/b7168fc5046fd65223bdc51ef411e157939433b6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nicholas-Piggin/Use-asm-generic-for-mmu_context-no-op-functions/20200826-225632
git checkout b7168fc5046fd65223bdc51ef411e157939433b6
vim +226 arch/arm64/include/asm/mmu_context.h

d96cc49bff5a77 Will Deacon     2017-12-06  214  
39bc88e5e38e9b Catalin Marinas 2016-09-02  215  static inline void __switch_mm(struct mm_struct *next)
39bc88e5e38e9b Catalin Marinas 2016-09-02  216  {
e53f21bce4d35a Catalin Marinas 2015-03-23  217  	/*
e53f21bce4d35a Catalin Marinas 2015-03-23  218  	 * init_mm.pgd does not contain any user mappings and it is always
e53f21bce4d35a Catalin Marinas 2015-03-23  219  	 * active for kernel addresses in TTBR1. Just set the reserved TTBR0.
e53f21bce4d35a Catalin Marinas 2015-03-23  220  	 */
e53f21bce4d35a Catalin Marinas 2015-03-23  221  	if (next == &init_mm) {
e53f21bce4d35a Catalin Marinas 2015-03-23  222  		cpu_set_reserved_ttbr0();
e53f21bce4d35a Catalin Marinas 2015-03-23  223  		return;
e53f21bce4d35a Catalin Marinas 2015-03-23  224  	}
e53f21bce4d35a Catalin Marinas 2015-03-23  225  
c4885bbb3afee8 Pingfan Liu     2020-07-10 @226  	check_and_switch_context(next);
b3901d54dc4f73 Catalin Marinas 2012-03-05  227  }
b3901d54dc4f73 Catalin Marinas 2012-03-05  228  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Naresh Kamboju Oct. 27, 2020, 9:59 a.m. UTC | #6
On Wed, 26 Aug 2020 at 21:50, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Excerpts from Catalin Marinas's message of August 27, 2020 1:25 am:
> > On Thu, Aug 27, 2020 at 12:52:31AM +1000, Nicholas Piggin wrote:
> >> Cc: Catalin Marinas <catalin.marinas@arm.com>
> >> Cc: Will Deacon <will@kernel.org>
> >> Cc: linux-arm-kernel@lists.infradead.org
> >> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> >
> > Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> >
>
> Thank you, I see I stupidly mis-rebased this patch too :( Sorry
> I'll fix that.

arm64 build error caused due to this patch on linux next 20201027 tag.

make -sk KBUILD_BUILD_USER=TuxBuild -C/linux ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build defconfig
#
#
#
set -e
cd /linux
export ARCH=arm64
export HOSTCC=gcc
export CC=gcc
export CROSS_COMPILE=aarch64-linux-gnu-
scripts/kconfig/merge_config.sh -O build 'build/.config' 'build/frag.config'
#
#
# make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j16 ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build Image
#
In file included from ../arch/arm64/include/asm/mmu_context.h:257,
                 from ../arch/arm64/include/asm/efi.h:10,
                 from ../arch/arm64/xen/../../arm/xen/enlighten.c:19:
../include/asm-generic/mmu_context.h:34:19: error: redefinition of
‘init_new_context’
   34 | static inline int init_new_context(struct task_struct *tsk,
      |                   ^~~~~~~~~~~~~~~~
In file included from ../arch/arm64/include/asm/efi.h:10,
                 from ../arch/arm64/xen/../../arm/xen/enlighten.c:19:
../arch/arm64/include/asm/mmu_context.h:180:1: note: previous
definition of ‘init_new_context’ was here
  180 | init_new_context(struct task_struct *tsk, struct mm_struct *mm)
      | ^~~~~~~~~~~~~~~~
make[3]: *** [../scripts/Makefile.build:283:
arch/arm64/xen/../../arm/xen/enlighten.o] Error 1
In file included from ../arch/arm64/include/asm/mmu_context.h:257,
                 from ../include/linux/mmu_context.h:5,
                 from ../kernel/sched/sched.h:54,
                 from ../kernel/sched/core.c:13:
../include/asm-generic/mmu_context.h:34:19: error: redefinition of
‘init_new_context’
   34 | static inline int init_new_context(struct task_struct *tsk,
      |                   ^~~~~~~~~~~~~~~~
In file included from ../include/linux/mmu_context.h:5,
                 from ../kernel/sched/sched.h:54,
                 from ../kernel/sched/core.c:13:
../arch/arm64/include/asm/mmu_context.h:180:1: note: previous
definition of ‘init_new_context’ was here
  180 | init_new_context(struct task_struct *tsk, struct mm_struct *mm)
      | ^~~~~~~~~~~~~~~~
make[3]: *** [../scripts/Makefile.build:283: kernel/sched/core.o] Error 1


Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>

full build log link,
https://gitlab.com/Linaro/lkft/mirrors/next/linux-next/-/jobs/813497297
Arnd Bergmann Oct. 27, 2020, 3:08 p.m. UTC | #7
On Tue, Oct 27, 2020 at 10:59 AM Naresh Kamboju
<naresh.kamboju@linaro.org> wrote:
> On Wed, 26 Aug 2020 at 21:50, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
>
> full build log link,
> https://gitlab.com/Linaro/lkft/mirrors/next/linux-next/-/jobs/813497297

Thanks for the report. I added a one-line fix into the original commit,
as it was my mistake during rebasing: Nick's version was fine, but
48118151d8cc ("arm64: mm: Pin down ASIDs for sharing mm with devices")
turned a macro into an inline function, which makde it no
longer override the generic version.

     Arnd
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index f2d7537d6f83..765e8a0f88c9 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -174,8 +174,7 @@  static inline void cpu_replace_ttbr1(pgd_t *pgdp)
  * Setting a reserved TTBR0 or EPD0 would work, but it all gets ugly when you
  * take CPU migration into account.
  */
-#define destroy_context(mm)		do { } while(0)
-void check_and_switch_context(struct mm_struct *mm);
+void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
 
 #define init_new_context(tsk,mm)	({ atomic64_set(&(mm)->context.id, 0); 0; })
 
@@ -202,6 +201,7 @@  static inline void update_saved_ttbr0(struct task_struct *tsk,
 }
 #endif
 
+#define enter_lazy_tlb enter_lazy_tlb
 static inline void
 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
@@ -242,12 +242,11 @@  switch_mm(struct mm_struct *prev, struct mm_struct *next,
 	update_saved_ttbr0(tsk, next);
 }
 
-#define deactivate_mm(tsk,mm)	do { } while (0)
-#define activate_mm(prev,next)	switch_mm(prev, next, current)
-
 void verify_cpu_asid_bits(void);
 void post_ttbr_update_workaround(void);
 
+#include <asm-generic/mmu_context.h>
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* !__ASM_MMU_CONTEXT_H */