From: Ralf Baechle <ralf@linux-mips.org>
To: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc: linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH 1/3] fixed mtc0_tlbw_hazard
Date: Mon, 25 Sep 2006 15:24:27 +0100 [thread overview]
Message-ID: <20060925142427.GD20048@linux-mips.org> (raw)
In-Reply-To: <20060922010713.657f2861.yoichi_yuasa@tripeaks.co.jp>
On Fri, Sep 22, 2006 at 01:07:13AM +0900, Yoichi Yuasa wrote:
> diff -pruN -X mips/Documentation/dontdiff mips-orig/include/asm-mips/hazards.h mips/include/asm-mips/hazards.h
> --- mips-orig/include/asm-mips/hazards.h 2006-09-21 18:21:11.793973750 +0900
> +++ mips/include/asm-mips/hazards.h 2006-09-21 18:55:07.569201750 +0900
> @@ -138,7 +138,7 @@ ASMMACRO(back_to_back_c0_hazard,
> * Mostly like R4000 for historic reasons
> */
> ASMMACRO(mtc0_tlbw_hazard,
> - b . + 8
> + nop; nop; nop; nop; nop; nop
> )
This is a patch for the SB1 section of hazards.h; the SB1 does not have
have this hazard so if anything this hazard should be deleted entirely as
in this patch.
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index dabfc0e..9bb7b4c 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -138,13 +138,10 @@ #elif defined(CONFIG_CPU_SB1)
* Mostly like R4000 for historic reasons
*/
ASMMACRO(mtc0_tlbw_hazard,
- b . + 8
)
ASMMACRO(tlbw_use_hazard,
- nop; nop; nop; nop; nop; nop
)
ASMMACRO(tlb_probe_hazard,
- nop; nop; nop; nop; nop; nop
)
ASMMACRO(tlbw_eret_hazard,
)
> @@ -169,7 +169,7 @@ ASMMACRO(back_to_back_c0_hazard,
> * processors.
> */
> ASMMACRO(mtc0_tlbw_hazard,
> - b . + 8
> + nop; nop; nop; nop; nop; nop
6 nops is quite some overkill - or does Vr41xx need those? On R4000/R4600
the mtc0..tlbw hazard is one cycle. So this one should be a single nop
at most for these cpus.
The macroized hazard barriers aren't used anymore the way they used to;
this is the way the branch trick was meant to be used:
mtc0 k1, CP0_ENTRYLO1
b 1f
tlbwr
1: nop
eret
This works because the R4000 kills the two instructions following the
branch delay slot so needs three cycles between the tlbwr and eret. At
the same time it has a three cycle hazard to cover. On the R4600 otoh
the branch latency and the hazard is shorter by two cycles so the branch
trick gives optimal performance for both processors. But that kind of
optimization only really matters to TLB refill handlers and we now got a
different strategy for those anyway.
Talking about nops, R4000 TLBP writes c0_index on stage 7, mfc0 reads
c0_index on stage 4 so tlb_probe_hazard needs 3 nop so the resulting
patch for the catch all case would be:
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 7015764..0c39583 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -157,18 +157,18 @@ #else
* processors.
*/
ASMMACRO(mtc0_tlbw_hazard,
- b . + 8
+ nop
)
ASMMACRO(tlbw_use_hazard,
- nop; nop; nop; nop; nop; nop
+ nop; nop; nop
)
ASMMACRO(tlb_probe_hazard,
- nop; nop; nop; nop; nop; nop
+ nop; nop; nop
)
ASMMACRO(irq_enable_hazard,
)
ASMMACRO(irq_disable_hazard,
- _ssnop; _ssnop; _ssnop
+ nop; nop; nop
)
ASMMACRO(back_to_back_c0_hazard,
_ssnop; _ssnop; _ssnop;
Ralf
prev parent reply other threads:[~2006-09-25 14:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-21 16:07 [PATCH 1/3] fixed mtc0_tlbw_hazard Yoichi Yuasa
2006-09-21 16:10 ` [PATCH 2/3] fixed typo in hazard.h Yoichi Yuasa
2006-09-21 16:13 ` [PATCH 3/3] remove some redefinitions " Yoichi Yuasa
2006-09-25 15:14 ` Ralf Baechle
2006-09-25 14:49 ` [PATCH 2/3] fixed typo " Ralf Baechle
2006-09-21 16:22 ` [PATCH 1/3] fixed mtc0_tlbw_hazard Sergei Shtylyov
2006-09-21 16:41 ` Yoichi Yuasa
2006-09-21 17:01 ` Sergei Shtylyov
2006-09-22 3:17 ` Yoichi Yuasa
2006-09-25 14:28 ` Ralf Baechle
2006-09-25 14:26 ` Ralf Baechle
2006-09-22 5:16 ` Atsushi Nemoto
2006-09-22 5:47 ` Yoichi Yuasa
2006-09-25 14:24 ` Ralf Baechle [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=20060925142427.GD20048@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=yoichi_yuasa@tripeaks.co.jp \
/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