Subject: malloc above splimp
To: None <amiga-dev@sun-lamp.cs.berkeley.edu>
From: Niklas Hallqvist <niklas@appli.se>
List: amiga-dev
Date: 08/31/1994 10:35:29
I'm getting successful with the GoldenGate and the com driver.  Now I
can actually use it for logging in and dialout.  However at high speeds
there can occur some problems, one of them being malloc messing up its
internal state.  After some investigation I found that malloc does
splimp which is spl3 in the amiga port.  As I use si_addcallback at
spl6 this can (and will) result in bad behaviour.  This morning I saw
the following call chain (from memory, excuse me if I don't remember
the exact names):

lev4intr -> si_remcallback -> malloc -> lev6intr -> ggbusintr ->
comintr -> si_addcallback -> malloc -> lev6intr -> ggbusintr ->
comintr -> si_addcallback -> malloc -> addrerr

As you can see malloc won't be enough protected.  This can either
be solved by increasing splimp(), but that might affect other parts
of the system badly performancewise, I don't know, or we could
change malloc to be splhigh which also could increase interrupt
latencies, or we could drop malloc from the si_callback handling
using a callback pool instead.  This would both be faster than malloc
and an easy fix as it will only have local influences.  The drawback
is that it has to be a static limit of callbacks, but as the descriptors
are small anyway I think this is not a problem.  I'm thinking of a
default of about 64 descriptors requiring about a K of coremem.
Do someone have a problem with this?  I'll probably write the
support down this evening, if someone (Chris) doesn't say we should
solve it differently.  And yes, I've already change the si_callback
stack to a queue instead.  I'll provide a patch to anyone interested.

On a related topic, we need to redo the interrupt system a bit in order
to have drivers being LKMs.  We must have a interrupt handling
registration during attachment like the i386 port.  I'm willing to
write this if Chris says go.

A new isa-support patchset will be put up for ftp in a day or two,
this time with at least a mostly working com-driver (and if we're
lucky, a start of the isa ed ethernet driver, NE-2000 and such).
I'd like to poll this group for people having interests in the isabus
efforts.  If you want to use your specific bridgecard with NetBSD,
please mail me a say what HW you're most interested in seeing support
for.  I'm going for parallel ports, floppies, mice and Mitsumi CDs next,
mostly because I have use for them.  Other interesting things would
be other E-net cards, SVGAs, SCSI, IDE & soundcards, but those I don't
need myself.

					Niklas

Niklas Hallqvist	Phone: +46-(0)31-40 75 00
Applitron Datasystem	Fax:   +46-(0)31-83 39 50
Molndalsvagen 95	Email: niklas@appli.se
S-412 63  GOTEBORG, Sweden

------------------------------------------------------------------------------