Re: [PATCH -next V13 4/7] riscv: entry: Convert to generic entry

From: Guo Ren
Date: Sat Jan 07 2023 - 09:07:23 EST


Yes, these are caused by W=1, and I would wait a while to update the
next version of the patchset.

Here is the fix:

diff --git a/arch/riscv/include/asm/asm-prototypes.h
b/arch/riscv/include/asm/asm-prototypes.h
index ef386fcf3939..61ba8ed43d8f 100644
--- a/arch/riscv/include/asm/asm-prototypes.h
+++ b/arch/riscv/include/asm/asm-prototypes.h
@@ -27,5 +27,7 @@ DECLARE_DO_ERROR_INFO(do_trap_break);

asmlinkage unsigned long get_overflow_stack(void);
asmlinkage void handle_bad_stack(struct pt_regs *regs);
+asmlinkage void do_page_fault(struct pt_regs *regs);
+asmlinkage void do_irq(struct pt_regs *regs);

#endif /* _ASM_RISCV_PROTOTYPES_H */
diff --git a/arch/riscv/include/asm/entry-common.h
b/arch/riscv/include/asm/entry-common.h
index 994ed48e8eb8..6e4dee49d84b 100644
--- a/arch/riscv/include/asm/entry-common.h
+++ b/arch/riscv/include/asm/entry-common.h
@@ -5,6 +5,7 @@

#include <asm/stacktrace.h>

-extern void handle_page_fault(struct pt_regs *regs);
+void handle_page_fault(struct pt_regs *regs);
+void handle_break(struct pt_regs *regs);

#endif /* _ASM_RISCV_ENTRY_COMMON_H */
diff --git a/arch/riscv/kernel/head.h b/arch/riscv/kernel/head.h
index 726731ada534..a556fdaafed9 100644
--- a/arch/riscv/kernel/head.h
+++ b/arch/riscv/kernel/head.h
@@ -10,7 +10,6 @@

extern atomic_t hart_lottery;

-asmlinkage void do_page_fault(struct pt_regs *regs);
asmlinkage void __init setup_vm(uintptr_t dtb_pa);
#ifdef CONFIG_XIP_KERNEL
asmlinkage void __init __copy_data(void);
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index a7b6bd0df497..2e365084417e 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -12,6 +12,7 @@
#include <linux/syscalls.h>
#include <linux/resume_user_mode.h>
#include <linux/linkage.h>
+#include <linux/entry-common.h>

#include <asm/ucontext.h>
#include <asm/vdso.h>
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index e04593c6cfe3..a44e7d15311c 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -15,6 +15,7 @@
#include <linux/uaccess.h>
#include <linux/kprobes.h>
#include <linux/kfence.h>
+#include <linux/entry-common.h>

#include <asm/ptrace.h>
#include <asm/tlbflush.h>
~

On Sat, Jan 7, 2023 at 8:58 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on next-20230106]
>
> url: https://github.com/intel-lab-lkp/linux/commits/guoren-kernel-org/compiler_types-h-Add-__noinstr_section-for-noinstr/20230107-194127
> patch link: https://lore.kernel.org/r/20230107113838.3969149-5-guoren%40kernel.org
> patch subject: [PATCH -next V13 4/7] riscv: entry: Convert to generic entry
> config: riscv-allyesconfig
> compiler: riscv64-linux-gcc (GCC) 12.1.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
> # https://github.com/intel-lab-lkp/linux/commit/82d3616db033b052abe2dc3b1481ef5ce474b7ab
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review guoren-kernel-org/compiler_types-h-Add-__noinstr_section-for-noinstr/20230107-194127
> git checkout 82d3616db033b052abe2dc3b1481ef5ce474b7ab
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/kernel/ arch/riscv/mm/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> >> arch/riscv/kernel/signal.c:277:6: warning: no previous prototype for 'arch_do_signal_or_restart' [-Wmissing-prototypes]
> 277 | void arch_do_signal_or_restart(struct pt_regs *regs)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> --
> >> arch/riscv/kernel/traps.c:196:6: warning: no previous prototype for 'handle_break' [-Wmissing-prototypes]
> 196 | void handle_break(struct pt_regs *regs)
> | ^~~~~~~~~~~~
> arch/riscv/kernel/traps.c:264:35: warning: no previous prototype for 'do_page_fault' [-Wmissing-prototypes]
> 264 | asmlinkage __visible noinstr void do_page_fault(struct pt_regs *regs)
> | ^~~~~~~~~~~~~
> arch/riscv/kernel/traps.c:275:35: warning: no previous prototype for 'do_irq' [-Wmissing-prototypes]
> 275 | asmlinkage __visible noinstr void do_irq(struct pt_regs *regs)
> | ^~~~~~
> --
> >> arch/riscv/mm/fault.c:207:6: warning: no previous prototype for 'handle_page_fault' [-Wmissing-prototypes]
> 207 | void handle_page_fault(struct pt_regs *regs)
> | ^~~~~~~~~~~~~~~~~
>
>
> vim +/arch_do_signal_or_restart +277 arch/riscv/kernel/signal.c
>
> 276
> > 277 void arch_do_signal_or_restart(struct pt_regs *regs)
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests



--
Best Regards
Guo Ren