Skip to contentSkip to conversation

Disable cache on 74xx

DISCUSSION Brian Waite 6 participants 13 messages Feb 19, 2003 – Feb 20, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,
I am trying to hunt down a memory controller configuration problem and I have
been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Thanks
Brian

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 6 lines · Brian Waite

Hi all,
I am trying to hunt down a memory controller configuration problem and I have
been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Hrm... set L2 and L3 off, then hack HID0 to disable L1 ?

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 6 lines · Brian Waite

Hi all,
I am trying to hunt down a memory controller configuration problem and I have
been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Hrm... set L2 and L3 off, then hack HID0 to disable L1 ?

There are other problems with this. With the caches disabled (via HID0) all data cache instructions (like DCBF) will fail. There are some of these in the kernel itself, but beware that GLIBC has it's own set.

... totally disabling the data CACHE with Linux is non-trivial.

--
------------------------------------------------------------

Gary Thomas                 |
MLB Associates              |  Consulting for the
+1 (970) 229-1963           |    Embedded world
http://www.mlbassoc.com/    |
email: <[email protected]>  |

gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

According to The User's Manual, the data cache instructions become no-ops if the data cache is disabled.

Thanks
Brian

Quoted 9 lines · Gary Thomas
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 6 lines · Brian Waite

Hi all,
I am trying to hunt down a memory controller configuration problem and
I have been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Quoted 8 lines
Quoted 1 line

Hrm... set L2 and L3 off, then hack HID0 to disable L1 ?

There are other problems with this. With the caches disabled (via HID0) all data cache instructions (like DCBF) will fail. There are some of these in the kernel itself, but beware that GLIBC has it's own set.

... totally disabling the data CACHE with Linux is non-trivial.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
Quoted 3 lines · Brian Waite

According to The User's Manual, the data cache instructions become no-ops if the data cache is disabled.

There are "User Manuals" and then there is "Real Life". My experience has been that trying to execute these instructions with the cache disabled was treated like an invalid instruction (hence causing a trap). Maybe this isn't always true with all PowerPC processors, but I was just pointing out that you might run into trouble with it.

Quoted 20 lines

Thanks
Brian

Quoted 17 lines · Gary Thomas
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines · Brian Waite

Hi all,
I am trying to hunt down a memory controller configuration problem and
I have been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Hrm... set L2 and L3 off, then hack HID0 to disable L1 ?

There are other problems with this. With the caches disabled (via HID0) all data cache instructions (like DCBF) will fail. There are some of these in the kernel itself, but beware that GLIBC has it's own set.

... totally disabling the data CACHE with Linux is non-trivial.

--
------------------------------------------------------------

Gary Thomas                 |
MLB Associates              |  Consulting for the
+1 (970) 229-1963           |    Embedded world
http://www.mlbassoc.com/    |
email: <[email protected]>  |

gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 10 lines · Gary Thomas
Quoted 2 lines · Brian Waite

According to The User's Manual, the data cache instructions become no-ops if the data cache is disabled.

There are "User Manuals" and then there is "Real Life". My experience has been that trying to execute these instructions with the cache disabled was treated like an invalid instruction (hence causing a trap). Maybe this isn't always true with all PowerPC processors, but I was just pointing out that you might run into trouble with it.

There may be a different behavior for disabling the data cache globally' and using e.g. dcbf on uncached memory' (with the data cache enabled globally).

Quoted 10 lines
Quoted 10 lines · Gary Thomas
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Brian Waite
Quoted 6 lines

Hi all,
I am trying to hunt down a memory controller configuration problem and
I have been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Hrm... set L2 and L3 off, then hack HID0 to disable L1 ?

There are other problems with this. With the caches disabled (via HID0) all data cache instructions (like DCBF) will fail. There are some of these in the kernel itself, but beware that GLIBC has it's own set.

... totally disabling the data CACHE with Linux is non-trivial.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
Quoted 2 lines · Geert Uytterhoeven

There may be a different behavior for disabling the data cache globally' and using e.g. dcbf on uncached memory' (with the data cache enabled globally).

I decided to take a diversion and read some processor manuals. :-)

The behavior of the cache instructions on areas that are not cacheable for any reason depends upon the cache instruction used. Some have no effect, some have unpredictable behavior, some cause alignment/access traps. It all depends upon how they would translate/access the cache and the operation they would perform on a cache line. We use all instructions in Linux that would trigger any of the behavior. :-)

The bottom line appears to be you really don't want to execute cache instructions on areas that are not cached. This includes global disable or any method of marking pages uncached.

For Brian, I'm also curious why you think running Linux with disabled caches will assist in debugging memory controller problems? If you are looking for such fine control of the bus cycles for debugging it seems a simple memory diagnostic used in conjuction with hardware debug tools is a better approach.

Thanks.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw

Well to preface, some people around here think disabling cache is a good idea. I report to one of those :). What I am trying to debug is why my custom board hangs. Basically, what I see is when a PCI interface starts reading/writing SDRAM, my 745x processor locks up. I see no more decrementer interrupts being serviced and using a BDI 2000 JTAG interface I see the processors stalled on some memory access instruciton. The memory controller (gt64260) seems to be doing something very wrong and it is thought to be a cache coherency issue. So to prove this, I was asked to try running without any sort of cache. Hopefully between Gary's information and yours, Dan I can convince people that it is futile.

Thanks
Brian

Quoted 24 lines · Dan Malek
Quoted 3 lines · Geert Uytterhoeven

There may be a different behavior for disabling the data cache globally' and using e.g. dcbf on uncached memory' (with the data cache enabled globally).

I decided to take a diversion and read some processor manuals. :-)

The behavior of the cache instructions on areas that are not cacheable for any reason depends upon the cache instruction used. Some have no effect, some have unpredictable behavior, some cause alignment/access traps. It all depends upon how they would translate/access the cache and the operation they would perform on a cache line. We use all instructions in Linux that would trigger any of the behavior. :-)

The bottom line appears to be you really don't want to execute cache instructions on areas that are not cached. This includes global disable or any method of marking pages uncached.

For Brian, I'm also curious why you think running Linux with disabled caches will assist in debugging memory controller problems? If you are looking for such fine control of the bus cycles for debugging it seems a simple memory diagnostic used in conjuction with hardware debug tools is a better approach.

Quoted 4 lines

Thanks.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw
Quoted 12 lines · Brian Waite

Well to preface, some people around here think disabling cache is a good idea. I report to one of those :). What I am trying to debug is why my custom board hangs. Basically, what I see is when a PCI interface starts reading/writing SDRAM, my 745x processor locks up. I see no more decrementer interrupts being serviced and using a BDI 2000 JTAG interface I see the processors stalled on some memory access instruciton. The memory controller (gt64260) seems to be doing something very wrong and it is thought to be a cache coherency issue. So to prove this, I was asked to try running without any sort of cache. Hopefully between Gary's information and yours, Dan I can convince people that it is futile.

I agree with Dan that you should try and reduce the scope of your test. Try to [re]create the failure with as little as possible, hopefully without Linux in the way, etc. (I'm recommending that you write a separate test program) In this way, your test can have complete control over the environment and doing things like verifying cache issues, etc, should be simpler.

Quoted 34 lines

Thanks
Brian

Quoted 28 lines · Dan Malek
Quoted 3 lines · Geert Uytterhoeven

There may be a different behavior for disabling the data cache globally' and using e.g. dcbf on uncached memory' (with the data cache enabled globally).

I decided to take a diversion and read some processor manuals. :-)

The behavior of the cache instructions on areas that are not cacheable for any reason depends upon the cache instruction used. Some have no effect, some have unpredictable behavior, some cause alignment/access traps. It all depends upon how they would translate/access the cache and the operation they would perform on a cache line. We use all instructions in Linux that would trigger any of the behavior. :-)

The bottom line appears to be you really don't want to execute cache instructions on areas that are not cached. This includes global disable or any method of marking pages uncached.

For Brian, I'm also curious why you think running Linux with disabled caches will assist in debugging memory controller problems? If you are looking for such fine control of the bus cycles for debugging it seems a simple memory diagnostic used in conjuction with hardware debug tools is a better approach.

Thanks.

	-- Dan

--
------------------------------------------------------------

Gary Thomas                 |
MLB Associates              |  Consulting for the
+1 (970) 229-1963           |    Embedded world
http://www.mlbassoc.com/    |
email: <[email protected]>  |

gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw
In reply to Brian Waite
Quoted 10 lines · Brian Waite

Well to preface, some people around here think disabling cache is a good idea. I report to one of those :). What I am trying to debug is why my custom board hangs. Basically, what I see is when a PCI interface starts reading/writing SDRAM, my 745x processor locks up. I see no more decrementer interrupts being serviced and using a BDI 2000 JTAG interface I see the processors stalled on some memory access instruciton. The memory controller (gt64260) seems to be doing something very wrong and it is thought to be a cache coherency issue. So to prove this, I was asked to try running without any sort of cache. Hopefully between Gary's information and yours, Dan I can convince people that it is futile.

It could be the gt doing something wrong, it could also be the CPU, 745x have known lockup conditions, though at least some of them have workarounds enabled in the kernel.

Look closely at the CPU errata.

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw
In reply to Brian Waite
Quoted 2 lines · Brian Waite

.... The memory controller (gt64260) seems to be
doing something very wrong and it is thought to be a cache coherency issue.

The problem is cache coherency is central to the operation of processor bus. One possibility, especially in the example you described, is the gt is generating incorrect cache coherency control cycles on the bus. Disabling the processor cache isn't going to affect this.

Quoted 1 line

So to prove this, I was asked to try running without any sort of cache.

Make sure you disable it in the memory controller as well.

Quoted 2 lines

Hopefully between Gary's information and yours, Dan I can convince people that it is futile.

Linux is a very poor diagnostic tool. When I run Linux and discover this type of problem, I reduce it down into a non-Linux diagnostic that can generate the same type of bus cycles. That way you can just flash it into rom and let some hardware engineer run it over and over without having to boot up something as complex as Linux and sorting through millions of bus cycles for the failure mode. With these types of problems you have to determine exactly what causes the failure. Since the processor hangs so completely it should be easy to see the condition of the failure. If it is a memory controller timing problem, you should see exactly what failed and it should be clear how to program the controller to correct it.

Of course, like Ben said, check the errata.

Good Luck.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#11 lore raw

Brian,

I know you are aware of this but I *always* experience cache coherency problems with the GT64260A when Sysclk/Tclk are anything above 100MHz and I believe that your board is clocked over that. Try a 100MHz crystal and see if the problem goes away.

Mark
--

Quoted 38 lines · Dan Malek
Quoted 4 lines · Brian Waite

.... The memory controller (gt64260) seems to be

doing something very wrong and it is thought to be a cache coherency issue.

The problem is cache coherency is central to the operation of processor bus. One possibility, especially in the example you described, is the gt is generating incorrect cache coherency control cycles on the bus. Disabling
the processor cache isn't going to affect this.

Quoted 1 line

So to prove this, I was asked to try running without any sort of cache.

Make sure you disable it in the memory controller as well.

Quoted 3 lines

Hopefully between Gary's information and yours, Dan I can convince people
that it is futile.

Linux is a very poor diagnostic tool. When I run Linux and discover this type of problem, I reduce it down into a non-Linux diagnostic that can generate the same type of bus cycles. That way you can just flash it into
rom and let some hardware engineer run it over and over without having to boot up something as complex as Linux and sorting through millions of bus cycles for the failure mode. With these types of problems you have to determine exactly what causes the failure. Since the processor hangs so completely it should be easy to see the condition of the failure. If it is a memory controller timing problem, you should see exactly what failed and it should be clear how to program the controller to correct it.

Quoted 11 lines

Of course, like Ben said, check the errata.

Good Luck.

    -- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#12 lore raw
In reply to Gary Thomas

Gary,
Thanks for the clarification. I appreciate the real life experiences. This is
exactly why I said "in the User Manual". I was hoping you would come back with the exact answer you provided. :) I'll keep my eyes open.

Thanks
Brian

Quoted 4 lines · Gary Thomas
Quoted 2 lines · Brian Waite

According to The User's Manual, the data cache instructions become no-ops if the data cache is disabled.

Quoted 29 lines

There are "User Manuals" and then there is "Real Life". My experience has been that trying to execute these instructions with the cache disabled was treated like an invalid instruction (hence causing a trap). Maybe this isn't always true with all PowerPC processors, but I was just pointing out that you might run into trouble with it.

Quoted 22 lines

Thanks
Brian

Quoted 18 lines · Gary Thomas
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 7 lines · Brian Waite

Hi all,
I am trying to hunt down a memory controller configuration problem
and I have been asked to disable all caching so as to remove it from the equation. I can easl disable L2 but when I start ucking with the WIMG bits to set cache inhibit, The kernel panics with stack overflows. Does anyone know where or what I have to set to disable caching?

Hrm... set L2 and L3 off, then hack HID0 to disable L1 ?

There are other problems with this. With the caches disabled (via HID0) all data cache instructions (like DCBF) will fail. There are some of these in the kernel itself, but beware that GLIBC has it's own set.

... totally disabling the data CACHE with Linux is non-trivial.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/