mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Enable the generic IRQ entry/exit infrastructure on PowerPC by selecting GENERIC_ENTRY and integrating the architecture-specific interrupt and syscall handlers with the generic entry/exit APIs. This change replaces PowerPC’s local interrupt entry/exit handling with calls to the generic irqentry_* helpers, aligning the architecture with the common kernel entry model. The macros that define interrupt, async, and NMI handlers are updated to use irqentry_enter()/irqentry_exit() and irqentry_nmi_enter()/irqentry_nmi_exit() where applicable also convert the PowerPC syscall entry and exit paths to use the generic entry/exit framework and integrating with the common syscall handling routines. Key updates include: - The architecture now selects GENERIC_ENTRY in Kconfig. - Replace interrupt_enter/exit_prepare() with arch_interrupt_* helpers. - Integrate irqentry_enter()/exit() in standard and async interrupt paths. - Integrate irqentry_nmi_enter()/exit() in NMI handlers. - Remove redundant irq_enter()/irq_exit() calls now handled generically. - Use irqentry_exit_cond_resched() for preemption checks. - interrupt.c and syscall.c are simplified to delegate context management and user exit handling to the generic entry path. - The new pt_regs field `exit_flags` introduced earlier is now used to carry per-syscall exit state flags (e.g. _TIF_RESTOREALL). - Remove unused code. This change establishes the necessary wiring for PowerPC to use the generic IRQ entry/exit framework while maintaining existing semantics. This aligns PowerPC with the common entry code used by other architectures and reduces duplicated logic around syscall tracing, context tracking, and signal handling. The performance benchmarks from perf bench basic syscall are below: perf bench syscall usec/op (-ve is improvement) | Syscall | Base | test | change % | | ------- | ----------- | ----------- | -------- | | basic | 0.093543 | 0.093023 | -0.56 | | execve | 446.557781 | 450.107172 | +0.79 | | fork | 1142.204391 | 1156.377214 | +1.24 | | getpgid | 0.097666 | 0.092677 | -5.11 | perf bench syscall ops/sec (+ve is improvement) | Syscall | Base | New | change % | | ------- | -------- | -------- | -------- | | basic | 10690548 | 10750140 | +0.56 | | execve | 2239 | 2221 | -0.80 | | fork | 875 | 864 | -1.26 | | getpgid | 10239026 | 10790324 | +5.38 | IPI latency benchmark (-ve is improvement) | Metric | Base (ns) | New (ns) | % Change | | -------------- | ------------- | ------------- | -------- | | Dry run | 583136.56 | 584136.35 | 0.17% | | Self IPI | 4167393.42 | 4149093.90 | -0.44% | | Normal IPI | 61769347.82 | 61753728.39 | -0.03% | | Broadcast IPI | 2235584825.02 | 2227521401.45 | -0.36% | | Broadcast lock | 2164964433.31 | 2125658641.76 | -1.82% | Thats very close to performance earlier with arch specific handling. Signed-off-by: Mukesh Kumar Chaurasiya <mkchauras@linux.ibm.com> Tested-by: Samir M <samir@linux.ibm.com> Tested-by: David Gow <davidgow@google.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260427122742.210074-8-mkchauras@gmail.com
78 lines
2.2 KiB
C
78 lines
2.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_KASAN_H
|
|
#define __ASM_KASAN_H
|
|
|
|
#if defined(CONFIG_KASAN) && !defined(CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX)
|
|
#define _GLOBAL_KASAN(fn) \
|
|
_GLOBAL(fn); \
|
|
_GLOBAL(__##fn)
|
|
#define _GLOBAL_TOC_KASAN(fn) \
|
|
_GLOBAL_TOC(fn); \
|
|
_GLOBAL_TOC(__##fn)
|
|
#define EXPORT_SYMBOL_KASAN(fn) \
|
|
EXPORT_SYMBOL(__##fn)
|
|
#else /* CONFIG_KASAN && !CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX */
|
|
#define _GLOBAL_KASAN(fn) _GLOBAL(fn)
|
|
#define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(fn)
|
|
#define EXPORT_SYMBOL_KASAN(fn)
|
|
#endif /* CONFIG_KASAN && !CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX */
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
#include <asm/page.h>
|
|
#include <linux/sizes.h>
|
|
|
|
#define KASAN_SHADOW_SCALE_SHIFT 3
|
|
|
|
#if defined(CONFIG_EXECMEM) && defined(CONFIG_PPC32)
|
|
#define KASAN_KERN_START ALIGN_DOWN(PAGE_OFFSET - SZ_256M, SZ_256M)
|
|
#else
|
|
#define KASAN_KERN_START PAGE_OFFSET
|
|
#endif
|
|
|
|
#define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
|
|
(KASAN_KERN_START >> KASAN_SHADOW_SCALE_SHIFT))
|
|
|
|
#define KASAN_SHADOW_OFFSET ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
|
|
|
|
#ifdef CONFIG_PPC32
|
|
#define KASAN_SHADOW_END (-(-KASAN_SHADOW_START >> KASAN_SHADOW_SCALE_SHIFT))
|
|
#elif defined(CONFIG_PPC_BOOK3S_64)
|
|
/*
|
|
* The shadow ends before the highest accessible address
|
|
* because we don't need a shadow for the shadow. Instead:
|
|
* c00e000000000000 << 3 + a80e000000000000 = c00fc00000000000
|
|
*/
|
|
#define KASAN_SHADOW_END 0xc00fc00000000000UL
|
|
|
|
#else
|
|
|
|
/*
|
|
* The shadow ends before the highest accessible address
|
|
* because we don't need a shadow for the shadow.
|
|
* But it doesn't hurt to have a shadow for the shadow,
|
|
* keep shadow end aligned eases things.
|
|
*/
|
|
#define KASAN_SHADOW_END 0xc000200000000000UL
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_KASAN
|
|
|
|
void kasan_early_init(void);
|
|
void kasan_mmu_init(void);
|
|
void kasan_init(void);
|
|
void kasan_late_init(void);
|
|
#else
|
|
static inline void kasan_init(void) { }
|
|
static inline void kasan_mmu_init(void) { }
|
|
static inline void kasan_late_init(void) { }
|
|
#endif
|
|
|
|
void kasan_update_early_region(unsigned long k_start, unsigned long k_end, pte_t pte);
|
|
int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end);
|
|
int kasan_init_region(void *start, size_t size);
|
|
|
|
#endif /* __ASSEMBLER__ */
|
|
#endif
|