From owner-freebsd-current@FreeBSD.ORG Wed May 20 07:59:25 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 783E0106564A; Wed, 20 May 2009 07:59:25 +0000 (UTC) (envelope-from klingfon@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by mx1.freebsd.org (Postfix) with ESMTP id C76A48FC0A; Wed, 20 May 2009 07:59:24 +0000 (UTC) (envelope-from klingfon@gmail.com) Received: by ey-out-2122.google.com with SMTP id 9so77986eyd.7 for ; Wed, 20 May 2009 00:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=DFTI52QHgBTRXSy95KPMlH34jTx/0xb26uOzIXr7FvE=; b=uqhJdPwjfuZ291FAW1JCki+FDuSOWxodDSgclDhbfs5shXvy0VD1f+YyvRSr69BwUY KI9XEi9xit2dsGJIfwSErZMfXBiC9OzLIGIMMNH6Z060gts1WxvQ9BG8iVjzIV1kLZyk VMLNGehiuLrbqZIztT9VFYpj8gNcR4OUR4Zro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Bku5gmN5E1CQGiCnqJbpRKhoj+nSp24f8ROB1Edc33EDvToXxLic9uBDyH0XUbEfr/ 8w7oo8+vPxALl3w+QOLKI5uedtbAVa0XnzV9fgFBJ+0wxiw/GBqz81Ur6D4iMSlZoAB/ lmj2+gxh2LKs3kXLtarTVzd7xN9GEh31IiT8Y= MIME-Version: 1.0 Received: by 10.216.45.71 with SMTP id o49mr230609web.57.1242806363682; Wed, 20 May 2009 00:59:23 -0700 (PDT) In-Reply-To: <4A13A9D0.5080706@FreeBSD.org> References: <43b1bb350905150939s5d503f00x27116e7ffe79a37@mail.gmail.com> <43b1bb350905180025g682d3764qba5a450d85d8f961@mail.gmail.com> <43b1bb350905181331r44b35b13i22aa1ba6a18103ed@mail.gmail.com> <4A121C40.7040201@FreeBSD.org> <43b1bb350905182353v3812c523pa52cdf41ce886907@mail.gmail.com> <4A1264E8.2080707@FreeBSD.org> <43b1bb350905190554i511c1b32sa9320b10a86e2af2@mail.gmail.com> <4A130C5C.6090104@FreeBSD.org> <43b1bb350905192321h4e43e178vc9a00b646d0e2340@mail.gmail.com> <4A13A9D0.5080706@FreeBSD.org> Date: Wed, 20 May 2009 09:59:23 +0200 Message-ID: <43b1bb350905200059w115b02bcy339d20570b590504@mail.gmail.com> From: Magnus Kling To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-current@freebsd.org Subject: Re: Kernel panic when reboot on server with a Promise SX4000 and two ATA disks RAID1. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2009 07:59:25 -0000 2009/5/20 Alexander Motin > Magnus Kling wrote: > >> Addr2line gives me /usr/src/sys/dev/ata/chipsets/ata-promise.c:1066 >> >> struct ata_dma_prdentry *prd = request->dma->sg; >> >> Can we do an if statement with pointer prd? Or check what "sg" is at the >> moment? What is "sg"? >> > > A-ha! That explains a lot! I have got it! > > Flush command has no data and does not uses DMA. Dereference of NULL > request->dma pointer crashes the system. That dereference is just not needed > there. Try please attached patch. > > -- > Alexander Motin > > --- ata-promise.c.prev 2009-05-20 01:24:31.000000000 +0300 > +++ ata-promise.c 2009-05-20 09:51:13.000000000 +0300 > @@ -1054,7 +1054,7 @@ ata_promise_sx4_command(struct ata_reque > device_t gparent = GRANDPARENT(request->dev); > struct ata_pci_controller *ctlr = device_get_softc(gparent); > struct ata_channel *ch = device_get_softc(request->parent); > - struct ata_dma_prdentry *prd = request->dma->sg; > + struct ata_dma_prdentry *prd; > caddr_t window = rman_get_virtual(ctlr->r_res1); > u_int32_t *wordp; > int i, idx, length = 0; > @@ -1098,6 +1098,7 @@ ata_promise_sx4_command(struct ata_reque > case ATA_READ_DMA48: > case ATA_WRITE_DMA: > case ATA_WRITE_DMA48: > + prd = request->dma->sg; > wordp = (u_int32_t *) > (window + (ch->unit * ATA_PDC_CHN_OFFSET) + ATA_PDC_HSG_OFFSET); > i = idx = 0; > > I can confirm that the above patch works fine! Thank you for taking your time to solve this bug. /Magnus