linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFT/RFC PATCH 1/6] ARM: replace PROCINFO embedded branch with relative offset
Date: Thu, 12 Mar 2015 20:50:59 +0000	[thread overview]
Message-ID: <20150312205059.GX8656@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1426181892-15440-2-git-send-email-ard.biesheuvel@linaro.org>

On Thu, Mar 12, 2015 at 06:38:07PM +0100, Ard Biesheuvel wrote:
> @@ -138,8 +138,9 @@ ENTRY(stext)
>  						@ mmu has been enabled
>  	adr	lr, BSYM(1f)			@ return (PIC) address
>  	mov	r8, r4				@ set TTBR1 to swapper_pg_dir
> - ARM(	add	pc, r10, #PROCINFO_INITFUNC	)
> - THUMB(	add	r12, r10, #PROCINFO_INITFUNC	)
> +	ldr	r12, [r10, #PROCINFO_INITFUNC]
> + ARM(	add	pc, r12, r10			)
> + THUMB(	add	r12, r12, r10			)
>   THUMB(	ret	r12				)

Given this change, I'd prefer a slightly different result:

	ldr	r12, [r10, #PROCINFO_INITFUNC]
	add	r12, r12, r10
	ret	r12

>  1:	b	__enable_mmu
>  ENDPROC(stext)
> @@ -386,10 +387,11 @@ ENTRY(secondary_startup)
>  	ldr	r8, [r7, lr]			@ get secondary_data.swapper_pg_dir
>  	adr	lr, BSYM(__enable_mmu)		@ return address
>  	mov	r13, r12			@ __secondary_switched address
> - ARM(	add	pc, r10, #PROCINFO_INITFUNC	) @ initialise processor
> -						  @ (return control reg)
> - THUMB(	add	r12, r10, #PROCINFO_INITFUNC	)
> - THUMB(	ret	r12				)
> +	ldr	r12, [r10, #PROCINFO_INITFUNC]
> + ARM(	add	pc, r12, r10		)	@ initialise processor
> +						@ (return control reg)
> + THUMB(	add	r12, r12, r10		)
> + THUMB(	ret	r12			)

and same here.  It means that we have less code to look at, at the expense
of one additional ARM instruction.

> +
> +.macro	initfn, initfunc
> +	.long	\initfunc - . + PROCINFO_INITFUNC
> +.endm

The more I look at this, the more I find it hard to decide whether this
is correct or not, and that means it's bad.  It is correct, but it needs
some thought to confirm that.  I'd prefer a different solution.

The value which we want to place into this location is the difference
between the start of the procinfo structure and the target symbol.  So
let's do that - we have a symbol for each procinfo structure, let's
make "initfn" take that symbol and do the computation using that.

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

  parent reply	other threads:[~2015-03-12 20:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 17:38 [RFT/RFC PATCH 0/6] ARM kernel size fixes Ard Biesheuvel
2015-03-12 17:38 ` [RFT/RFC PATCH 1/6] ARM: replace PROCINFO embedded branch with relative offset Ard Biesheuvel
2015-03-12 20:24   ` Nicolas Pitre
2015-03-12 20:50   ` Russell King - ARM Linux [this message]
2015-03-12 21:00     ` Ard Biesheuvel
2015-03-12 17:38 ` [RFT/RFC PATCH 2/6] ARM: move HYP text to end of .text section Ard Biesheuvel
2015-03-12 17:38 ` [RFT/RFC PATCH 3/6] ARM: add macro to perform far branches (b/bl) Ard Biesheuvel
2015-03-12 20:32   ` Nicolas Pitre
2015-03-12 20:36     ` Ard Biesheuvel
2015-03-12 21:03       ` Nicolas Pitre
2015-03-12 21:15         ` Ard Biesheuvel
2015-03-12 21:37           ` Ard Biesheuvel
2015-03-12 22:26             ` Nicolas Pitre
2015-03-12 20:56   ` Russell King - ARM Linux
2015-03-12 17:38 ` [RFT/RFC PATCH 4/6] ARM: use bl_far to call __hyp_stub_install_secondary from the .data section Ard Biesheuvel
2015-03-12 17:38 ` [RFT/RFC PATCH 5/6] ARM: move the .idmap.text section closer to .head.text Ard Biesheuvel
2015-03-12 20:33   ` Nicolas Pitre
2015-03-12 17:38 ` [RFT/RFC PATCH 6/6] ARM: keep .text and .fixup regions together Ard Biesheuvel
2015-03-12 20:34   ` Nicolas Pitre
2015-03-12 21:10   ` Russell King - ARM Linux
2015-03-12 21:18     ` Ard Biesheuvel
2015-03-12 21:22       ` Russell King - ARM Linux
2015-03-13 11:18         ` Arnd Bergmann
2015-03-13 11:26           ` Ard Biesheuvel
2015-03-13 11:52             ` Arnd Bergmann

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=20150312205059.GX8656@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).