contigmalloc() breaking Xorg

Peter Jeremy peter at rulingia.com
Sun Jul 8 11:05:32 UTC 2012


On 2012-Jul-03 21:17:53 +1000, Peter Jeremy <peter at server.rulingia.com> wrote:
>I have a reasonably recent 8-stable/amd64 system (r237444) with a "ATI
>Radeon HD 2400 Pro", xorg-server-1.10.6,1 and xf86-video-ati-6.14.3_1
>8GB RAM and ZFS.  I'm seeing fairly consistent problems with Xorg
...
>How difficult would it be to modify bus_dmamem_alloc() [at least on
>x86] to handle multi-segment allocations?

I think I've managed to create an amd64 bus_dmamem_alloc() that allows
page-sized allocations as long as no boundary condition is specified
and no more than page-sized alignment is required (porting it to other
architectures would be trivial).  I've given it a quick whirl inside a
VBox and no smoke came out but I'd appreciate someone with a better
understanding of bus_dma(9) and vm/vm_contig.c giving
http://www.rulingia.com/bugs/patch-wiredmalloc a once-over.  Note that
this patch is against 8.x but there's only a trivial difference to head.

BTW, the comment in busdma_machdep.c:bus_dmamem_alloc()
	 * XXX Use Contigmalloc until it is merged into this facility
	 *     and handles multi-seg allocations.  Nobody is doing
	 *     multi-seg allocations yet though.
	 * XXX Certain AGP hardware does.
does not appear to be accurate.  Apart from drm, quite a few drivers
call bus_dma_tag_create(9) with multiple segments and also call
bus_dmamem_alloc(9) [though I haven't verified that the calls share
the same bus_dma_tag, so I can't be absolutely certain].

BTW(2): Whilst studying busdma_machdep.c for arm and mips, I've
noticed they appear to potentially allocate substantial kernel stack
under some conditions as several bus_dma(9) functions include:
    bus_dma_segment_t dm_segments[dmat->nsegments];
What prevents this overflowing the kernel stack?

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20120708/0c6cd6c1/attachment.pgp


More information about the freebsd-hackers mailing list