All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kevin D. Kissell" <kevink@mips.com>
To: "Jun Sun" <jsun@mvista.com>, <linux-mips@oss.sgi.com>
Subject: Re: CONFIG_MIPS_UNCACHED
Date: Sat, 23 Jun 2001 19:17:28 +0200	[thread overview]
Message-ID: <01ee01c0fc08$66e81e80$0deca8c0@Ulysses> (raw)
In-Reply-To: 3B34BE3B.B72D40F1@mvista.com

> I looked at the code and it appears this config may not work properly.
>
> My understanding is that if CPU has been running with cache enabled, and,
> presummably, have many dirty cache entries, and if you suddenly change
config
> register to run kernel uncached, you *don't* get all the dirty cache lines
> flushed into memory.  Therefore, you will be accessing stale data in
memory.
>
> Is this right?  If so, we need a better way to run CPU uncached.
>
> In the past, I have been a private patch to do so.  It seems pretty
difficult
> to come up a generic, because we want to figure out the CPU type and
disable
> cache *before* kernel starts to modify any memory content.

Since the kernel cache attribute is never initialized before
ld_mmu_{whatever} is invoked, and since that Config field
does not have a well-defined reset state on many MIPS
CPUs, it would appear that we are in effect trusting the
bootloader to have done something reasonable like
set kseg0 to be non-cachable or write-through, either
of which would be safe for the current code.  Strictly
speaking, if we do not wish to assume that the bootloader
has corectly initialized the caches, the kernel should begin
execution in kseg1and stay there until the caches have
been initialized and the kseg0 cache attribute has been
set to something sane.  And when I say "initialized", I
don't mean the writeback-invalidates used by the
blast_dcache routines, since those assume a sane
state of the tag ram, which cannot be guaranteed
at power-up.  One should write the tags directly to
a sane value on CPUs that support it  (on the R3000,
one apparently needs to write a byte to each cache
line to invalidate it.).

I would suggest either that we be explicit about the
assumptions about what the bootloader has done
to the cache, or we go whole-hog and assume that
the kernel has been branched to directly from the
reset vector.  Tinkering with measures in between
strikes me as a waste of time.

            Regards,

            Kevin K.

WARNING: multiple messages have this Message-ID (diff)
From: "Kevin D. Kissell" <kevink@mips.com>
To: Jun Sun <jsun@mvista.com>, linux-mips@oss.sgi.com
Subject: Re: CONFIG_MIPS_UNCACHED
Date: Sat, 23 Jun 2001 19:17:28 +0200	[thread overview]
Message-ID: <01ee01c0fc08$66e81e80$0deca8c0@Ulysses> (raw)
Message-ID: <20010623171728.Afl2N1VqoG93TH-QcCVVb8inXPsB-fMbJjvd1QWQUSE@z> (raw)
In-Reply-To: 3B34BE3B.B72D40F1@mvista.com

> I looked at the code and it appears this config may not work properly.
>
> My understanding is that if CPU has been running with cache enabled, and,
> presummably, have many dirty cache entries, and if you suddenly change
config
> register to run kernel uncached, you *don't* get all the dirty cache lines
> flushed into memory.  Therefore, you will be accessing stale data in
memory.
>
> Is this right?  If so, we need a better way to run CPU uncached.
>
> In the past, I have been a private patch to do so.  It seems pretty
difficult
> to come up a generic, because we want to figure out the CPU type and
disable
> cache *before* kernel starts to modify any memory content.

Since the kernel cache attribute is never initialized before
ld_mmu_{whatever} is invoked, and since that Config field
does not have a well-defined reset state on many MIPS
CPUs, it would appear that we are in effect trusting the
bootloader to have done something reasonable like
set kseg0 to be non-cachable or write-through, either
of which would be safe for the current code.  Strictly
speaking, if we do not wish to assume that the bootloader
has corectly initialized the caches, the kernel should begin
execution in kseg1and stay there until the caches have
been initialized and the kseg0 cache attribute has been
set to something sane.  And when I say "initialized", I
don't mean the writeback-invalidates used by the
blast_dcache routines, since those assume a sane
state of the tag ram, which cannot be guaranteed
at power-up.  One should write the tags directly to
a sane value on CPUs that support it  (on the R3000,
one apparently needs to write a byte to each cache
line to invalidate it.).

I would suggest either that we be explicit about the
assumptions about what the bootloader has done
to the cache, or we go whole-hog and assume that
the kernel has been branched to directly from the
reset vector.  Tinkering with measures in between
strikes me as a waste of time.

            Regards,

            Kevin K.

  reply	other threads:[~2001-06-23 17:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-23 16:05 CONFIG_MIPS_UNCACHED Jun Sun
2001-06-23 17:17 ` Kevin D. Kissell [this message]
2001-06-23 17:17   ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-23 17:49   ` CONFIG_MIPS_UNCACHED Jun Sun
2001-06-23 20:15     ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-23 20:15       ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-25  4:42       ` CONFIG_MIPS_UNCACHED Jun Sun
2001-06-25  6:51         ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-25  6:51           ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-25 16:38           ` CONFIG_MIPS_UNCACHED Jun Sun
2001-06-25 17:35           ` CONFIG_MIPS_UNCACHED Justin Carlson
2001-06-26  8:50             ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-26  8:50               ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-06-26 13:11               ` CONFIG_MIPS_UNCACHED Maciej W. Rozycki
2001-06-25 13:22     ` CONFIG_MIPS_UNCACHED Maciej W. Rozycki
  -- strict thread matches above, loose matches on Subject: below --
2001-01-23 23:26 CONFIG_MIPS_UNCACHED Quinn Jensen
2001-01-23 23:53 ` CONFIG_MIPS_UNCACHED Pete Popov
2001-01-24 20:10   ` CONFIG_MIPS_UNCACHED Jun Sun
2001-01-25  0:31     ` CONFIG_MIPS_UNCACHED Ralf Baechle
2001-01-25  1:09       ` CONFIG_MIPS_UNCACHED Pete Popov
2001-01-25  1:37         ` CONFIG_MIPS_UNCACHED Jun Sun
2001-01-26 10:02       ` CONFIG_MIPS_UNCACHED Kevin D. Kissell
2001-01-26 10:02         ` CONFIG_MIPS_UNCACHED Kevin D. Kissell

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='01ee01c0fc08$66e81e80$0deca8c0@Ulysses' \
    --to=kevink@mips.com \
    --cc=jsun@mvista.com \
    --cc=linux-mips@oss.sgi.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.