Subject: Re: Problems with KA650 and -current
To: Tom Ivar Helbekkmo <tih@nhh.no>
From: Johnny Billquist <bqt@Update.UU.SE>
List: port-vax
Date: 12/11/1998 10:43:08
On 10 Dec 1998, Tom Ivar Helbekkmo wrote:

> This is really, really weird.  I've been reading a bit more of the
> code, and I'm getting convinced that either I'm totally confused, or
> there is a bit of mix-up in there between the various sizes and shifts
> that are used.  It doesn't help that somehow, in NetBSD terminology,
> clicks and pages have been "redefined" so that in NetBSD/vax-current,
> a page is 512 bytes (NBPG, with a corresponding PGSHIFT of 9), while
> the click is 4096 bytes (CLBYTES, with a CLSHIFT of 12).  Throw in a
> CLSIZE of 8, with a CLSIZELOG2 of 3, reflecting the old idea that the
> click is the smallest address shift the memory management hardware can
> relate to, and things get really confusing.

CLSIZELOG2 is just how many NBPG that goes on a CLBYTES.
CLSHIFT = PGSHIFT + CLSIZELOG2

> Still, the printf() that outputs the above 102400 _does_ multiply the
> internal bufpages count by CLBYTES, which seems reasonable.  The error
> occured a bit earlier, when the bufpages value was calculated based on
> physmem (also in 4096 byte "clicks") -- but then, down on line 391 or
> thereabouts of machdep.c, it's divided by CLSIZE!  This seems to be a
> misunderstanding carried over from other ports, where CLSIZE is 1
> (because what we used to call a click is 1), and it doesn't matter.
> With a CLSIZE of 8, we get 1/8 the buffer space we intended.  This
> also affects swap buffer header allocation, of course.

Hmmm, "/ CLSIZE" was interesting. I would have expected it to be
"* CLSIZE", to get it in physical pages.

> Now, this has me a bit worried.  Sure, this might be the only place
> this error is found, but if similar erroneous uses of CLSIZE (or the
> failure to take it into account) are found elsewhere in the code (and
> it doesn't have to be below /sys/arch/vax, either), there might be
> interesting trouble.  A quick grep shows that the VAX is the only of
> the NetBSD ports that has a CLSIZE that isn't 1.

Yes. All other ports have a CLICK size equal to the hardware page size.
But no other machine has as small hardware pages as the VAX does. :-)

> I'm going to test a kernel built without the erroneous "/ CLSIZE" bits
> in it tonight, and report back later.

Try multiplying as well...

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol