All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Rocky Craig <rocky.craig@hp.com>
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.6.27] [POWERPC] Invalidate all TLB entries in a specified range
Date: Fri, 15 Aug 2008 08:28:01 +1000	[thread overview]
Message-ID: <1218752881.8041.261.camel@pasglop> (raw)
In-Reply-To: <48A42F1A.6080903@hp.com>

On Thu, 2008-08-14 at 07:11 -0600, Rocky Craig wrote:
> From: Rocky Craig <rocky.craig@hp.com>
> 
> The apparent intent of "flush_tlbs" is to invalidate TLB entries that
> might match in the address range 0 to 0x00400000.  A loop counter is 
> set up at the high value and decremented by page size.  However, the 
> loop is only done once as the sense of the conditional branch at the
> loop end does not match the setup/decrement.
> 
> Signed-off-by: Rocky Craig <rocky.craig@hp.com>
> ---
> 
> Source is from 2.6.27 development, but the bug appears as far back as 2.4.0.
> The small user-space program below demonstrates the loop behavior.  It was
> compiled via crosstool gcc 3.4.5 / glibc 2.3.6 for an MPC8347 target.

Heh nice, that's a bug as old as the port I would say :-)

Ben.
 
> int main()
> {
> 	long endval;				// 16(r31)
> 
> 	__asm__ __volatile__(
> 		"	lis 10,0x40\n"
> 		"1:	addic. 10,10,-0x1000\n"
> 		"	bgt 1b\n"
> 		"	stw 10,16(31)\n");	// endval
> 
> 	printf("end value = 0x%08lx\n", endval);
> }
> 
> This might win the prize for "Smallest actual code patch ever".
> 
> --- a/arch/powerpc/kernel/head_32.S.orig	2008-07-24 19:25:09.000000000 -0600
> +++ a/arch/powerpc/kernel/head_32.S	2008-07-24 19:25:22.000000000 -0600
> @@ -1155,7 +1155,7 @@ flush_tlbs:
>  	lis	r10, 0x40
>  1:	addic.	r10, r10, -0x1000
>  	tlbie	r10
> -	blt	1b
> +	bgt	1b
>  	sync
>  	blr
>  
> 
> 

      reply	other threads:[~2008-08-14 22:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14 13:11 [PATCH 2.6.27] [POWERPC] Invalidate all TLB entries in a specified range Rocky Craig
2008-08-14 13:11 ` Rocky Craig
2008-08-14 22:28 ` Benjamin Herrenschmidt [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=1218752881.8041.261.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=rocky.craig@hp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.