
From: Liao Chang <liaochang1@huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/release-management/issues/IBV2E4 -------------------------------- This patch introduce a new submenu in 'Kernel Features' menu for turbo in-house features. This submenu includes some configs as below: - CONFIG_FAST_SYSCALL: It is a software optimization for reducing the syscall invocation cost. It has no hardware dependencies. In order to reduce the CPU cycles taken by exception level switching, kernel bypass some expensive operation for debugging and security features. - CONFIG_FAST_IRQ: It is a software optimzation for reducing the interrupt handling cost. It has no hardware dependencies. In order to reduce the CPU cycles taken by exception level switching, kernel bypass some expensive operations for debugging and security features. - CONFIG_DEBUG_FEATURE_BYPASS: This controls the debugger related operations bypassed upon CONFIG_FAST_SYSCALL or CONFIG_FAST_IRQ are enabled. - CONFIG_SECURITY_FEATURE_BYPASS: This controls the security related operation bypassed upon CONFIG_FAST_SYSCALL or CONFIG_FAST_IRQ are enabled. - CONFIG_ACTLR_XCALL_XINT: Hisilicon CPU uses the actlr xcall bit to control the offset to the exception vector base address for 'svc ffff' executed at EL0 and Hisilicon CPU uses the actlr xint bit to control the offset to the exception vector base address for the ARMv8.8 NMI taken from EL0. Signed-off-by: Liao Chang <liaochang1@huawei.com> Signed-off-by: Ruan Jinjie <ruanjinji@huawei.com> Signed-off-by: Zou Yipeng <zouyipeng@huawei.com> --- v6: - Make harware XCALL/XINT not depends on COMPAT. - Make CONFIG_SECURITY_FEATURE_BYPASS control all mte related. - Make SECURITY_FEATURE_BYPASS depends on ARM64_MTE and KASAN_HW_TAGS instead of FAST_SYSCALL or FAST_IRQ. v4: - "hisilicon" -> "turbo" --- arch/Kconfig | 65 ---------------------- arch/arm64/Kconfig | 4 +- arch/arm64/Kconfig.turbo | 77 ++++++++++++++++++++++++++ arch/arm64/configs/openeuler_defconfig | 14 +++-- arch/arm64/kernel/entry-common.c | 4 +- 5 files changed, 92 insertions(+), 72 deletions(-) create mode 100644 arch/arm64/Kconfig.turbo diff --git a/arch/Kconfig b/arch/Kconfig index a4ed5d338dad..93d8221cc834 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -1533,69 +1533,4 @@ config FUNCTION_ALIGNMENT default 4 if FUNCTION_ALIGNMENT_4B default 0 -config ARCH_SUPPORTS_FAST_SYSCALL - bool - -config FAST_SYSCALL - bool "Fast Syscall support" - depends on ARCH_SUPPORTS_FAST_SYSCALL - default n - help - This enable support Fast syscall feature. - The svc exception handling process, which includes auxiliary - functions for debug/trace and core functions like - KPTI, has been identified as overly "lengthy". - This inefficiency is particularly noticeable in short syscalls - such as lseek() and getpid(), where the syscall function itself - comprises a small percentage of the total instructions executed. - To address this, we introduce the concept of fast syscall, a fast svc - exception handling path that only considers necessary features - such as security, context saving, and recovery. - -config ARCH_SUPPORTS_FAST_IRQ - bool - -config FAST_IRQ - bool "Fast irq support" - depends on ARCH_SUPPORTS_FAST_IRQ - default n - help - The irq handling process, which includes auxiliary - functions for debug/trace and core functions like - KPTI, interrupt time record, interrupt processing as - a random number source, interrupt affinity - modification and interrupt processing race, as well as - spurious and unhandled interrupt debugging, has been - identified as overly "lengthy". - To address this, we introduce the concept of fast irq, - a fast interrupt handling path that only considers - necessary features such as security, context saving - and recovery, which adds an lightweight interrupt processing - framework for latency-sensitive interrupts. - -config DEBUG_FEATURE_BYPASS - bool "Bypass debug feature in fast syscall" - depends on FAST_SYSCALL || FAST_IRQ - depends on !LOCKDEP - default y - help - This to bypass debug feature in fast syscall. - The svc exception handling process, which includes auxiliary - functions for debug/trace and core functions like - KPTI, has been identified as overly "lengthy". - In fast syscall we only considers necessary features. - Disable this config to keep debug feature in fast syscall. - -config SECURITY_FEATURE_BYPASS - bool "Bypass security feature in fast syscall" - depends on FAST_SYSCALL || FAST_IRQ - default y - help - This to bypass security feature in fast syscall. - The svc exception handling process, which includes auxiliary - functions for debug/trace and core functions like - KPTI, has been identified as overly "lengthy". - In fast syscall we only considers necessary features. - Disable this config to keep security feature in fast syscall. - endmenu diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index dabbbb0e012c..29554be608e1 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -267,8 +267,6 @@ config ARM64 select TRACE_IRQFLAGS_SUPPORT select TRACE_IRQFLAGS_NMI_SUPPORT select HAVE_SOFTIRQ_ON_OWN_STACK - select ARCH_SUPPORTS_FAST_SYSCALL if !ARM64_MTE && !KASAN_HW_TAGS - select ARCH_SUPPORTS_FAST_IRQ if ARM_GIC_V3 && !ARM64_MTE && !KASAN_HW_TAGS help ARM 64-bit (AArch64) Linux support. @@ -427,6 +425,8 @@ source "kernel/livepatch/Kconfig" menu "Kernel Features" +source "arch/arm64/Kconfig.turbo" + menu "ARM errata workarounds via the alternatives framework" config AMPERE_ERRATUM_AC03_CPU_38 diff --git a/arch/arm64/Kconfig.turbo b/arch/arm64/Kconfig.turbo new file mode 100644 index 000000000000..586edb89609c --- /dev/null +++ b/arch/arm64/Kconfig.turbo @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: GPL-2.0-only +menu "Turbo features selection" + +config FAST_SYSCALL + bool "Fast syscall handler support" + default n + select DEBUG_FEATURE_BYPASS + select SECURITY_FEATURE_BYPASS + help + This enable support Fast syscall feature. + The svc exception handling process, which includes auxiliary + functions for debug/trace and core functions like + KPTI, has been identified as overly "lengthy". + This inefficiency is particularly noticeable in short syscalls + such as lseek() and getpid(), where the syscall function itself + comprises a small percentage of the total instructions executed. + To address this, we introduce the concept of fast syscall, a fast svc + exception handling path that only considers necessary features + such as security, context saving, and recovery. + +config FAST_IRQ + bool "Fast irq handler support" + depends on ARM_GIC_V3 + default n + select DEBUG_FEATURE_BYPASS + select SECURITY_FEATURE_BYPASS + help + The irq handling process, which includes auxiliary + functions for debug/trace and core functions like + KPTI, interrupt time record, interrupt processing as + a random number source, interrupt affinity + modification and interrupt processing race, as well as + spurious and unhandled interrupt debugging, has been + identified as overly "lengthy". + To address this, we introduce the concept of fast irq, + a fast interrupt handling path that only considers + necessary features such as security, context saving + and recovery, which adds an lightweight interrupt processing + framework for latency-sensitive interrupts. + +config DEBUG_FEATURE_BYPASS + bool "Bypass debug feature in fast syscall" + depends on FAST_SYSCALL || FAST_IRQ + depends on !LOCKDEP + default n + help + This to bypass debug feature in fast syscall. + The svc exception handling process, which includes auxiliary + functions for debug/trace and core functions like + KPTI, has been identified as overly "lengthy". + In fast syscall we only considers necessary features. + Disable this config to keep debug feature in fast syscall. + +config SECURITY_FEATURE_BYPASS + bool "Bypass security feature in fast syscall" + depends on !ARM64_MTE + depends on !KASAN_HW_TAGS + depends on FAST_SYSCALL || FAST_IRQ + default n + help + This to bypass security feature in fast syscall. + The svc exception handling process, which includes auxiliary + functions for debug/trace and core functions like + KPTI, has been identified as overly "lengthy". + In fast syscall we only considers necessary features. + Disable this config to keep security feature in fast syscall. + +config ACTLR_XCALL_XINT + bool "Hardware XCALL and Xint support" + default n + help + Use the 0x600 as the offset to the exception vector base address for + 'svc ffff' + Use the 0x680 as the offset to the exception vector base address for + the Armv8.8 NMI taken from EL0. + +endmenu # "Turbo features selection" diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 11500a2d3ba1..e800680c4530 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -378,6 +378,16 @@ CONFIG_LIVEPATCH_ISOLATE_KPROBE=y # Kernel Features # +# +# Turbo features selection +# +CONFIG_FAST_SYSCALL=y +CONFIG_FAST_IRQ=y +CONFIG_DEBUG_FEATURE_BYPASS=y +CONFIG_SECURITY_FEATURE_BYPASS=y +CONFIG_ACTLR_XCALL_XINT=y +# end of Turbo features selection + # # ARM errata workarounds via the alternatives framework # @@ -902,10 +912,6 @@ CONFIG_HAVE_GCC_PLUGINS=y CONFIG_FUNCTION_ALIGNMENT_4B=y CONFIG_FUNCTION_ALIGNMENT_8B=y CONFIG_FUNCTION_ALIGNMENT=8 -CONFIG_ARCH_SUPPORTS_FAST_SYSCALL=y -# CONFIG_FAST_SYSCALL is not set -CONFIG_ARCH_SUPPORTS_FAST_IRQ=y -# CONFIG_FAST_IRQ is not set # end of General architecture-dependent options CONFIG_RT_MUTEXES=y diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 4602c107c40a..b7cc01130ff5 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -186,7 +186,7 @@ static __always_inline void __fast_exit_to_user_mode(void) static __always_inline void fast_exit_to_user_mode(struct pt_regs *regs) { fast_exit_to_user_mode_prepare(regs); -#ifndef CONFIG_DEBUG_FEATURE_BYPASS +#ifndef CONFIG_SECURITY_FEATURE_BYPASS mte_check_tfsr_exit(); #endif __fast_exit_to_user_mode(); @@ -202,6 +202,8 @@ static __always_inline void fast_enter_from_user_mode(struct pt_regs *regs) user_exit_irqoff(); #ifndef CONFIG_DEBUG_FEATURE_BYPASS trace_hardirqs_off_finish(); +#endif +#ifndef CONFIG_SECURITY_FEATURE_BYPASS mte_disable_tco_entry(current); #endif } -- 2.34.1