From: "Michael Uhler" <uhler@mips.com>
To: "'Dominic Sweetman'" <dom@mips.com>,
"'Ralf Baechle'" <ralf@linux-mips.org>
Cc: "'Kevin D. Kissell'" <KevinK@mips.com>,
"'S C'" <theansweriz42@hotmail.com>, <linux-mips@linux-mips.org>
Subject: RE: Strange, strange occurence
Date: Wed, 14 Jul 2004 10:45:15 -0700 [thread overview]
Message-ID: <001101c469ca$573be5b0$4001a8c0@MIPS.COM> (raw)
In-Reply-To: <16629.24775.778491.754688@arsenal.mips.com>
Dom's proposed solution is probably the right thing to do. We've got some
code in MIPS that does exactly this, and I've suggested that we convert this
to provide to the Linux community.
/gmu
---
Michael Uhler, Chief Technology Officer
MIPS Technologies, Inc. Email: uhler@mips.com
1225 Charleston Road Voice: (650)567-5025 FAX: (650)567-5225
Mountain View, CA 94043 Mobile: (650)868-6870 Admin: (650)567-5085
> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of
> Dominic Sweetman
> Sent: Wednesday, July 14, 2004 9:35 AM
> To: Ralf Baechle
> Cc: Kevin D. Kissell; S C; linux-mips@linux-mips.org
> Subject: Re: Strange, strange occurence
>
>
>
> Ralf Baechle (ralf@linux-mips.org) writes:
>
> > > A truly safe and general I-cache flush routine should itself run
> > > uncached...
>
> It depends what you mean by general, and uncached is not the
> only option. The spec says:
>
> "The operation of the instruction is UNPREDICTABLE if the cache line
> that contains the CACHE instruction is the target of an
> invalidate..."
>
> If you use hit-type cache operations in a kernel routine,
> then you're safe. I can't envisage any circumstance in which
> Linux would try to invalidate kernel mainline code locations
> from the I-cache (well, you might be doing something fabulous
> with debugging the kernel, but that's not normal and you'd
> hardly expect to be able to support such an activity with
> standard cache management calls).
>
> So this problem can only arise on index-type I-cache
> invalidation. I claim that a running kernel on a MIPS CPU
> should only use index-type invalidation when it is necessary
> to invalidate the entire I-cache. (If you use index-type
> operations for a range which doesn't resolve to "the whole
> cache" then that should be fixed).
>
> That implies that a MIPS32-paranoid "invalidate-whole-I-cache" routine
> should:
>
> 1. Identify which indexes might alias to cache lines
> containing the routines's own 'cache invalidate' instruction(s),
> and thus hit the problem. There won't be that many of them.
>
> 2. Arrange to skip those indexes when zapping the cache, then do
> something weird to invalidate that handful of lines. You could
> do that by running uncached, but you could also do it just by using
> some auxiliary routine which is known to be more than a cache line
> but much less than a whole I-cache span distant, so can't possibly
> alias to the same thing...
>
> This is fiddly, but not terribly difficult and should have a
> negligible performance impact.
>
> Does that make sense? Am I now, having named the solution,
> responsible for figuring out a patch (yeuch, I never wanted
> to be a kernel programmer again...).
>
> --
> Dominic Sweetman
> MIPS Technologies
>
>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Uhler" <uhler@mips.com>
To: 'Dominic Sweetman' <dom@mips.com>, 'Ralf Baechle' <ralf@linux-mips.org>
Cc: "'Kevin D. Kissell'" <KevinK@mips.com>,
'S C' <theansweriz42@hotmail.com>,
linux-mips@linux-mips.org
Subject: RE: Strange, strange occurence
Date: Wed, 14 Jul 2004 10:45:15 -0700 [thread overview]
Message-ID: <001101c469ca$573be5b0$4001a8c0@MIPS.COM> (raw)
Message-ID: <20040714174515.XZrlShw7LnotRFk7YJ_MW_z9LTBL7dLHpMyDBD3ixuE@z> (raw)
In-Reply-To: <16629.24775.778491.754688@arsenal.mips.com>
Dom's proposed solution is probably the right thing to do. We've got some
code in MIPS that does exactly this, and I've suggested that we convert this
to provide to the Linux community.
/gmu
---
Michael Uhler, Chief Technology Officer
MIPS Technologies, Inc. Email: uhler@mips.com
1225 Charleston Road Voice: (650)567-5025 FAX: (650)567-5225
Mountain View, CA 94043 Mobile: (650)868-6870 Admin: (650)567-5085
> -----Original Message-----
> From: linux-mips-bounce@linux-mips.org
> [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of
> Dominic Sweetman
> Sent: Wednesday, July 14, 2004 9:35 AM
> To: Ralf Baechle
> Cc: Kevin D. Kissell; S C; linux-mips@linux-mips.org
> Subject: Re: Strange, strange occurence
>
>
>
> Ralf Baechle (ralf@linux-mips.org) writes:
>
> > > A truly safe and general I-cache flush routine should itself run
> > > uncached...
>
> It depends what you mean by general, and uncached is not the
> only option. The spec says:
>
> "The operation of the instruction is UNPREDICTABLE if the cache line
> that contains the CACHE instruction is the target of an
> invalidate..."
>
> If you use hit-type cache operations in a kernel routine,
> then you're safe. I can't envisage any circumstance in which
> Linux would try to invalidate kernel mainline code locations
> from the I-cache (well, you might be doing something fabulous
> with debugging the kernel, but that's not normal and you'd
> hardly expect to be able to support such an activity with
> standard cache management calls).
>
> So this problem can only arise on index-type I-cache
> invalidation. I claim that a running kernel on a MIPS CPU
> should only use index-type invalidation when it is necessary
> to invalidate the entire I-cache. (If you use index-type
> operations for a range which doesn't resolve to "the whole
> cache" then that should be fixed).
>
> That implies that a MIPS32-paranoid "invalidate-whole-I-cache" routine
> should:
>
> 1. Identify which indexes might alias to cache lines
> containing the routines's own 'cache invalidate' instruction(s),
> and thus hit the problem. There won't be that many of them.
>
> 2. Arrange to skip those indexes when zapping the cache, then do
> something weird to invalidate that handful of lines. You could
> do that by running uncached, but you could also do it just by using
> some auxiliary routine which is known to be more than a cache line
> but much less than a whole I-cache span distant, so can't possibly
> alias to the same thing...
>
> This is fiddly, but not terribly difficult and should have a
> negligible performance impact.
>
> Does that make sense? Am I now, having named the solution,
> responsible for figuring out a patch (yeuch, I never wanted
> to be a kernel programmer again...).
>
> --
> Dominic Sweetman
> MIPS Technologies
>
>
next prev parent reply other threads:[~2004-07-14 17:49 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-09 18:50 Strange, strange occurence 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 7:49 ` Help with MOP network boot install on DECstation 5000/240 Collin Baillie
2004-07-13 8:03 ` Jan-Benedict Glaw
2004-07-14 6:57 ` Collin Baillie
2004-07-14 9:54 ` Maciej W. Rozycki
2004-07-14 12:44 ` Jan-Benedict Glaw
2004-07-14 12:51 ` Maciej W. Rozycki
2004-07-14 13:30 ` Jan-Benedict Glaw
2004-07-15 11:33 ` Maciej W. Rozycki
2004-07-14 12:43 ` Jan-Benedict Glaw
2004-07-16 14:41 ` Collin Baillie
2004-07-16 15:04 ` Jan-Benedict Glaw
2004-07-16 15:13 ` Maciej W. Rozycki
2004-07-16 15:08 ` Maciej W. Rozycki
2004-07-16 16:31 ` Thiemo Seufer
2004-07-16 16:51 ` Maciej W. Rozycki
2004-07-16 18:56 ` Thiemo Seufer
2004-07-13 15:31 ` Strange, strange occurence 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 [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2004-07-12 20:49 S C
2004-07-12 21:23 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
2004-07-12 23:10 S C
2004-07-30 21:06 G H
2004-07-31 5:09 ` Ralf Baechle
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='001101c469ca$573be5b0$4001a8c0@MIPS.COM' \
--to=uhler@mips.com \
--cc=KevinK@mips.com \
--cc=dom@mips.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@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 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.