From owner-freebsd-mips@FreeBSD.ORG Mon Aug 6 14:40:04 2012 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34E8410656B6; Mon, 6 Aug 2012 14:40:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 82D608FC15; Mon, 6 Aug 2012 14:40:03 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B91D1B981; Mon, 6 Aug 2012 10:40:02 -0400 (EDT) From: John Baldwin To: Peter Jeremy Date: Mon, 6 Aug 2012 10:26:06 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <20120703111753.GB72292@server.rulingia.com> <20120708110516.GA38312@server.rulingia.com> <201207120826.05577.jhb@freebsd.org> In-Reply-To: <201207120826.05577.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201208061026.06328.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 06 Aug 2012 10:40:02 -0400 (EDT) Cc: arm@freebsd.org, mips@freebsd.org Subject: On-stack allocation of DMA S/G lists X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 14:40:04 -0000 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 -- John Baldwin