Date: Fri, 5 Sep 1997 13:29:23 +0200 (MET DST) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: hackers@freebsd.org Subject: contigmalloc problem in 2.2.1 ? Message-ID: <199709051129.NAA11699@labinfo.iet.unipi.it>
next in thread | raw e-mail | index | archive | help
Hi, while debugging my sound driver I hit some problems with contigmalloc. I am running 2.2.1 and have no connectivity to the cvs tree at the moment so I cannot check if the bug is known, anyways things are as follows: on a system with 8MB, I am calling contigmalloc to allocate four chunks of 64K as follows: size = 65536; b->buf = contigmalloc(size, M_DEVBUF, M_NOWAIT, 0ul, 0xfffffful, 1ul, (chan >=4) ? 0x20000ul : 0x10000ul); (the call is just copied from the code to alloc a bounce buffer in isa.c. I understand, from /sys/vm/vm_page.c where contigmalloc() is defined, that 1ul represents the alignment (whatever it means) and 0x20000ul or 0x10000ul the "boundary" that the block of memory should not cross. All allocations return b->buf != NULL . But on further investigations (instrumenting isa_dmarangecheck()) it turns out that the fourth allocation gives me pages at first page: 0x0026e000 second page: 0x0026f000 third page: 0x00270000 ... so the block crosses the boundary (other blocks seem to be regularly aligned since they have the first page at 0x00XX0000 and so on.). Am i using the parameters in contigmalloc the wrong way (e.g. should I specify an alignment of 64K ?) or the function is broken ? If it is broken, it is a bug which affects bounce buffers as well since I am using exactly the same code. The bug might go unnoticed if dma requests happen to fit within a page. With disks this might be true, with multimedia devices (e.g. audio cards and scanners) this often does not hold (e.g. a typical blocksize for audio is 160 bytes, or some other submultiple of the sample rate, e.g. 2000). Thanks Luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709051129.NAA11699>