diff mbox series

riscv: declare overflow_stack as exported from traps.c

Message ID 20231123134214.81481-1-ben.dooks@codethink.co.uk (mailing list archive)
State Accepted
Commit 2cf963787529f615f7c93bdcf13a5e82029e7f38
Headers show
Series riscv: declare overflow_stack as exported from traps.c | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-1-test-6 warning .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Ben Dooks Nov. 23, 2023, 1:42 p.m. UTC
The percpu area overflow_stacks is exported from arch/riscv/kernel/traps.c
for use in the entry code, but is not declared anywhere. Add the relevant
declaration to arch/riscv/include/asm/stacktrace.h to silence the following
sparse warning:

arch/riscv/kernel/traps.c:395:1: warning: symbol '__pcpu_scope_overflow_stack' was not declared. Should it be static?

We don't add the stackinfo_get_overflow() call as for some of the other
architectures as this doesn't seem to be used yet, so just silence the
warning.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/riscv/include/asm/stacktrace.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Conor Dooley Nov. 23, 2023, 1:51 p.m. UTC | #1
On Thu, Nov 23, 2023 at 01:42:14PM +0000, Ben Dooks wrote:
> The percpu area overflow_stacks is exported from arch/riscv/kernel/traps.c
> for use in the entry code, but is not declared anywhere. Add the relevant
> declaration to arch/riscv/include/asm/stacktrace.h to silence the following
> sparse warning:
> 
> arch/riscv/kernel/traps.c:395:1: warning: symbol '__pcpu_scope_overflow_stack' was not declared. Should it be static?
> 
> We don't add the stackinfo_get_overflow() call as for some of the other
> architectures as this doesn't seem to be used yet, so just silence the
> warning.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
I suppose this should also be
Fixes: be97d0db5f44 ("riscv: VMAP_STACK overflow detection thread-safe")

Cheers,
Conor.

> ---
>  arch/riscv/include/asm/stacktrace.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/riscv/include/asm/stacktrace.h b/arch/riscv/include/asm/stacktrace.h
> index f7e8ef2418b9..b1495a7e06ce 100644
> --- a/arch/riscv/include/asm/stacktrace.h
> +++ b/arch/riscv/include/asm/stacktrace.h
> @@ -21,4 +21,9 @@ static inline bool on_thread_stack(void)
>  	return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
>  }
>  
> +
> +#ifdef CONFIG_VMAP_STACK
> +DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack);
> +#endif /* CONFIG_VMAP_STACK */
> +
>  #endif /* _ASM_RISCV_STACKTRACE_H */
> -- 
> 2.37.2.352.g3c44437643
>
Ben Dooks Nov. 23, 2023, 1:54 p.m. UTC | #2
On 23/11/2023 13:51, Conor Dooley wrote:
> On Thu, Nov 23, 2023 at 01:42:14PM +0000, Ben Dooks wrote:
>> The percpu area overflow_stacks is exported from arch/riscv/kernel/traps.c
>> for use in the entry code, but is not declared anywhere. Add the relevant
>> declaration to arch/riscv/include/asm/stacktrace.h to silence the following
>> sparse warning:
>>
>> arch/riscv/kernel/traps.c:395:1: warning: symbol '__pcpu_scope_overflow_stack' was not declared. Should it be static?
>>
>> We don't add the stackinfo_get_overflow() call as for some of the other
>> architectures as this doesn't seem to be used yet, so just silence the
>> warning.
>>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> 
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> I suppose this should also be
> Fixes: be97d0db5f44 ("riscv: VMAP_STACK overflow detection thread-safe")

Thanks, never sure if the Fixes: should be applied when it is simply a
warning fix and there's nothing actually being currently flagging an
issue with anything else using it (currently just the assembly)
patchwork-bot+linux-riscv@kernel.org Feb. 8, 2024, 1:30 a.m. UTC | #3
Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 23 Nov 2023 13:42:14 +0000 you wrote:
> The percpu area overflow_stacks is exported from arch/riscv/kernel/traps.c
> for use in the entry code, but is not declared anywhere. Add the relevant
> declaration to arch/riscv/include/asm/stacktrace.h to silence the following
> sparse warning:
> 
> arch/riscv/kernel/traps.c:395:1: warning: symbol '__pcpu_scope_overflow_stack' was not declared. Should it be static?
> 
> [...]

Here is the summary with links:
  - riscv: declare overflow_stack as exported from traps.c
    https://git.kernel.org/riscv/c/2cf963787529

You are awesome, thank you!
diff mbox series

Patch

diff --git a/arch/riscv/include/asm/stacktrace.h b/arch/riscv/include/asm/stacktrace.h
index f7e8ef2418b9..b1495a7e06ce 100644
--- a/arch/riscv/include/asm/stacktrace.h
+++ b/arch/riscv/include/asm/stacktrace.h
@@ -21,4 +21,9 @@  static inline bool on_thread_stack(void)
 	return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
 }
 
+
+#ifdef CONFIG_VMAP_STACK
+DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack);
+#endif /* CONFIG_VMAP_STACK */
+
 #endif /* _ASM_RISCV_STACKTRACE_H */