Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* 21064A D-cache is *KB under Linux (was: lmbench on Linux and DU...) (fwd)
@ 1999-03-11 20:17 B. James Phillippe
  1999-03-11 21:43 ` Massmail scripts for Linux Aaron
  0 siblings, 1 reply; 3+ messages in thread
From: B. James Phillippe @ 1999-03-11 20:17 UTC (permalink / raw)
  To: RedHat AXP list


I saw this on comp.os.linux.alpha and was somewhat intrigued.  Can anyone
comment on this?

-bp
--
B. James Phillippe		. bryan@terran.org
Software Engineer, WGT Inc.	. http://www.terran.org/~bryan

---------- Forwarded message ----------
Subject: 21064A D-cache is *KB under Linux (was: lmbench on Linux and DU...)
Date: 11 Mar 1999 15:51:50 GMT
From: Anton Ertl <anton@mips.complang.tuwien.ac.at>
Newsgroups: comp.os.linux.alpha

In article <7c6ps1$up3$1@prince.dataforce.net>,
 Solar Designer <solar@cannabis.dataforce.net> writes:
> Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> > Bit 12 (DC_16K) of the ABOX_CTL register controls whether the D-cache
> > is 8K (clear) or 16K (set).

I looked at the kernel source (2.2.1), the milo-2.0.30 source, and the
palcode source included with milo-2.0.30.  As far as I see the DC_16K
bit is set nowhere.

> > Would simply setting the DC_16K bit be enough?  I doubt it; OSs
> > typically need special magic to deal with virtually-indexed caches.

Can anyone comment on this?

> [ Sorry for bringing up a slightly different topic; I think that the
> information below is funny enough, and might be interesting for other
> readers of this newsgroup. ]

Thanks, this inspired me for my solution below.

Your membench.c now gives 1478.98 Mb/sec even with 16K, and our LaTeX
benchmark improves from 32.67s to 31.17s (still some way to go to the
DU result of 24.8s).

- anton

Here's the source code for the module:

/* D-cache control on an 21064A

Just compile it with 

gcc -O -c toggle_dc_16k.c 

and invoke it with

insmod toggle_dc_16k.o

Never mind the error message. To see the result, invoke

dmesg |tail

which should contain a message like "abox_ctl=0x142c" or
"abox_ctl=0x42c".  In the former case, the D-cache now has 16K, in the
latter 8K.  Invoke the module again to toggle the state.


When you try to install this module, it toggles the state of the
D-cache between 8K and 16K and then prints the resulting value of the
ABOX_CTL register in hex. If bit 12 (mask: 0x1000) is set, the D-cache
is 16KB, if it is clear, the D-cache is 8KB.  The module produces an
error, so it is not installed, but the effect is there nevertheless.

Warnings: It is not clear if Linux handles virtually indexed caches
correctly on a 21064A (there might be problems with cache
consistency, if the same physical page is mapped to several virtual
addresses). It is not clear if it is safe to switch during operation
(this module does not flush the cache).

However, we have experienced no problems during our experiments and
benchmarks with this module (on a non-critical machine:-) 
*/

#define MODULE
#define __KERNEL__
#include <linux/module.h>

static long rd_abox_ctl()
{
  long abox_ctl;
  asm("mov 3, $18; call_pal 9; mov $0, %0": "=r" (abox_ctl): /* no inputs */
      : "$0","$16","$17","$18"); /* read abox_ctl register */
  return abox_ctl;
}

/* toggle bit 12 of the ABOX_CTL register; this bit controls whether
   the Dache is 8KB or 16KB (virtually-indexed in the latter case) */
static void toggle_dc_16k()
{
  long abox_ctl;
  asm("mov 3, $18; call_pal 9; mov $0, %0": "=r" (abox_ctl): /* no inputs */
      : "$0","$16","$17","$18"); /* read abox_ctl register */
  abox_ctl^=0x1000;
  asm("mov 6, $18; mov %0, $16; call_pal 9": : "r" (abox_ctl)
      : "$0","$16","$17","$18"); /* write abox_ctl register */
}

int init_module()
{
  toggle_dc_16k();
  printk("abox_ctl=0x%x\n",rd_abox_ctl());
  return 1; /* device or resource busy, so the module is not installed */
}

void cleanup_module()
{
}




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-03-12  2:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-03-11 20:17 21064A D-cache is *KB under Linux (was: lmbench on Linux and DU...) (fwd) B. James Phillippe
1999-03-11 21:43 ` Massmail scripts for Linux Aaron
1999-03-12  2:26   ` Cameron Simpson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox