1

I disable the cache by setting the CD bit of CR0 for my intel machine. I used the code described in my previous post

I also use the smp_call_function() function to set all CPU's CR0.

The problem is:

After I set all CPU's CR0's CD bit, the machine becomes extremely slow. I cannot even use keyboard.

My question is:

I want to check the CR0 register after I disable the cache by setting the CD bit of CR0. So I need to be able to use the keyboard at least.

Is there anyway that can help me use the keyboard after I disable cache?

It's totally out of my expectation that disabling the cache can make the system almost freeze.

13
  • Is this CPU using integrated graphics? If so, I expect turning off cache also turned it off for the GPU.
    – Zan Lynx
    Jan 21, 2014 at 23:18
  • 3
    Disabling cache is a bit like throwing a big spanner into your computer's cogwheels. Consider yourself lucky if no driver bluescreened due to excessive bus contention. At least I hope you're not doing that on your developpment machine? A slight error fiddling with cache control registers could crash your PC very badly and there is no telling what kind of garbage the disk I/O could spread through your hard drives.
    – kuroi neko
    Jan 22, 2014 at 0:29
  • 1
    Yeah, seems counter-intuitive, but that's the way it is. I remember my first experiments with cache disabling. Disabling the cache on a 386/33mhz box made it run slower than my 10mhz 8088 (which didn't even have a cache). Got even worse when I got my i486. Disabling the cache on that made it pretty much unusable. Jan 22, 2014 at 12:54
  • 1
    @MikeXu Well with cache disabled, every single byte used by your CPUs causes a bus access. This is not only about 20 times slower than a normal operation with 95-98% of cache hits, it also means the bus is constantly busy. It means the drivers will be very far from their usual operating conditions. The bluescreen image was a bit extreme, but that could certainly excite the drivers in a very unusual way, increasing the chances of stumbling upon bugs that never occur when the system is responsive enough.
    – kuroi neko
    Jan 22, 2014 at 15:18
  • 1
    I'm not talking about keyboard driver. More about video card or disk drivers that do DMA all the time and poll bus-locked variables. Now about speed issues, the bus accesses are an order of magnitude slower than cache hits (i.e. 15-30 times slower), that's a general rule-of-thumb. Exact value is of course dependant of the bus controller and memory characteristics.
    – kuroi neko
    Jan 22, 2014 at 16:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.