forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
riscv: stack: Support HAVE_IRQ_EXIT_ON_IRQ_STACK
Add independent irq stacks for percpu to prevent kernel stack overflows. It is also compatible with VMAP_STACK by arch_alloc_vmap_stack. Tested-by: Jisheng Zhang <[email protected]> Signed-off-by: Guo Ren <[email protected]> Signed-off-by: Guo Ren <[email protected]> Cc: Clément Léger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
- Loading branch information
1 parent
d5e45e8
commit 163e76c
Showing
5 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#ifndef _ASM_RISCV_IRQ_STACK_H | ||
#define _ASM_RISCV_IRQ_STACK_H | ||
|
||
#include <linux/bug.h> | ||
#include <linux/gfp.h> | ||
#include <linux/kconfig.h> | ||
#include <linux/vmalloc.h> | ||
#include <linux/pgtable.h> | ||
#include <asm/thread_info.h> | ||
|
||
DECLARE_PER_CPU(ulong *, irq_stack_ptr); | ||
|
||
#ifdef CONFIG_VMAP_STACK | ||
/* | ||
* To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd | ||
* stacks need to have the same alignment. | ||
*/ | ||
static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node) | ||
{ | ||
void *p; | ||
|
||
p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node, | ||
__builtin_return_address(0)); | ||
return kasan_reset_tag(p); | ||
} | ||
#endif /* CONFIG_VMAP_STACK */ | ||
|
||
#endif /* _ASM_RISCV_IRQ_STACK_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters