public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Puranjay Mohan <puranjay12@gmail.com>
Cc: catalin.marinas@arm.com, will@kernel.org,
	anshuman.khandual@arm.com, ardb@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: head: remove unnecessary instructions from __relocate_kernel
Date: Mon, 4 Mar 2024 09:25:38 +0000	[thread overview]
Message-ID: <ZeWThcOa-cW2Ax5a@FVFF77S0Q05N> (raw)
In-Reply-To: <20240302145210.65919-1-puranjay12@gmail.com>

On Sat, Mar 02, 2024 at 02:52:10PM +0000, Puranjay Mohan wrote:
> Formerly, we had to access the RELA and RELR tables via the kernel
> mapping that was being relocated, and so deriving the start and end
> addresses was done by loading __rela_offset in x9 and then adding the
> actual virtual offset of the kernel to it.
> 
> d7bea550279d ("arm64: head: use relative references to the RELA and RELR
> tables") changed this to load the entries via the ID map as we map the
> entire kernel image via the ID map.
> 
> The two instructions for finding the actual virtual offset were left by
> that commit, so remove them now as they are unnecessary and add runtime
> overhead.

These instructions are already gone in linux-next; they're removed by commit:

  734958ef0b5497b1 ("arm64: head: move relocation handling to C code")

... so this patch isn't necessary.

> Fixes: d7bea550279d ("arm64: head: use relative references to the RELA and RELR tables")

As a heads-up for future patches, while this would be a cleanup it is not a
fix, and wouldn't need a fixes tag.

Mark.

> Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
> ---
>  arch/arm64/kernel/head.S | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index cab7f91949d8..90db196f7c19 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -787,8 +787,6 @@ SYM_FUNC_START_LOCAL(__relocate_kernel)
>  	 */
>  	adr_l	x9, __rela_start
>  	adr_l	x10, __rela_end
> -	mov_q	x11, KIMAGE_VADDR		// default virtual offset
> -	add	x11, x11, x23			// actual virtual offset
>  
>  0:	cmp	x9, x10
>  	b.hs	1f
> 
> base-commit: 5ad3cb0ed525b80c7f66c32b49a68c1f3510bec9
> -- 
> 2.42.0
> 

      reply	other threads:[~2024-03-04  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02 14:52 [PATCH] arm64: head: remove unnecessary instructions from __relocate_kernel Puranjay Mohan
2024-03-04  9:25 ` Mark Rutland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZeWThcOa-cW2Ax5a@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puranjay12@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox