home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / set6x86.zip / README < prev    next >
Text File  |  1998-01-03  |  14KB  |  381 lines

  1.  
  2.          set6x86 / get6x86 / 6x86_reg
  3.          ----------------------------
  4.  
  5. This document has been slightly modified from its original form to
  6. accomodate the OS/2 specific implementation of the program.
  7.  
  8.  
  9. Please read through this file before attempting to use this program.
  10. It might save you a few crashes.
  11.  
  12.  
  13. Description
  14. -----------
  15.  
  16. Set6x86 and get6x86 are two programs that allow you to poke and peek into
  17. the Cyrix/IBM/SGS-Thomson 6x86 CPU's configuration registers. 6x86_reg will
  18. display register contents in human-readable format. The short source
  19. test_bug is a demo program for the 6x86 "coma" bug.
  20.  
  21.  
  22. Cyrix CPUs
  23. ----------
  24.  
  25. Cyrix 6x86 CPU's are Intel Pentium-like performance CPUs, but at a lower
  26. cost than their Intel parts. Cyrix has adopted a CPU rating that refers to
  27. "equivalent Pentium performance in Windows applications" for their CPUs.
  28.  
  29. A Cyrix-6x86 P133+ for example is clocked at only 110 MHz, although it
  30. performs as good as a Pentium 133 (hence the "P133+" rating). The "+" is a
  31. marketing gadget: it is supposed to point out that it's even a little better
  32. than a P133 on the Winstone benchmark.
  33.  
  34. 6x86 CPUs come at a significantly lower price than their equivalent Intel
  35. cousins. The only downsides are:
  36.  
  37.    - a lack of support from several motherboard vendors and software vendors
  38.      (most CPU identification programs, Linux 2.0's /proc/cpuinfo included,
  39.      report a 486 CPU instead of a Cyrix 6x86). A short kernel patch
  40.      is available from http://www.tux.org/~balsa/linux/cyrix that
  41.      solves this kernel shortcoming.
  42.  
  43.    - Floating point performance is not as good as a Pentium. Depending
  44.      on the benchmark, 15 to 50% lower FPU performance can be expected.
  45.  
  46.    - This baby needs HUGE amounts of power. People used to make fun of
  47.      the newest Digital chip, the Alpha, a few years ago, because it
  48.      needed over 20 Watts of power. Well, this one too. Depending on
  49.      the clock speed, up to 24 Watts of power is dissipated from the
  50.      package!
  51.  
  52.      Anyone familiar with hardware design can tell you that keeping
  53.      that under control is not a simple task. That is also the main
  54.      reason why so many people flush newsgroups with messages that the
  55.      6x86 CPU's are bad, don't run Win95, crash all the time,...
  56.  
  57.      Do you really think those companies would even _risk_ making a CPU
  58.      that is not as compatible as possible? The only thing they didn't
  59.      replicate was the ominous Pentium FPU bug ;-)
  60.  
  61.           On the other hand Cyrix 6x86 CPUs suffer from another bug, called
  62.           the 6x86 "coma" bug. The short program test_bug included in this
  63.           package is an example of how this bug affects 6x86 CPUs.  If you
  64.           want to see the coma bug in action, simply compile and run it.
  65.  
  66.      The _real_ reason for crashes and system hangs in most cases is
  67.      either a temperature problem, or a digital timing problem (the
  68.      latter being caused by the former in many cases). Poorly cooled
  69.      CPU's tend to go beyond their specified ratings. Most CPUs are
  70.      only guaranteed to work up to 70 degrees Celsius, and with 24
  71.      Watts to sweat out from such a small surface, that's _very_ easily
  72.      exceeded.
  73.  
  74.  
  75. Why this program?
  76. -----------------
  77.  
  78. For fun, mostly.
  79.  
  80. But also for some pretty darn good reasons. Most motherboards (mine, a
  81. Chaintech board based on the Intel Triton II chipset) support 6x86 CPUs, but
  82. not as well-tested and well-set-up as Pentium CPUs.
  83.  
  84. The 6x86 has a set of configuration registers that allows one to do a lot of
  85. things, like specifying non-cacheable memory areas (important for e.g.
  86. graphics cards), I/O delays, cache write policy (WB/WT), and also to enable
  87. an automatic standby mode where a CPU "halt" instruction cuts down power by
  88. a factor of 70 (from 5.8 Amps to 83 milli-Amps for the P133+).
  89.  
  90. Since most computers do nothing most of the time, this would be useful to
  91. enable.
  92.  
  93. Linux uses the halt instruction when it has nothing better to do, so
  94. enabling this feature will _not_ hurt performance: the CPU controls the
  95. powering-down of specific internal parts by hardware-control, so there's no
  96. software intervention needed for explicitly re-enabling a powered-down part.
  97.  
  98. However, some Linux users have reported that their systems would hang if
  99. this feature was enabled and some bus-mastering Ethernet cards were used, in
  100. some specific circumstances and only with some motherboards/chipset/BIOS
  101. combinations! So even this seemingly inocuous feature should be tested on
  102. individual systems.
  103.  
  104.  
  105. Benefits?
  106. ---------
  107.  
  108. Apart from the obvious environmental reasons, there's also the temperature
  109. problem that is reduced substantially.
  110.  
  111. If you're on a P133+ and programming like hell, or reading mail, or most of
  112. the other things you do in Linux (or any other OS for that matter), the CPU
  113. is doing nothing 99% of the time (just take an occasional look at the system
  114. load meter).
  115.  
  116. When not set for automatic power-down, the CPU will _always_ draw its full
  117. 24 Watts of power. With this feature enabled, power consumption drops to
  118. near-zero most of the time.
  119.  
  120. While I'm typing this junk, my CPU is (again) 99% idle, so now the CPU uses
  121. only 0.3 Watts instead. That's one _hundreth_ of its full juice.
  122.  
  123. No need to say that most thermal problems are history.
  124.  
  125. In fact, I've been having _lots_ of spurious core dumps and "signal 11"
  126. messages from GCC on my system, and I always suspected temperature problems.
  127. With auto-suspend mode on, I haven't had a single core dump since (but I
  128. haven't done a lot of testing either).
  129.  
  130. This convinced me that I'll have to provide better cooling for the CPU.
  131.  
  132.  
  133. DANGER!!!
  134. ---------
  135.  
  136. Of course, you're fiddling with the guts of your CPU, while it's running. So
  137. don't blame me if you accidently set the wrong register and your machine
  138. hangs.
  139.  
  140. In other words, let's use the Paul Gortmaker (?) disclaimer:
  141.  
  142.    "If it breaks, you get to keep the pieces"
  143.  
  144.  
  145. LITERATURE
  146. ----------
  147.  
  148. This program is completely useless without the proper docs from Cyrix. I
  149. explicitly didn't include any description of the 6x86 config registers
  150. because I didn't want to risk distributing faulty information.
  151.  
  152. Cyrix's WWW site (www.cyrix.com) and their FTP site (ftp.cyrix.com) contain
  153. all the stuff you need. For ftp, all the files are in the "6x86" directory.
  154.  
  155. You need _at least_
  156.  
  157.    6X-ABDB.PDF   (361748 bytes)
  158.  
  159. which is the abbreviated data book, and contains a description of all the
  160. registers you can tamper with (staring at page 18).
  161.  
  162. The full data book is
  163.  
  164.    6X-DBOOK.PDF  (2039298 bytes)
  165.  
  166. For the 5x86, the Cyrix FTP/WWW site may contain equivalent doumentation
  167. (not checked).
  168.  
  169. Here's a list of WWW sites known to carry information on 6x86 CPUs:
  170.  
  171.   http://www.cyrix.com
  172.   http://www.chips.ibm.com/products/x86/
  173.   http://www.tux.org/~balsa/linux/cyrix/index.html
  174.   http://www.alternativecpu.com
  175.  
  176.  
  177. EXAMPLE
  178. -------
  179.  
  180. The power-saving option described above is controlled by register 0xC2, bit
  181. 3 of the configuration registers.  The register is specified with the "-r"
  182. option.  Thus,
  183.  
  184.    get6x86 -r 0xC2
  185.  
  186. Will display (on my system -- "your mileage my vary"):
  187.  
  188.    Cyrix 6x86 config register, index 194 (=0xc2) contains 128 (=0x80 =b10000000)
  189.  
  190. Note that bit 3 is set to zero, so the auto-suspend mode is disabled.
  191.  
  192. Typing
  193.  
  194.    set6x86 -r 0xC2 -d 0x88
  195.  
  196. will set bit #3 of that register, thus enabling the auto-suspend mode.  Note
  197. that the "-d" option assigns a raw data value to the register.
  198.  
  199.  
  200. Simpler is to use the "-s" or "-c" options. These use the data byte on the
  201. command line as a set/clear mask instead of raw data to program into the
  202. register.
  203.  
  204. So the above can be made much more simple by just typing
  205.  
  206.    set6x86 -r 0xC2 -s 0x08
  207.  
  208. This will read register 0xC2, and "set" bits using the mask given (0x08).
  209.  
  210. The "-s" does a logical "OR" of the original register data and the mask
  211. data, and programs it back into the register, whilst the "-c" option will do
  212. a logical "AND" with the inverse of the mask (0xF7 in this case).
  213.  
  214.  
  215. The included cyrix.cmd file enables a few performance-related thingies on the
  216. Cyrix 6x86 CPU. Copy it to the /etc/rc.d directory, and call it from e.g.
  217. rc.local.
  218.  
  219. It is also instructive on how to use both the tool, and the Cyrix 6x86
  220. registers. It does a bit of everything.
  221.  
  222.  
  223. 6x86_reg
  224. --------
  225.  
  226. This little tool dumps most relevant 6x86 registers in human-readable
  227. format. It will also correctly identify the 6x86 model and revision, report
  228. bogoMIPS ratings, and dump the more complex ARRs (Address Region Registers).
  229. These are the registers where the different memory regions are set up and
  230. how they are handled (e.g. if they're cached or if any other special
  231. function is enabled for them).
  232.  
  233. Running it may reveal something like the output below:
  234.  
  235. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  236. 6x86 (Classic/L/MX) Register Dump utility
  237.  
  238. 6x86 DIR0: 0x52   2.5X core/bus clock ratio
  239.      DIR1: 0x4 6x86MX Rev. 1.4
  240.  
  241. Wait a moment...
  242. Calculated BogoMIPS: 185.12
  243. Kernel BogoMIPS:  186.78
  244.  
  245. 6x86 CCR0: 0x2 NC1 set (address region 640Kb-1Mb non-cacheable)
  246.      CCR1: 0x92   NO_LOCK set
  247.      CCR2: 0x88   SUSP_HLT set (low power suspend mode enabled)
  248.      CCR3: 0x10
  249.      CCR4: 0x87   no I/O recovery time
  250.      CCR5: 0x21   allocate cache lines on write misses
  251.  
  252. 6x86 Address Region Register dump:
  253.   ARR0: address = 0xA0000 , size = 128 KB
  254.     RCR = 0x9 : not cached, write gathering
  255.   ARR1: address = 0xC0000 , size = 256 KB
  256.     RCR = 0x1 : not cached
  257.   ARR2: disabled
  258.   ARR3: address = 0xA8000 , size = 32 KB
  259.     RCR = 0x9 : not cached, write gathering
  260.   ARR4: disabled
  261.   ARR5: disabled
  262.   ARR6: address = 0xE0000000 , size = 4 MB
  263.     RCR = 0x9 : not cached, write gathering
  264.   ARR7: address = 0x0 , size = 32 MB
  265.     RCR = 0x9 : cached, write gathering
  266. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  267.  
  268. This saves you a lot of fingering through the 6x86 data book :-)
  269.  
  270.  
  271. BogoMIPS
  272. --------
  273.  
  274. First of all you must understand that bogoMIPS are _not_ meant as a measure
  275. of performance, but rather as an indicator that the 6x86 registers and the
  276. BIOS settings for the chipset on your motherboard are correctly set.
  277.  
  278. That said, we can look at the three possible outcomes of running 6x86_reg:
  279.  
  280. 1) The calculated bogoMIPS and the kernel bogoMIPS reading from
  281. /proc/cpuinfo are approx. equal (+/- 1 bogoMIPS). This is the normal case on
  282. a "quiet" system.
  283.  
  284. Note that on 6x86 family CPUs, bogoMIPS are approximately equal to the CPU
  285. core clock rate.
  286.  
  287. For example:
  288.    - a 6x86 PR166 should have a bogoMIPS rating of approx. 133, since
  289.           its core will run at 133MHz (2 x 66.66MHz).
  290.  
  291.    - a 6x86MX PR233 at 187.5MHz (2.5 x 75MHz) should have a bogoMIPS
  292.           rating of approx. 187.5.
  293.  
  294. 2) The calculated bogoMIPS is much higher (> 10-15%) than the kernel
  295. bogoMIPS. This indicates that your BIOS is not setting the 6x86 registers or
  296. the chipset parameters for the L2 cache correctly, and that set6x86 has
  297. remedied to this. Adjust your BIOS CMOS settings and/or upgrade the BIOS
  298. flash EEPROM.
  299.  
  300. 3) The calculated bogoMIPS is lower than the /proc/cpuinfo kernel reading:
  301. your system load is impairing the bogoMIPS calculation done by 6x86_reg.
  302.  
  303.  
  304. Fun?
  305. ----
  306.  
  307. You might even be able to _hear_ the difference!
  308.  
  309. Most computer power supplies only compensate higher power demands on the +5V
  310. rail, resulting in an increase on the +12V rail when +5V power demand goes
  311. up.
  312.  
  313. The CPU draws from the +5V rail, but the CPU fan uses +12V, so when the CPU
  314. draws more power (due to CPU load), the CPU cooling fan (which is delivered
  315. with the CPU by Cyrix) will run a little faster with higher supply voltages,
  316. so the significant power drop when the CPU drops into power-suspend mode
  317. might cause a noticeable change in the pitch of the buzzing fan sound!
  318.  
  319. On my system, I can now HEAR how busy it is...
  320.  
  321.  
  322. The 6x86 Coma bug
  323. -----------------
  324.  
  325. Compile and run the short bug demo program "test_bug.c". Type Control-C to
  326. try and regain control: nothing happens, right? Your 6x86 CPU is in "coma"
  327. mode. :-(
  328.  
  329. The 6x86 CPU effectively gets locked in an infinite loop, executing
  330. back-to-back locked cycles and consequently unable to service any
  331. interrupts, including attempts by root to kill the process. This is by all
  332. means a serious security flaw in a multiuser OS like Linux.
  333.  
  334. This bug affects all 6x86 family CPUs.
  335.  
  336. Solution: enable the NO_LOCK bit with set6x86.
  337.  
  338.  
  339. Support
  340. -------
  341.  
  342. None. Your own intelligence and common sense should be enough.
  343.  
  344.  
  345. DOS and Linux
  346. -------------
  347.  
  348. DOS support was removed starting at version 1.4.  DOS, not being a _real_
  349. Operating System, does busy-waiting when it's idle instead of executing a
  350. "halt" instruction, and thus the CPU can't know that it should be powering
  351. down. So it'll still run as hot as under a full load.
  352.  
  353. Windows 3.1 and '95 don't as well. Blame MicroBrains for that. NT? Don't know.
  354.  
  355. The Linux version can be downloaded from:
  356.  
  357.    ftp://tsx-11.mit.edu/pub/linux/sources/sbin
  358.  
  359. The Linux version works great though.  (It's a real operating system)
  360.  
  361.  
  362. Author
  363. -------
  364.  
  365. Koen Gadeyne, koen.gadeyne@barco.com
  366. (please contact the maintainer below first)
  367.  
  368.  
  369. New maintainer for the general/Linux version
  370. --------------------------------------------
  371.  
  372. Thanks Koen! I'll do my best with this "hot potato" :-)
  373. Andrew D. Balsa, andrewbalsa@usa.net
  374.  
  375.  
  376. OS/2 Modifications/Port:
  377. -----------------------
  378.  
  379. Greg Kondrasuk, kondrag@geocities.com
  380. http://www.geocities.com/SiliconValley/Vista/6434/
  381.