From owner-freebsd-bugs@FreeBSD.ORG Sun Mar 25 03:27:32 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA33E16A404; Sun, 25 Mar 2007 03:27:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id AAC3513C483; Sun, 25 Mar 2007 03:27:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from freefall.freebsd.org (sam@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l2P3RQnd069816; Sun, 25 Mar 2007 03:27:26 GMT (envelope-from sam@freefall.freebsd.org) Received: (from sam@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l2P3RQ0B069812; Sun, 25 Mar 2007 03:27:26 GMT (envelope-from sam) Date: Sun, 25 Mar 2007 03:27:26 GMT From: Sam Leffler Message-Id: <200703250327.l2P3RQ0B069812@freefall.freebsd.org> To: raj@linuxense.com, sam@FreeBSD.org, freebsd-bugs@FreeBSD.org Cc: Subject: Re: kern/110662: [safe] safenet driver causes kernel panic X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2007 03:27:32 -0000 Synopsis: [safe] safenet driver causes kernel panic State-Changed-From-To: open->analyzed State-Changed-By: sam State-Changed-When: Sun Mar 25 03:17:47 UTC 2007 State-Changed-Why: The problem is reproducible. There are several issues. The failure to create the bus dma tag is because there is a 4-byte alignment requirement set for the dst dma tag and BUS_DMA_ALLOCNOW is specified. This causes an attempt to pre-allocate a bunch of memory to the bounce page zone which fails. Removing BUS_DMA_ALLOCNOW does not work however because the safe driver is not prepared for bus dma setup requests to be deferred. If that happens then the driver will crash because it assumes the dma setup always succeeds and so blindly stuffs a bogus physical address into the dma engine. It appears the alignment requirement is actually not needed however; though I must re-check the chip specs and code to make sure. Applying the following change avoids the bounce page issue and allows cryptotest to run to completion but it likely provides only properly-aligned dst buffers so this may just mask a problem that will crop up for other consumers such as fast ipsec. As I said already I need to investigate more before committing a fix. cvs diff: Diffing . Index: safe.c =================================================================== RCS file: /usr/ncvs/src/sys/dev/safe/safe.c,v retrieving revision 1.17 diff -u -r1.17 safe.c --- safe.c 23 Feb 2007 12:18:52 -0000 1.17 +++ safe.c 25 Mar 2007 03:23:03 -0000 @@ -298,7 +298,7 @@ goto bad4; } if (bus_dma_tag_create(NULL, /* parent */ - sizeof(u_int32_t), /* alignment */ + 1, /* alignment */ SAFE_MAX_DSIZE, /* boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ http://www.freebsd.org/cgi/query-pr.cgi?pr=110662