[PATCH 8/9] ARM: entry: use enter_from_user_mode() instead of user_exit_callable()

Xie Yuanbin posted 9 patches 2 weeks ago
[PATCH 8/9] ARM: entry: use enter_from_user_mode() instead of user_exit_callable()
Posted by Xie Yuanbin 2 weeks ago
According to user_exit_callable()'s comment, the function is obsolete.
Use enter_from_user_mode() instead of user_exit_callable() to pair with
the calling of exit_to_user_mode() at returning to user.

Since enter_from_user_mode() is a inline function, add
arm_enter_from_user_mode() to call enter_from_user_mode(),
thereby replacing user_exit_callable() and trace_hardirqs_off().

Signed-off-by: Xie Yuanbin <qq570070308@gmail.com>
---
 arch/arm/include/asm/entry-common.h |  3 +++
 arch/arm/kernel/entry-armv.S        |  7 +------
 arch/arm/kernel/entry-common.S      |  6 ++----
 arch/arm/kernel/entry.c             | 14 ++++++++++++++
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/entry-common.h b/arch/arm/include/asm/entry-common.h
index d34c80d4b32b..0158a671d4fc 100644
--- a/arch/arm/include/asm/entry-common.h
+++ b/arch/arm/include/asm/entry-common.h
@@ -2,6 +2,9 @@
 #ifndef ARCH_ARM_ENTRY_COMMON_H
 #define ARCH_ARM_ENTRY_COMMON_H
 
+asmlinkage __section(".entry.text")
+void arm_enter_from_user_mode(void);
+
 asmlinkage __section(".entry.text")
 void arm_exit_to_user_mode_no_work_pending(void);
 
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 7f8781666a44..083782ef8180 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -403,12 +403,7 @@ ENDPROC(__fiq_abt)
 	zero_fp
 
 	.if	\trace
-#ifdef CONFIG_TRACE_IRQFLAGS
-	bl	trace_hardirqs_off
-#endif
-#ifdef CONFIG_CONTEXT_TRACKING_USER
-	bl	user_exit_callable
-#endif
+	bl	arm_enter_from_user_mode
 	.endif
 	.endm
 
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 108b77e2b405..0556d01ef55b 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -181,10 +181,8 @@ ENTRY(vector_swi)
 	zero_fp
 	alignment_trap r10, ip, cr_alignment
 	asm_trace_hardirqs_on save=0
-	enable_irq_notrace
-#ifdef CONFIG_CONTEXT_TRACKING_USER
-	bl	user_exit_callable
-#endif
+	bl	arm_enter_from_user_mode
+	enable_irq save=0
 
 	/*
 	 * Get the system call number.
diff --git a/arch/arm/kernel/entry.c b/arch/arm/kernel/entry.c
index 85df47b5c359..0438e1b7a704 100644
--- a/arch/arm/kernel/entry.c
+++ b/arch/arm/kernel/entry.c
@@ -5,6 +5,20 @@
 #include <linux/irq-entry-common.h>
 #include <linux/kstack_erase.h>
 
+/*
+ * arm_enter_from_user_mode - Establish state when coming from user mode
+ *
+ * The calling code satisfies (arch_irqs_disabled() && lockdep_hardirqs_enabled()).
+ * When the function returns, the state satisfies (arch_irqs_disabled() &&
+ * !lockdep_hardirqs_enabled()).
+ */
+asmlinkage __section(".entry.text")
+void arm_enter_from_user_mode(void)
+{
+	/* arm32 not uses pt_regs now */
+	enter_from_user_mode(NULL);
+}
+
 /*
  * arm_exit_to_user_mode_no_work_pending - Fixup state when exiting to user mode
  *
-- 
2.51.0