Subject: Re: enlightenment on zs overruns
To: Lyndon Fletcher <etmlyfl@etm.ericsson.se>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: port-sparc
Date: 11/20/1997 23:21:05
> I'm new here. Could you explain what you mean by "hefty context loading
> operation?" My understanding is that the two things a multitasking machine
In this context, `context' means a MMU resource that is an artifact of
the MMU design used in sun4/sun4c machines. Basically, it's a cache of
virtual-to-physical address translation tables indexed by various
parts of the the virtual address presented by the CPU. These MMU tables
are precious chip resources; as far as contexts go, you find 8 (sometimes 16)
of them in typical sun4c sparcstations.
Before you can run a process, a context table must have been setup for
it, reflecting the process' address space mappings. If the process runs
for the first time (or has lost its MMU context table) you must allocate
one (out of the 8 or so that the MMU has), possibly taking one away from
another process if all are already in use.
This is where the fun starts.. the sun4c MMU uses a two-level translation
table scheme. The most significant 14 bits of a virtual address are used
to index the MMU context table. Two bits out these 14 are effectively
not used leaving a table of 2**12 (4096) entries to be initialized.
A couple of these are reserved for kernel-mode addresses, and pmap module
also tries hard to avoid loading entries which aren't used, but you still
need to fill many of these. This is what takes a relatively long time..
Now if your "working set" of processes does not exceed 8 (# of available
MMU contexts) this won't hurt you much. But as soon as your processes
start to contend of contextses, the effect of the above might become
noticable, especially if you do it all with interrupts disabled.
(BTW, the MMU has also segment table resources -- indexed by the next
5 oe 6 bits of virtual address -- which must also be managed..)
-pk