Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: James Hogan <james.hogan@imgtec.com>, linux-mips@linux-mips.org
Subject: Re: [PATCH v2 02/10] MIPS: hazards: Add hazard macros for tlb read
Date: Tue, 26 May 2015 14:53:45 +0200	[thread overview]
Message-ID: <20150526125344.GD13022@linux-mips.org> (raw)
In-Reply-To: <alpine.LFD.2.11.1505261311590.11225@eddie.linux-mips.org>

On Tue, May 26, 2015 at 01:36:37PM +0100, Maciej W. Rozycki wrote:

> > - tlb_read_hazard
> >   Between tlbr and mfc0 (various TLB registers). This is copied from
> >   tlbw_use_hazard in all cases on the assumption that tlbr has similar
> >   data writer characteristics to tlbw, and mfc0 has similar data user
> >   characteristics to loads and stores.
> 
>  Be careful with this assumption, it does not stand for R4600/R4700 and 
> R5000 processors (4 vs 3 intervening instructions), you need an extra NOP 
> for them.  Likewise there is a difference with the 5K (1 vs 0 intervening 
> instructions), but it's already buried in our pessimistic barrier that 
> assumes 4 intervening instructions.

The TLB write hazard is 4 cycles on the 8 stage R4000 pipeline but 2 cycles
on the R4600 pipeline.  We handle this in a particularly non-obvious but
optimized way by exploiting the fact that the R4000 pipeline kills two
instructions following the branch delay slot like:

	.set	noreorder
	MTC0	$reg, c0_sometlbregister
	B	1f
1:	 NOP
	TLBW

where the branch-nop sequence will cost 4 cycles on the R4000's eight-stage
pipeline but only two on the R4600 pipeline.

  Ralf

  reply	other threads:[~2015-05-26 12:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19  8:50 [PATCH v2 00/10] MIPS: dump_tlb improvements James Hogan
2015-05-19  8:50 ` James Hogan
2015-05-19  8:50 ` [PATCH RFC v2 01/10] MIPS: Add SysRq operation to dump TLBs on all CPUs James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-24 21:21   ` Joshua Kinard
2015-05-26 11:58     ` Maciej W. Rozycki
2015-05-27 13:09       ` Maciej W. Rozycki
2015-07-14  9:27       ` James Hogan
2015-07-14  9:27         ` James Hogan
2015-05-19  8:50 ` [PATCH v2 02/10] MIPS: hazards: Add hazard macros for tlb read James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-26 12:36   ` Maciej W. Rozycki
2015-05-26 12:53     ` Ralf Baechle [this message]
2015-05-26 13:25       ` Maciej W. Rozycki
2015-05-26 13:32         ` Ralf Baechle
2015-05-19  8:50 ` [PATCH v2 03/10] MIPS: mipsregs.h: Add EntryLo bit definitions James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-28 23:47   ` Maciej W. Rozycki
2015-05-19  8:50 ` [PATCH v2 04/10] MIPS: dump_tlb: Use tlbr hazard macros James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 05/10] MIPS: dump_tlb: Refactor TLB matching James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 06/10] MIPS: dump_tlb: Make use of EntryLo bit definitions James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 07/10] MIPS: dump_tlb: Take global bit into account James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 08/10] MIPS: dump_tlb: Take EHINV " James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 09/10] MIPS: dump_tlb: Take RI/XI bits " James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 10/10] MIPS: dump_tlb: Take XPA " James Hogan
2015-05-19  8:50   ` James Hogan

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=20150526125344.GD13022@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=james.hogan@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.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