From: Ralf Baechle <ralf@linux-mips.org>
To: S C <theansweriz42@hotmail.com>
Cc: linux-mips@linux-mips.org
Subject: Re: Strange, strange occurence
Date: Tue, 13 Jul 2004 01:00:46 +0200 [thread overview]
Message-ID: <20040712230046.GA6176@linux-mips.org> (raw)
In-Reply-To: <BAY2-F27mxl2RtYP35u0000d191@hotmail.com>
On Mon, Jul 12, 2004 at 09:23:20PM +0000, S C wrote:
> And thinking about it a little more, I might as well clarfy my
> understanding while we're on the topic.
>
> Here's a code snippet from r4k_tlb_init() in arch/mips/mm/c-r4k.c
>
> memcpy((void *)KSEG0, &except_vec0_r4000, 0x80);
> flush_icache_range(KSEG0, KSEG0 + 0x80);
>
> So my understanding is that the TLB exception handler is being copied to
> the right memory location, and just in case some other TLB exception
> handler (YAMON's presumably) is residing in I-cache, to flush ( hit
> invalidate) it. Is this correct?
>
> Shouldn't there be code to writeback_invalidate the exception handler from
> the data cache ?
flush_icache_range() does that where necessary.
> Presumably the memcpy causes the TLB handler to lodge
> itself in the D cache till it is moved to RAM
Correct. All MIPS processors [1] do their primary I-cache refills from
second or third level cache or memory - whatever hits first. If code
was changed a flush of the data cache is required so the I-cache can
actually fetch the new data and because old stale code might still be
in the I-cache an I-cache flush is also required.
> (either explicitly or when
> some other lines replace the cache lines where the handler is), right?
>
> Thanks in advance for helping me understand the issue here.
Ralf
[1] Exceptions are the R4000/R4400 SC and MC versions in a split S-cache
configuration where the primary I-cache is refilled from the secondary
I-cache which mean this flush has to flush the secondary data cache
back to memory also. Linux doesn't support this configuration because
no known system uses it iow it's only a theoretically possible config.
The second exception are the AMD MIPS32 processors where the I-cache
is snooping the D-cache and therefore the D-cache flush can is
unnecessary.
The third exception are R1x000 in SMP configurations where I-caches
snoop remote stores so coherency doesn't need any maintenance in
software at all. Only the I-cache of the CPU that did modify the code
needs flushing.
next prev parent reply other threads:[~2004-07-12 23:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-12 21:23 Strange, strange occurence S C
2004-07-12 21:48 ` Kevin D. Kissell
2004-07-12 21:48 ` Kevin D. Kissell
2004-07-12 22:25 ` Kevin D. Kissell
2004-07-12 22:25 ` Kevin D. Kissell
2004-07-12 23:13 ` Ralf Baechle
2004-07-12 23:11 ` Ralf Baechle
2004-07-12 23:00 ` Ralf Baechle [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-07-30 21:06 G H
2004-07-31 5:09 ` Ralf Baechle
2004-07-12 23:10 S C
2004-07-12 20:49 S C
2004-07-09 18:50 S C
2004-07-10 7:33 ` Niels Sterrenburg
2004-07-10 10:04 ` Ralf Baechle
2004-07-12 15:16 ` Kevin D. Kissell
2004-07-12 15:16 ` Kevin D. Kissell
2004-07-13 0:33 ` Ralf Baechle
2004-07-13 15:31 ` Kevin D. Kissell
2004-07-13 15:31 ` Kevin D. Kissell
2004-07-14 12:02 ` Maciej W. Rozycki
2004-07-14 16:35 ` Dominic Sweetman
2004-07-14 17:45 ` Michael Uhler
2004-07-14 17:45 ` Michael Uhler
2004-07-15 1:34 ` Atsushi Nemoto
2004-07-15 1:53 ` Ralf Baechle
2004-07-16 12:24 ` Ralf Baechle
2004-07-16 16:05 ` Atsushi Nemoto
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=20040712230046.GA6176@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=theansweriz42@hotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox