From owner-freebsd-mips@FreeBSD.ORG Mon Aug 6 19:42:06 2012 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EDC9D106564A; Mon, 6 Aug 2012 19:42:05 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (cl-414.sto-01.se.sixxs.net [IPv6:2001:16d8:ff00:19d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 904708FC08; Mon, 6 Aug 2012 19:42:05 +0000 (UTC) Received: from orion.swifttest.com (unknown [74.3.97.61]) by mx0.deglitch.com (Postfix) with ESMTPA id 644DA8FC36; Mon, 6 Aug 2012 23:42:04 +0400 (MSK) Received: from orion.swifttest.com (localhost [127.0.0.1]) by orion.swifttest.com (Postfix) with SMTP id DFD235C3C; Mon, 6 Aug 2012 12:41:50 -0700 (PDT) Date: Mon, 6 Aug 2012 12:41:50 -0700 From: Stanislav Sedov To: John Baldwin Message-Id: <20120806124150.52fb0be17155cac723866d63@FreeBSD.org> In-Reply-To: <201208061026.06328.jhb@freebsd.org> References: <20120703111753.GB72292@server.rulingia.com> <20120708110516.GA38312@server.rulingia.com> <201207120826.05577.jhb@freebsd.org> <201208061026.06328.jhb@freebsd.org> Organization: The FreeBSD Project X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: arm@freebsd.org, Peter Jeremy , mips@freebsd.org Subject: Re: 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 19:42:06 -0000 On Mon, 6 Aug 2012 10:26:06 -0400 John Baldwin 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. -- Stanislav Sedov ST4096-RIPE () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments