Unverified Commit e21659e4 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!13822 v4 arm64: Add xcall/xint support

Merge Pull Request from: @ci-robot 
 
PR sync from: Jinjie Ruan <ruanjinjie@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/XC73EQZ6YI2QHOAREFB3U4OKHP4KYZBD/ 
Add xcall/xint support for arm64.

Changes in v4:
- Fix the missing Comma about check_xint_pre_kernel_entry.
- When CONFIG_SECURITY_FEATURE_BYPASS not set, ret_to_user/kernel
  instead of "kernel_exit \el" for xcall/xint.

Changes in v3:
- Fix few typos in entry.S.

Changes in v2:
- Avoid enable xint without GICv3 enabled.
- Fix cpucap KABI break.
- Fix missing openeuler_defconfig update.
- Correct the marco control for SECURITY_FEATURE_BYPASS in entry.S.

Jinjie Ruan (2):
  arm64: Introduce Xint software solution
  arm64: Add debugfs dir for xint

Yipeng Zou (2):
  arm64: Introduce xcall a faster svc exception handling
  arm64: Faster SVC exception handler with xcall


-- 
2.34.1
 
https://gitee.com/openeuler/release-management/issues/IB6JLE 
 
Link:https://gitee.com/openeuler/kernel/pulls/13822

 

Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 4a0359af 63f9ef21
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
@@ -1530,4 +1530,68 @@ 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
	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
+2 −0
Original line number Diff line number Diff line
@@ -262,6 +262,8 @@ 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.

+4 −0
Original line number Diff line number Diff line
@@ -891,6 +891,10 @@ 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
+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,9 @@

int main(void)
{
#ifdef CONFIG_FAST_SYSCALL
	DEFINE(TSK_XCALL,		offsetof(struct task_struct, xcall_enable));
#endif
  DEFINE(TSK_ACTIVE_MM,		offsetof(struct task_struct, active_mm));
  BLANK();
  DEFINE(TSK_TI_CPU,		offsetof(struct task_struct, thread_info.cpu));
+54 −0
Original line number Diff line number Diff line
@@ -2375,6 +2375,44 @@ static void mpam_extra_caps(void)
		__enable_mpam_hcr();
}

#ifdef CONFIG_FAST_SYSCALL
static bool is_xcall_support;
static int __init xcall_setup(char *str)
{
	is_xcall_support = true;
	return 1;
}
__setup("xcall", xcall_setup);

bool fast_syscall_enabled(void)
{
	return is_xcall_support;
}

static bool has_xcall_support(const struct arm64_cpu_capabilities *entry, int __unused)
{
	return is_xcall_support;
}
#endif

#ifdef CONFIG_FAST_IRQ
bool is_xint_support;
static int __init xint_setup(char *str)
{
	if (!cpus_have_cap(ARM64_HAS_GIC_CPUIF_SYSREGS))
		return 1;

	is_xint_support = true;
	return 1;
}
__setup("xint", xint_setup);

static bool has_xint_support(const struct arm64_cpu_capabilities *entry, int __unused)
{
	return is_xint_support;
}
#endif

static const struct arm64_cpu_capabilities arm64_features[] = {
	{
		.capability = ARM64_ALWAYS_BOOT,
@@ -2891,6 +2929,22 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
		.matches = has_cpuid_feature,
		ARM64_CPUID_FIELDS(ID_AA64MMFR1_EL1, TWED, IMP)
	},
#endif
#ifdef CONFIG_FAST_SYSCALL
	{
		.desc = "Xcall Support",
		.capability = ARM64_HAS_XCALL,
		.type = ARM64_CPUCAP_SYSTEM_FEATURE,
		.matches = has_xcall_support,
	},
#endif
#ifdef CONFIG_FAST_IRQ
	{
		.desc = "Xint Support",
		.capability = ARM64_HAS_XINT,
		.type = ARM64_CPUCAP_SYSTEM_FEATURE,
		.matches = has_xint_support,
	},
#endif
	{},
};
Loading