From owner-freebsd-mips@FreeBSD.ORG Wed Aug 29 03:24:12 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBF441065673 for ; Wed, 29 Aug 2012 03:24:12 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id A787D8FC0A for ; Wed, 29 Aug 2012 03:24:12 +0000 (UTC) Received: by pbbrp2 with SMTP id rp2so335588pbb.13 for ; Tue, 28 Aug 2012 20:24:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=ZeVQ7YfpiSELJp1WVGxjNwki7zzt5hVAWUzSWav2Rco=; b=UhFQU3Zzx1wX0kzvjiC30k2CHqpr3C+Hz2VTkX29HE+lI5C7tsf3sN+me1gKqjbAoa RfINAaLYpkksQLY2WgFjBWDLUrSBcy06ffUxWZOY2AHNmpiekdO8pLDrQvuD3F9MbbCR MtxV2aF8syCc+2eH2SY41pI2p67TCxtHf6Q0ODog7IIhlx8oOFpISoIeCKImKRnOsY+j kLPgvgEhqOmA2lQHdZ8pgQ66cQeTCUTJfaxCFt8kfYwCQH30GOlgplzn0RYnDOENF+U3 Mb1K5INacncbNTKYIYvb20/pGlH2sc3wLgCp4oTidGy6bK0TdUDZRotFKkP5wclj2dRW M6tQ== Received: by 10.66.82.97 with SMTP id h1mr378975pay.45.1346210651934; Tue, 28 Aug 2012 20:24:11 -0700 (PDT) Received: from [10.0.0.63] (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPS id qb6sm18364490pbb.18.2012.08.28.20.24.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Aug 2012 20:24:11 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Tue, 28 Aug 2012 21:24:08 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <1F780BF4-84C3-48D5-9832-EA32381969A6@bsdimp.com> References: To: Adrian Chadd X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQl9shFHnriu++rFmQrqBmEuByfFGyRB2TwGlEKDGdoqA+1fFRX5yvOPE9mUW9oQzDK70XFs Cc: scottl@freebsd.org, freebsd-mips@freebsd.org Subject: Re: MIPS busdma map questions 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: Wed, 29 Aug 2012 03:24:13 -0000 On Aug 28, 2012, at 8:22 PM, Adrian Chadd wrote: > Hi, >=20 > I have a couple of busdma map questions. >=20 > #1 - in mips/mips/busdma_machdep.c, bus_dmamap_destroy() calls > _busdma_free_dmamap() and -then- goes and walks the dma map list. Is > this a good idea or not? :) Accessing free memory after freeing it is a free ticket to a free dose = of free pain. It should be freed after the if that checks to see if it = is in use. > #2 - the ath(4) code (in sys/dev/ath/if_ath.c:ath_descdma_alloc_desc() > on -HEAD) does the following: >=20 > * creates a tag > * allocates a dmamap (bus_dmamap_create) - storing it in = dd->dd_dmamap; > * allocates memory via bus_dmamem_alloc - also storing it in = dd->dd_dmamap. >=20 > Now, I saw some NULL pointer derefernce going on when thigns failed to > load - and what I found was bus_dmamem_alloc() overwrites the dmat > pointer passed in (dd_dmamap above). So the dmamap allocated via > bus_dmamap_create() is just plain overwritten. >=20 > I'm guessing that when allocating memory via bus_dmamem_alloc(), the > call to bus_dmamap_create() (and the bus_dmamap_destroy()) isn't > needed. >=20 > Scott/mips people - what do you think? That bug isn't so easy to figure out with my 5 second attention span... Warner >=20 >=20 > Adrian > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to = "freebsd-mips-unsubscribe@freebsd.org"