Skip to contentSkip to conversation

x86: cleanups

PATCH Applied Lai Jiangshan 2 participants 7 messages Apr 19, 2020 – May 7, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover x86: cleanups

Simple cleanups found while reading the code.

Lai Jiangshan (3):
x86/entry: remove unneeded kernel cr3 switching
x86: remove address operator on function machine_check() x86/entry: remove an unused label

 arch/x86/entry/entry_64.S | 2 --
 arch/x86/kernel/idt.c     | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 x86/entry: remove unneeded kernel cr3 switching

When native_load_gs_index() fails on .Lgs_change, the cr3 must be kernel cr3. Don't need to switch it.

---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)
arch/x86/entry/entry_64.S +0 -1
index 0e9504fabe52..b789835afbab 100644
@@ -1339,7 +1339,6 @@ SYM_CODE_START_LOCAL(error_entry)
 	 */
 	SWAPGS
 	FENCE_SWAPGS_USER_ENTRY
-	SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
 	jmp .Lerror_entry_done
 
 .Lbstep_iret:
Signature · 1 line
2.20.1
#5 lore raw

PATCH 3/3 x86/entry: remove an unused label

In reply to Lai Jiangshan

The label .Lcommon_\sym was introduced by 39e9543344fa.
(x86-64: Reduce amount of redundant code generated for invalidate_interruptNN) And all the other relevant information was removed by 52aec3308db8 (x86/tlb: replace INVALIDATE_TLB_VECTOR by CALL_FUNCTION_VECTOR)

---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)
arch/x86/entry/entry_64.S +0 -1
index b789835afbab..7d40d1034358 100644
@@ -798,7 +798,6 @@ _ASM_NOKPROBE(common_interrupt)
 SYM_CODE_START(\sym)
 	UNWIND_HINT_IRET_REGS
 	pushq	$~(\num)
-.Lcommon_\sym:
 	call	interrupt_entry
 	UNWIND_HINT_REGS indirect=1
 	call	\do_sym	/* rdi points to pt_regs */
Signature · 1 line
2.20.1
#3 lore raw

PATCH 2/3 x86: remove address operator on function machine_check()

In reply to Lai Jiangshan

machine_check is function address, the address operator on it is nop for compiler.

Make it consistent with the other function addresses in the same file.

---
 arch/x86/kernel/idt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/idt.c +2 -2
index 87ef69a72c52..98bcb502f967 100644
@@ -93,7 +93,7 @@ static const __initconst struct idt_data def_idts[] = {
 	INTG(X86_TRAP_DB,		debug),
 
 #ifdef CONFIG_X86_MCE
-	INTG(X86_TRAP_MC,		&machine_check),
+	INTG(X86_TRAP_MC,		machine_check),
 #endif
 
 	SYSG(X86_TRAP_OF,		overflow),
@@ -186,7 +186,7 @@ static const __initconst struct idt_data ist_idts[] = {
 	ISTG(X86_TRAP_NMI,	nmi,		IST_INDEX_NMI),
 	ISTG(X86_TRAP_DF,	double_fault,	IST_INDEX_DF),
 #ifdef CONFIG_X86_MCE
-	ISTG(X86_TRAP_MC,	&machine_check,	IST_INDEX_MCE),
+	ISTG(X86_TRAP_MC,	machine_check,	IST_INDEX_MCE),
 #endif
 };
 
Signature · 1 line
2.20.1
merge bot Applied
#4 lore raw

[tip: x86/entry] x86/idt: Remove address operator on function machine_check()

The following commit has been merged into the x86/entry branch of tip:

The following commit has been merged into the x86/entry branch of tip:

Commit-ID:     3dcdb8e0c83b9502f669106e17bfa795f19f8d9b
Gitweb:        https://git.kernel.org/tip/3dcdb8e0c83b9502f669106e17bfa795f19f8d9b
Author:        Lai Jiangshan <[email protected]>
AuthorDate:    Sun, 19 Apr 2020 14:40:48 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 07 May 2020 17:12:40 +02:00

x86/idt: Remove address operator on function machine_check()

machine_check is function address, the address operator on it is nop for compiler.

Make it consistent with the other function addresses in the same file.

---
 arch/x86/kernel/idt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/idt.c +2 -2
index 87ef69a..98bcb50 100644
@@ -93,7 +93,7 @@ static const __initconst struct idt_data def_idts[] = {
 	INTG(X86_TRAP_DB,		debug),
 
 #ifdef CONFIG_X86_MCE
-	INTG(X86_TRAP_MC,		&machine_check),
+	INTG(X86_TRAP_MC,		machine_check),
 #endif
 
 	SYSG(X86_TRAP_OF,		overflow),
@@ -186,7 +186,7 @@ static const __initconst struct idt_data ist_idts[] = {
 	ISTG(X86_TRAP_NMI,	nmi,		IST_INDEX_NMI),
 	ISTG(X86_TRAP_DF,	double_fault,	IST_INDEX_DF),
 #ifdef CONFIG_X86_MCE
-	ISTG(X86_TRAP_MC,	&machine_check,	IST_INDEX_MCE),
+	ISTG(X86_TRAP_MC,	machine_check,	IST_INDEX_MCE),
 #endif
 };
 
merge bot Applied
#2 lore raw

[tip: x86/entry] x86/entry/64: Remove unneeded kernel CR3 switching

In reply to Lai Jiangshan
The following commit has been merged into the x86/entry branch of tip:

The following commit has been merged into the x86/entry branch of tip:

Commit-ID:     f642aebc9d2a51775d86eaa79da9d90aa5dff0f7
Gitweb:        https://git.kernel.org/tip/f642aebc9d2a51775d86eaa79da9d90aa5dff0f7
Author:        Lai Jiangshan <[email protected]>
AuthorDate:    Sun, 19 Apr 2020 14:40:47 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 07 May 2020 17:12:39 +02:00

x86/entry/64: Remove unneeded kernel CR3 switching

When native_load_gs_index() fails on .Lgs_change, CR3 must be kernel CR3. No need to switch it.

---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)
arch/x86/entry/entry_64.S +0 -1
index 3d747da..7d40d10 100644
@@ -1338,7 +1338,6 @@ SYM_CODE_START_LOCAL(error_entry)
 	 */
 	SWAPGS
 	FENCE_SWAPGS_USER_ENTRY
-	SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
 	jmp .Lerror_entry_done
 
 .Lbstep_iret:
merge bot Applied
#6 lore raw

[tip: x86/entry] x86/entry/64: Remove an unused label

In reply to Lai Jiangshan
The following commit has been merged into the x86/entry branch of tip:

The following commit has been merged into the x86/entry branch of tip:

Commit-ID:     4446d96d7ba7eaac54f9ef968bbe858097441d50
Gitweb:        https://git.kernel.org/tip/4446d96d7ba7eaac54f9ef968bbe858097441d50
Author:        Lai Jiangshan <[email protected]>
AuthorDate:    Sun, 19 Apr 2020 14:40:49 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 07 May 2020 17:12:39 +02:00

x86/entry/64: Remove an unused label

The label .Lcommon_\sym was introduced by 39e9543344fa.
(x86-64: Reduce amount of redundant code generated for invalidate_interruptNN) And all the other relevant information was removed by 52aec3308db8 (x86/tlb: replace INVALIDATE_TLB_VECTOR by CALL_FUNCTION_VECTOR)

---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)
arch/x86/entry/entry_64.S +0 -1
index 0e9504f..3d747da 100644
@@ -798,7 +798,6 @@ _ASM_NOKPROBE(common_interrupt)
 SYM_CODE_START(\sym)
 	UNWIND_HINT_IRET_REGS
 	pushq	$~(\num)
-.Lcommon_\sym:
 	call	interrupt_entry
 	UNWIND_HINT_REGS indirect=1
 	call	\do_sym	/* rdi points to pt_regs */