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: arm and patch phys offset
Date: Mon, 12 Dec 2011 21:57:36 +0000	[thread overview]
Message-ID: <20111212215736.GE20178@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.02.1112121627030.2907@xanadu.home>

On Mon, Dec 12, 2011 at 04:38:07PM -0500, Nicolas Pitre wrote:
> You could try instrumenting the patching code, although it is a bit 
> tricky because of the non-standard register life rules in that file.  
> But something like this should tell you if the expected amount of fixups 
> were applied:
> 
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index 08c82fd844..7f43d1fe01 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -530,14 +530,23 @@ __fixup_a_pv_table:
>  	bcc	1b
>  	bx	lr
>  #else
> +	mov	r0, #0
>  	b	2f
>  1:	ldr	ip, [r7, r3]
>  	bic	ip, ip, #0x000000ff
>  	orr	ip, ip, r6	@ mask in offset bits 31-24
>  	str	ip, [r7, r3]
> +	add	r0, r0, #1
>  2:	cmp	r4, r5
>  	ldrcc	r7, [r4], #4	@ use branch for delay slot
>  	bcc	1b

If you look at this code, there is _no_ way it can fixup only some entries
in the table and not others - unless the CPU starts executing something
which isn't this code.

It quite simply loads the address of each entry in the table, incrementing
the pointer by a word size.  It then _unconditionally_ loads, modifies
and stores the instruction at the location in question.

The termination condition is when r4 >= r5, which will prevent the loading
of the next pointer _and_ prevent the looping, thus terminating the fixup
altogether.

So, something else is going on.  If I had to guess, I'd suspect the kernel
is being called with caches enabled - which violates the expectations of
the kernel set down many years ago.

  reply	other threads:[~2011-12-12 21:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201112112255.32534.michael@walle.cc>
2011-12-12  0:53 ` arm and patch phys offset Nicolas Pitre
2011-12-12 21:12   ` Michael Walle
2011-12-12 21:34     ` Russell King - ARM Linux
2011-12-12 21:55       ` Michael Walle
2011-12-12 22:02         ` Russell King - ARM Linux
2011-12-12 22:09           ` Michael Walle
2011-12-12 22:21             ` Russell King - ARM Linux
2011-12-12 22:56               ` Nicolas Pitre
2011-12-13  0:08                 ` Michael Walle
2011-12-13  4:01                   ` Nicolas Pitre
2011-12-13 23:17                     ` Michael Walle
2011-12-18 11:58                       ` Tixy
2012-01-03  7:15                   ` Linus Walleij
2012-01-03  7:41                     ` Michael Walle
2011-12-12 21:38     ` Nicolas Pitre
2011-12-12 21:57       ` Russell King - ARM Linux [this message]
2011-12-12 22:25         ` Nicolas Pitre
2011-12-12 22:06       ` Michael Walle

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=20111212215736.GE20178@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).