mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/kexec: Add a comment to relocate_kernel() for better readability
@ 2023-06-07 10:39 Kai Huang
  2023-06-07 11:19 ` kirill.shutemov
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Huang @ 2023-06-07 10:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: dave.hansen, kirill.shutemov, peterz, hpa, konrad.wilk, rostedt,
	jpoimboe, 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.

Signed-off-by: Kai Huang <kai.huang@intel.com>
---
 arch/x86/kernel/relocate_kernel_64.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
index 56cab1bb25f5..97deae3c5e6c 100644
--- a/arch/x86/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
@@ -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
-- 
2.40.1


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

* Re: [PATCH] x86/kexec: Add a comment to relocate_kernel() for better readability
  2023-06-07 10:39 [PATCH] x86/kexec: Add a comment to relocate_kernel() for better readability Kai Huang
@ 2023-06-07 11:19 ` kirill.shutemov
  2023-06-08  4:41   ` Huang, Kai
  0 siblings, 1 reply; 4+ messages in thread
From: kirill.shutemov @ 2023-06-07 11:19 UTC (permalink / raw)
  To: Kai Huang
  Cc: linux-kernel, dave.hansen, peterz, hpa, konrad.wilk, rostedt, jpoimboe

On Wed, Jun 07, 2023 at 10:39:10PM +1200, Kai Huang wrote:
> 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.
> 
> Signed-off-by: Kai Huang <kai.huang@intel.com>
> ---
>  arch/x86/kernel/relocate_kernel_64.S | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> index 56cab1bb25f5..97deae3c5e6c 100644
> --- a/arch/x86/kernel/relocate_kernel_64.S
> +++ b/arch/x86/kernel/relocate_kernel_64.S
> @@ -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.

>  	movq	%rcx, %r11
>  	call	swap_pages
>  
> 
> base-commit: 409bf2895d71bb68bc5b8589036e5ed1ca30bada
> -- 
> 2.40.1
> 

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

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

* Re: [PATCH] x86/kexec: Add a comment to relocate_kernel() for better readability
  2023-06-07 11:19 ` kirill.shutemov
@ 2023-06-08  4:41   ` Huang, Kai
  2023-06-08 11:25     ` kirill.shutemov
  0 siblings, 1 reply; 4+ messages in thread
From: Huang, Kai @ 2023-06-08  4:41 UTC (permalink / raw)
  To: kirill.shutemov
  Cc: hpa, peterz, rostedt, jpoimboe, linux-kernel, dave.hansen, Wilk, Konrad

On Wed, 2023-06-07 at 14:19 +0300, kirill.shutemov@linux.intel.com wrote:
> On Wed, Jun 07, 2023 at 10:39:10PM +1200, Kai Huang wrote:
> > 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.
> > 
> > Signed-off-by: Kai Huang <kai.huang@intel.com>
> > ---
> >  arch/x86/kernel/relocate_kernel_64.S | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> > index 56cab1bb25f5..97deae3c5e6c 100644
> > --- a/arch/x86/kernel/relocate_kernel_64.S
> > +++ b/arch/x86/kernel/relocate_kernel_64.S
> > @@ -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.

Sure.  Will do.

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

> 
> >  	movq	%rcx, %r11
> >  	call	swap_pages
> >  
> > 
> > base-commit: 409bf2895d71bb68bc5b8589036e5ed1ca30bada
> > -- 
> > 2.40.1
> > 
> 


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

* Re: [PATCH] x86/kexec: Add a comment to relocate_kernel() for better readability
  2023-06-08  4:41   ` Huang, Kai
@ 2023-06-08 11:25     ` kirill.shutemov
  0 siblings, 0 replies; 4+ messages in thread
From: kirill.shutemov @ 2023-06-08 11:25 UTC (permalink / raw)
  To: Huang, Kai
  Cc: hpa, peterz, rostedt, jpoimboe, linux-kernel, dave.hansen, Wilk, Konrad

On Thu, Jun 08, 2023 at 04:41:37AM +0000, Huang, Kai wrote:
> On Wed, 2023-06-07 at 14:19 +0300, kirill.shutemov@linux.intel.com wrote:
> > On Wed, Jun 07, 2023 at 10:39:10PM +1200, Kai Huang wrote:
> > > 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.
> > > 
> > > Signed-off-by: Kai Huang <kai.huang@intel.com>
> > > ---
> > >  arch/x86/kernel/relocate_kernel_64.S | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> > > index 56cab1bb25f5..97deae3c5e6c 100644
> > > --- a/arch/x86/kernel/relocate_kernel_64.S
> > > +++ b/arch/x86/kernel/relocate_kernel_64.S
> > > @@ -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.
> 
> Sure.  Will do.
> 
> With above change, may I add your Acked-by ? :)

Sure.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

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

end of thread, other threads:[~2023-06-08 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 10:39 [PATCH] x86/kexec: Add a comment to relocate_kernel() for better readability Kai Huang
2023-06-07 11:19 ` kirill.shutemov
2023-06-08  4:41   ` Huang, Kai
2023-06-08 11:25     ` kirill.shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®