From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 3 20:50:25 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F0CD1065688 for ; Mon, 3 Nov 2008 20:50:25 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from smtp.lamaiziere.net (net.lamaiziere.net [91.121.44.19]) by mx1.freebsd.org (Postfix) with ESMTP id E393A8FC1E for ; Mon, 3 Nov 2008 20:50:24 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from baby-jane.lamaiziere.net (94.10.87-79.rev.gaoland.net [79.87.10.94]) by smtp.lamaiziere.net (Postfix) with ESMTPA id 28DB9633676 for ; Mon, 3 Nov 2008 21:50:23 +0100 (CET) Received: from baby-jane-lamaiziere-net.local (localhost [127.0.0.1]) by baby-jane.lamaiziere.net (Postfix) with ESMTP id A5D91642DD3 for ; Mon, 3 Nov 2008 21:50:22 +0100 (CET) Date: Mon, 3 Nov 2008 21:50:21 +0100 From: Patrick =?ISO-8859-15?Q?Lamaizi=E8re?= To: freebsd-hackers@freebsd.org Message-ID: <20081103215021.0412b7b2@baby-jane-lamaiziere-net.local> Organization: /dave/nulle X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; i386-apple-darwin9.3.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: problem with bus_dmamap_load_uio X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2008 20:50:25 -0000 Hello, (8-Current/i386) I've got a problem with bus_dmamap_load_uio(9). I want to use it to map an uio for DMA with the Geode security block (glxsb(4)). It works, i can make milions of crypto operations with cryptotest. But when (i guess, i'm not sure) the free memory becomes low, bus_dmamap_load_uio() fails with errno == EFBIG. I can reproduce the problem by running "periodic daily", "dd if=/dev/zero of=foo", ... By sample i run into problems with Mem: 33M Active, 310M Inact, 82M Wired, 60M Buf, 69M Free. When it fails the uio is : uio_segflg = UIO_SYSSPACE uio_iovcnt = 1, totlen = 16384 (the total length for iov) uio_resid = 16384 (i've got some failure with size between 4000 and 16384) I don't understand why bus_dmamap_load_uio() cannot load the uio. Also when it fails, i copy the uio into a buffer and then a bus_dmamap_load() of the buffer always works. The dma tag is allocated with: bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev),/* parent */ 16, 0, /* alignments, bounds */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ 16384, /* maxsize */ 1, /* nsegments */ 16384, /* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->sc_dmat); The dma map is created just before the bus_dmamap_load_uio() and destroyed later. (source : http://user.lamaiziere.net/patrick/glxsb.c , see glxsb_crypto_encdec() ). I'm trying to understand and fix this problem for several days, so any idea will be very cool... thanks, regards.