linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] x86: cleanups
@ 2020-04-19 14:40 Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 1/3] x86/entry: remove unneeded kernel cr3 switching Lai Jiangshan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Lai Jiangshan @ 2020-04-19 14:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lai Jiangshan

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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] x86/entry: remove unneeded kernel cr3 switching
  2020-04-19 14:40 [PATCH 0/3] x86: cleanups Lai Jiangshan
@ 2020-04-19 14:40 ` Lai Jiangshan
  2020-05-07 15:16   ` [tip: x86/entry] x86/entry/64: Remove unneeded kernel CR3 switching tip-bot2 for Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 2/3] x86: remove address operator on function machine_check() Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 3/3] x86/entry: remove an unused label Lai Jiangshan
  2 siblings, 1 reply; 7+ messages in thread
From: Lai Jiangshan @ 2020-04-19 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lai Jiangshan, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin

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

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 0e9504fabe52..b789835afbab 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -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:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] x86: remove address operator on function machine_check()
  2020-04-19 14:40 [PATCH 0/3] x86: cleanups Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 1/3] x86/entry: remove unneeded kernel cr3 switching Lai Jiangshan
@ 2020-04-19 14:40 ` Lai Jiangshan
  2020-05-07 15:16   ` [tip: x86/entry] x86/idt: Remove " tip-bot2 for Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 3/3] x86/entry: remove an unused label Lai Jiangshan
  2 siblings, 1 reply; 7+ messages in thread
From: Lai Jiangshan @ 2020-04-19 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lai Jiangshan, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	x86, H. Peter Anvin, Alexios Zavras, Allison Randal,
	Armijn Hemel

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.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
 arch/x86/kernel/idt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
index 87ef69a72c52..98bcb502f967 100644
--- a/arch/x86/kernel/idt.c
+++ b/arch/x86/kernel/idt.c
@@ -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
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] x86/entry: remove an unused label
  2020-04-19 14:40 [PATCH 0/3] x86: cleanups Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 1/3] x86/entry: remove unneeded kernel cr3 switching Lai Jiangshan
  2020-04-19 14:40 ` [PATCH 2/3] x86: remove address operator on function machine_check() Lai Jiangshan
@ 2020-04-19 14:40 ` Lai Jiangshan
  2020-05-07 15:16   ` [tip: x86/entry] x86/entry/64: Remove " tip-bot2 for Lai Jiangshan
  2 siblings, 1 reply; 7+ messages in thread
From: Lai Jiangshan @ 2020-04-19 14:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lai Jiangshan, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin

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)

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index b789835afbab..7d40d1034358 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -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 */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: x86/entry] x86/idt: Remove address operator on function machine_check()
  2020-04-19 14:40 ` [PATCH 2/3] x86: remove address operator on function machine_check() Lai Jiangshan
@ 2020-05-07 15:16   ` tip-bot2 for Lai Jiangshan
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Lai Jiangshan @ 2020-05-07 15:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Lai Jiangshan, Thomas Gleixner, x86, LKML

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 <laijs@linux.alibaba.com>
AuthorDate:    Sun, 19 Apr 2020 14:40:48 
Committer:     Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200419144049.1906-3-laijs@linux.alibaba.com

---
 arch/x86/kernel/idt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
index 87ef69a..98bcb50 100644
--- a/arch/x86/kernel/idt.c
+++ b/arch/x86/kernel/idt.c
@@ -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
 };
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: x86/entry] x86/entry/64: Remove unneeded kernel CR3 switching
  2020-04-19 14:40 ` [PATCH 1/3] x86/entry: remove unneeded kernel cr3 switching Lai Jiangshan
@ 2020-05-07 15:16   ` tip-bot2 for Lai Jiangshan
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Lai Jiangshan @ 2020-05-07 15:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Lai Jiangshan, Thomas Gleixner, x86, LKML

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 <laijs@linux.alibaba.com>
AuthorDate:    Sun, 19 Apr 2020 14:40:47 
Committer:     Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200419144049.1906-2-laijs@linux.alibaba.com

---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3d747da..7d40d10 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -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:

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: x86/entry] x86/entry/64: Remove an unused label
  2020-04-19 14:40 ` [PATCH 3/3] x86/entry: remove an unused label Lai Jiangshan
@ 2020-05-07 15:16   ` tip-bot2 for Lai Jiangshan
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Lai Jiangshan @ 2020-05-07 15:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Lai Jiangshan, Thomas Gleixner, x86, LKML

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 <laijs@linux.alibaba.com>
AuthorDate:    Sun, 19 Apr 2020 14:40:49 
Committer:     Thomas Gleixner <tglx@linutronix.de>
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)

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200419144049.1906-4-laijs@linux.alibaba.com

---
 arch/x86/entry/entry_64.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 0e9504f..3d747da 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -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 */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-07 15:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 14:40 [PATCH 0/3] x86: cleanups Lai Jiangshan
2020-04-19 14:40 ` [PATCH 1/3] x86/entry: remove unneeded kernel cr3 switching Lai Jiangshan
2020-05-07 15:16   ` [tip: x86/entry] x86/entry/64: Remove unneeded kernel CR3 switching tip-bot2 for Lai Jiangshan
2020-04-19 14:40 ` [PATCH 2/3] x86: remove address operator on function machine_check() Lai Jiangshan
2020-05-07 15:16   ` [tip: x86/entry] x86/idt: Remove " tip-bot2 for Lai Jiangshan
2020-04-19 14:40 ` [PATCH 3/3] x86/entry: remove an unused label Lai Jiangshan
2020-05-07 15:16   ` [tip: x86/entry] x86/entry/64: Remove " tip-bot2 for Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).