Skip to contentSkip to conversation

x86/realmode: remove trampoline_status flag

PATCH New Pingfan Liu 2 participants 2 messages Jul 16, 2019 – Jul 22, 2019 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/realmode: remove trampoline_status flag

In current code, there is no reader of trampoline_status. It turns out that after commit ce4b1b16502b ("x86/smpboot: Initialize secondary CPU only if master CPU will wait for it"), trampoline_status is not needed any more.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Mukesh Ojha <[email protected]>
Cc Matteo Croce <[email protected]>
Cc Len Brown <[email protected]>
Cc Pu Wen <[email protected]>
Cc Nicolai Stange <[email protected]>
Cc Hui Wang <[email protected]>
---
 arch/x86/include/asm/realmode.h          | 1 -
 arch/x86/kernel/smpboot.c                | 5 -----
 arch/x86/realmode/rm/header.S            | 1 -
 arch/x86/realmode/rm/trampoline_32.S     | 3 ---
 arch/x86/realmode/rm/trampoline_64.S     | 3 ---
 arch/x86/realmode/rm/trampoline_common.S | 4 ----
 6 files changed, 17 deletions(-)
arch/x86/include/asm/realmode.h +0 -1
index c536823..09ecc32 100644
@@ -20,7 +20,6 @@ struct real_mode_header {
 	u32	ro_end;
 	/* SMP trampoline */
 	u32	trampoline_start;
-	u32	trampoline_status;
 	u32	trampoline_header;
 #ifdef CONFIG_X86_64
 	u32	trampoline_pgd;
arch/x86/kernel/smpboot.c +0 -5
index 362dd89..2ef10d9 100644
@@ -965,8 +965,6 @@ int common_cpu_up(unsigned int cpu, struct task_struct *idle)
 static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle,
 		       int *cpu0_nmi_registered)
 {
-	volatile u32 *trampoline_status =
-		(volatile u32 *) __va(real_mode_header->trampoline_status);
 	/* start_ip had better be page-aligned! */
 	unsigned long start_ip = real_mode_header->trampoline_start;
 
@@ -1058,9 +1056,6 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle,
 		}
 	}
 
-	/* mark "stuck" area as not stuck */
-	*trampoline_status = 0;
-
 	if (x86_platform.legacy.warm_reset) {
 		/*
 		 * Cleanup possible dangling ends...
arch/x86/realmode/rm/header.S +0 -1
index 30b0d30..6363761 100644
@@ -19,7 +19,6 @@ GLOBAL(real_mode_header)
 	.long	pa_ro_end
 	/* SMP trampoline */
 	.long	pa_trampoline_start
-	.long	pa_trampoline_status
 	.long	pa_trampoline_header
 #ifdef CONFIG_X86_64
 	.long	pa_trampoline_pgd;
arch/x86/realmode/rm/trampoline_32.S +0 -3
index 2dd866c..1868b15 100644
@@ -41,9 +41,6 @@ ENTRY(trampoline_start)
 
 	movl	tr_start, %eax	# where we need to go
 
-	movl	$0xA5A5A5A5, trampoline_status
-				# write marker for master knows we're running
-
 	/*
 	 * GDT tables in non default location kernel can be beyond 16MB and
 	 * lgdt will not be able to load the address as in real mode default
arch/x86/realmode/rm/trampoline_64.S +0 -3
index 24bb759..aee2b45 100644
@@ -49,9 +49,6 @@ ENTRY(trampoline_start)
 	mov	%ax, %es
 	mov	%ax, %ss
 
-	movl	$0xA5A5A5A5, trampoline_status
-	# write marker for master knows we're running
-
 	# Setup stack
 	movl	$rm_stack_end, %esp
 
arch/x86/realmode/rm/trampoline_common.S +0 -4
index 7c70677..8d8208d 100644
@@ -2,7 +2,3 @@
 	.section ".rodata","a"
 	.balign	16
 tr_idt: .fill 1, 6, 0
-
-	.bss
-	.balign	4
-GLOBAL(trampoline_status)	.space	4
Signature · 1 line
2.7.5
#1 lore raw

[tip:x86/cleanups] x86/realmode: Remove trampoline_status

x86/realmode: Remove trampoline_status
Commit-ID:  69732102426b1c55a257386841fb80ec1f425d32
Gitweb:     https://git.kernel.org/tip/69732102426b1c55a257386841fb80ec1f425d32
Author:     Pingfan Liu <[email protected]>
AuthorDate: Tue, 16 Jul 2019 16:40:24 +0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 22 Jul 2019 11:30:18 +0200

x86/realmode: Remove trampoline_status

There is no reader of trampoline_status, it's only written.

It turns out that after commit ce4b1b16502b ("x86/smpboot: Initialize secondary CPU only if master CPU will wait for it"), trampoline_status is not needed any more.

---
 arch/x86/include/asm/realmode.h          | 1 -
 arch/x86/kernel/smpboot.c                | 5 -----
 arch/x86/realmode/rm/header.S            | 1 -
 arch/x86/realmode/rm/trampoline_32.S     | 3 ---
 arch/x86/realmode/rm/trampoline_64.S     | 3 ---
 arch/x86/realmode/rm/trampoline_common.S | 4 ----
 6 files changed, 17 deletions(-)
arch/x86/include/asm/realmode.h +0 -1
index c53682303c9c..09ecc32f6524 100644
@@ -20,7 +20,6 @@ struct real_mode_header {
 	u32	ro_end;
 	/* SMP trampoline */
 	u32	trampoline_start;
-	u32	trampoline_status;
 	u32	trampoline_header;
 #ifdef CONFIG_X86_64
 	u32	trampoline_pgd;
arch/x86/kernel/smpboot.c +0 -5
index fdbd47ceb84d..497e9b7077c1 100644
@@ -1023,8 +1023,6 @@ int common_cpu_up(unsigned int cpu, struct task_struct *idle)
 static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle,
 		       int *cpu0_nmi_registered)
 {
-	volatile u32 *trampoline_status =
-		(volatile u32 *) __va(real_mode_header->trampoline_status);
 	/* start_ip had better be page-aligned! */
 	unsigned long start_ip = real_mode_header->trampoline_start;
 
@@ -1116,9 +1114,6 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle,
 		}
 	}
 
-	/* mark "stuck" area as not stuck */
-	*trampoline_status = 0;
-
 	if (x86_platform.legacy.warm_reset) {
 		/*
 		 * Cleanup possible dangling ends...
arch/x86/realmode/rm/header.S +0 -1
index 30b0d30d861a..6363761cc74c 100644
@@ -19,7 +19,6 @@ GLOBAL(real_mode_header)
 	.long	pa_ro_end
 	/* SMP trampoline */
 	.long	pa_trampoline_start
-	.long	pa_trampoline_status
 	.long	pa_trampoline_header
 #ifdef CONFIG_X86_64
 	.long	pa_trampoline_pgd;
arch/x86/realmode/rm/trampoline_32.S +0 -3
index 2dd866c9e21e..1868b158480d 100644
@@ -41,9 +41,6 @@ ENTRY(trampoline_start)
 
 	movl	tr_start, %eax	# where we need to go
 
-	movl	$0xA5A5A5A5, trampoline_status
-				# write marker for master knows we're running
-
 	/*
 	 * GDT tables in non default location kernel can be beyond 16MB and
 	 * lgdt will not be able to load the address as in real mode default
arch/x86/realmode/rm/trampoline_64.S +0 -3
index 24bb7598774e..aee2b45d83b8 100644
@@ -49,9 +49,6 @@ ENTRY(trampoline_start)
 	mov	%ax, %es
 	mov	%ax, %ss
 
-	movl	$0xA5A5A5A5, trampoline_status
-	# write marker for master knows we're running
-
 	# Setup stack
 	movl	$rm_stack_end, %esp
 
arch/x86/realmode/rm/trampoline_common.S +0 -4
index 7c706772ab59..8d8208dcca24 100644
@@ -2,7 +2,3 @@
 	.section ".rodata","a"
 	.balign	16
 tr_idt: .fill 1, 6, 0
-
-	.bss
-	.balign	4
-GLOBAL(trampoline_status)	.space	4