[comp.sys.hp] Further question about iomap

tgl@g.gp.cs.cmu.edu (Tom Lane) (10/03/90)

In article <7370223@hpfcso.HP.COM>, stroyan@hpfcso.HP.COM (Mike Stroyan) writes:
> If you specify an
> addr of zero, then the system picks an address just above the top of the
> highest malloc'd area.

This is something I discovered the hard way, and I think it sucks.
Once you have iomapped something with the default address, you cannot
malloc more than a couple dozen Kbytes of additional memory.  This is 
not a reasonable default.
Currently I tell iomap to map my device at sbrk() plus 1 Mbyte or so
(rounded off to a 64Kb boundary).  This gives me room to malloc 1 Mb,
which is sufficient for the particular program I have at hand, but
it's far from a general-purpose solution.

A much better solution would be to iomap the device at someplace like
0x40000000.  I'm afraid that trying to do that would force the kernel
to give me a huge page table, if indeed it would work at all; so I
have not tried it.

Can anybody at HP provide a workable, efficient solution for mapping
I/O devices without constraining subsequent use of malloc?

-- 
				tom lane
Internet: tgl@cs.cmu.edu
UUCP: <your favorite internet/arpanet gateway>!cs.cmu.edu!tgl
BITNET: tgl%cs.cmu.edu@cmuccvma
CompuServe: >internet:tgl@cs.cmu.edu

stroyan@hpfcso.HP.COM (Mike Stroyan) (10/04/90)

>A much better solution would be to iomap the device at someplace like
>0x40000000.  I'm afraid that trying to do that would force the kernel
>to give me a huge page table, if indeed it would work at all; so I
>have not tried it.
>
>Can anybody at HP provide a workable, efficient solution for mapping
>I/O devices without constraining subsequent use of malloc?

You are correct that mapping at a very high address will cause a very big
page table.  (Actually the call would usually fail because the address
is also limited by the configurable kernel parameter "shmmaxaddr".)
There are plans to allow very high addresses with a segmented page
table, and to make the default addresses very high.  Until those
changes make their way to a release and onto your disk, there is
no simple solution to choosing an address.

Mike Stroyan, mike_stroyan@fc.hp.com

munir@hpfcmgw.HP.COM (Munir Mallal) (10/05/90)

>> If you specify an
>> addr of zero, then the system picks an address just above the top of the
>> highest malloc'd area.

>This is something I discovered the hard way, and I think it sucks.
>Once you have iomapped something with the default address, you cannot
>malloc more than a couple dozen Kbytes of additional memory.  This is 
>not a reasonable default.

Not quite, the default is controlled by a kernel parameter shmbrk.  The
default for this is 16 x 4K pages (64K Bytes).  Build a kernel with a
value you feel is more convenient.