Skip to contentSkip to conversation

x86/kexec: Add a comment to relocate_kernel() for better readability

PATCH Superseded Kai Huang 2 participants 4 messages Jun 7, 2023 – Jun 8, 2023 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kai Huang

author
#0 lore raw

PATCH 1/1 x86/kexec: Add a comment to relocate_kernel() for better readability

The reason to save %rcx to %r11 before calling swap_pages isn't that obvious w/o looking into the swap_pages itself. Add a comment to improve the readability.

---
 arch/x86/kernel/relocate_kernel_64.S | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kernel/relocate_kernel_64.S +4 -0
index 56cab1bb25f5..97deae3c5e6c 100644
@@ -169,6 +169,10 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
 	wbinvd
 1:
 
+	/*
+	 * Save the preserve_context to %r11 as
+	 * swap_pages clobbers %rcx.
+	 */
 	movq	%rcx, %r11
 	call	swap_pages
 

base-commit: 409bf2895d71bb68bc5b8589036e5ed1ca30bada

Signature · 1 line
2.40.1
#1 lore raw
Quoted 14 lines · Kai Huang

The reason to save %rcx to %r11 before calling swap_pages isn't that obvious w/o looking into the swap_pages itself. Add a comment to improve the readability.

---
 arch/x86/kernel/relocate_kernel_64.S | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kernel/relocate_kernel_64.S +0 -0
index 56cab1bb25f5..97deae3c5e6c 100644

arch/x86/kernel/relocate_kernel_64.S SYM_CODE_START_LOCAL_NOALIGN(identity_mapped) · line 175

Quoted 7 lines
arch/x86/kernel/relocate_kernel_64.S +4 -0
@@ -169,6 +169,10 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
 	wbinvd
 1:
 
+	/*
+	 * Save the preserve_context to %r11 as
+	 * swap_pages clobbers %rcx.
+	 */

Line split is not needed. It fits nicely under 80-characters.

+ /* Save the preserve_context to %r11 as swap_pages clobbers %rcx. */

Otherwise, LGTM.

Quoted 8 lines
arch/x86/kernel/relocate_kernel_64.S +0 -0
 	movq	%rcx, %r11
 	call	swap_pages
 

base-commit: 409bf2895d71bb68bc5b8589036e5ed1ca30bada

Signature · 1 line
2.40.1
Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov
author
#2 lore raw
Quoted 27 lines · On Wed, 2023-06-07 at 14:19 +0300, [email protected] wrote:
Quoted 14 lines · Kai Huang

The reason to save %rcx to %r11 before calling swap_pages isn't that obvious w/o looking into the swap_pages itself. Add a comment to improve the readability.

---
 arch/x86/kernel/relocate_kernel_64.S | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kernel/relocate_kernel_64.S +0 -0
index 56cab1bb25f5..97deae3c5e6c 100644

arch/x86/kernel/relocate_kernel_64.S SYM_CODE_START_LOCAL_NOALIGN(identity_mapped) · line 175

Quoted 7 lines
arch/x86/kernel/relocate_kernel_64.S +4 -0
@@ -169,6 +169,10 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
 	wbinvd
 1:
 
+	/*
+	 * Save the preserve_context to %r11 as
+	 * swap_pages clobbers %rcx.
+	 */

Line split is not needed. It fits nicely under 80-characters.

(quoted diff) +1 -0
+	/* Save the preserve_context to %r11 as swap_pages clobbers %rcx. */
Quoted 1 line

Otherwise, LGTM.

Sure. Will do.

With above change, may I add your Acked-by ? :)

Quoted 10 lines
Quoted 9 lines
arch/x86/kernel/relocate_kernel_64.S +0 -0
 	movq	%rcx, %r11
 	call	swap_pages
 

base-commit: 409bf2895d71bb68bc5b8589036e5ed1ca30bada

Signature · 1 line
2.40.1
#3 lore raw
Quoted 26 lines · Kai
Quoted 25 lines · On Wed, 2023-06-07 at 14:19 +0300, [email protected] wrote:
Quoted 14 lines · Kai Huang

The reason to save %rcx to %r11 before calling swap_pages isn't that obvious w/o looking into the swap_pages itself. Add a comment to improve the readability.

---
 arch/x86/kernel/relocate_kernel_64.S | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kernel/relocate_kernel_64.S +0 -0
index 56cab1bb25f5..97deae3c5e6c 100644

arch/x86/kernel/relocate_kernel_64.S SYM_CODE_START_LOCAL_NOALIGN(identity_mapped) · line 175

Quoted 7 lines
arch/x86/kernel/relocate_kernel_64.S +4 -0
@@ -169,6 +169,10 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
 	wbinvd
 1:
 
+	/*
+	 * Save the preserve_context to %r11 as
+	 * swap_pages clobbers %rcx.
+	 */

Line split is not needed. It fits nicely under 80-characters.

Quoted 7 lines
Quoted 3 lines
(quoted diff) +1 -0
+	/* Save the preserve_context to %r11 as swap_pages clobbers %rcx. */

Otherwise, LGTM.

Sure. Will do.

With above change, may I add your Acked-by ? :)

Sure.

Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov