public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: leroy christophe <christophe.leroy@c-s•fr>
To: LinuxPPC-dev <linuxppc-dev@lists•ozlabs.org>,
	Scott Wood <scottwood@freescale•com>
Subject: Feedback wished on possible improvment of CPU15 errata handling on mpc8xx
Date: Thu, 29 Aug 2013 19:11:48 +0200	[thread overview]
Message-ID: <521F80D4.2030300@c-s.fr> (raw)

The mpc8xx powerpc has an errata identified CPU15 which is that whenever 
the last instruction of a page is a conditional branch to the last 
instruction of the next page, the CPU might do crazy things.

To work around this errata, one of the workarounds proposed by freescale is:
"In the ITLB miss exception code, when loading the TLB for an MMU page, 
also invalidate any TLB referring to the next and previous page using 
tlbie. This intentionally forces an ITLB miss exception on every 
execution across sequential MMU page boundaries"

It is that workaround which has been implemented in the kernel. The 
drawback of this workaround is that TLB miss is encountered everytime we 
cross page boundary. On a flat program execution, it means that we get a 
TLB miss every 1000 instructions. A TLB miss handling is around 30/40 
instructions, which means a degradation of about 4% of the performances.
It can be even worse if the program has a loop astride two pages.

In the errata document from freescale, there is an example where they 
only invalidate the TLB when the page has the actual issue, in extenso 
when the page has the offending instruction at offset 0xffc, and they 
suggest to use the available PTE bits to tag pages in advance.

I checked in asm/pte-8xx.h : we still have one SW bit available 
(0x0080). So I was thinking about using that bit to mark pages 
CPU15_SAFE when loading them if they don't have the offending instruction.

Then, in the ITLBmiss handler, instead of always invalidating preceeding 
and following pages, we would check SW bit in the PTE and invalidate 
following page only if current page is not marked CPU15_SAFE, then check 
the PTE of preceeding page and invalidate it only if it is not marked 
CPU15_SAFE

I believe this would improve the CPU15 errata handling and would reduce 
the overhead introduced by the handling of this errata.

Do you see anything wrong with my proposal ?

Christophe

             reply	other threads:[~2013-08-29 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29 17:11 leroy christophe [this message]
2013-08-29 17:57 ` Feedback wished on possible improvment of CPU15 errata handling on mpc8xx Joakim Tjernlund
2013-08-29 21:04   ` leroy christophe
2013-08-29 21:26     ` Joakim Tjernlund

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=521F80D4.2030300@c-s.fr \
    --to=christophe.leroy@c-s$(echo .)fr \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=scottwood@freescale$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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