Date: Mon, 6 Aug 2012 15:53:40 -0400 From: John Baldwin <jhb@freebsd.org> To: Stanislav Sedov <stas@freebsd.org> Cc: arm@freebsd.org, Peter Jeremy <peter@rulingia.com>, mips@freebsd.org Subject: Re: On-stack allocation of DMA S/G lists Message-ID: <201208061553.40588.jhb@freebsd.org> In-Reply-To: <20120806124150.52fb0be17155cac723866d63@FreeBSD.org> References: <20120703111753.GB72292@server.rulingia.com> <201208061026.06328.jhb@freebsd.org> <20120806124150.52fb0be17155cac723866d63@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, August 06, 2012 3:41:50 pm Stanislav Sedov wrote: > On Mon, 6 Aug 2012 10:26:06 -0400 > John Baldwin <jhb@freebsd.org> mentioned: > > > On Thursday, July 12, 2012 8:26:05 am John Baldwin wrote: > > > On Sunday, July 08, 2012 7:05:16 am Peter Jeremy wrote: > > > > 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? > > > > > > That does seem dubious. x86 stores the array in the tag instead. > > > > I have an untested patch to change bus-dma on arm and mips to allocate a > > dynamic S/G list in each DMA tag on first use instead of using on-stack > > allocation (which I think is rather bogus). Can folks review and test this > > patch please? Thanks. > > > > http://www.FreeBSD.org/~jhb/patches/arm_mips_dynamic_dma_segs.patch > > > > Seems to work fine for me on ARM. > I had to initialize mflags to 0 in one place to get it compiling though. Ah, yes. That's why x86 did that. :) I've updated it to fix that, thanks for testing! -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208061553.40588.jhb>