Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Subject: 21064A D-cache is *KB under Linux (was: lmbench on Linux and DU...)
Date: 1999/03/11	[thread overview]
Message-ID: <7c8oqm$a9r$1@news.tuwien.ac.at> (raw)
In-Reply-To: 7c6ps1$up3$1@prince.dataforce.net

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()
{
}




  reply	other threads:[~1999-03-11  5:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-09  5:00 lmbench on Linux and DU, explanations welcome Anton Ertl
1999-03-10  5:00 ` Solar Designer
1999-03-10  5:00   ` Anton Ertl
1999-03-10  5:00     ` Solar Designer
1999-03-10  5:00       ` Anton Ertl
1999-03-10  5:00         ` Solar Designer
1999-03-11  5:00           ` Anton Ertl [this message]
1999-03-12  5:00             ` 21064A D-cache is 8KB under Linux Anton Ertl
1999-03-12  5:00             ` 21064A D-cache is *KB under Linux (was: lmbench on Linux and DU...) Richard Rogers
1999-03-16  5:00               ` Anton Ertl
1999-03-23  5:00                 ` 21064A D-cache is 8KB " Anton Ertl
read-only archive

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