From owner-freebsd-current@FreeBSD.ORG Tue Oct 7 12:01:45 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C700816A4B3 for ; Tue, 7 Oct 2003 12:01:45 -0700 (PDT) Received: from cvsup.no.freebsd.org (c2h5oh.idi.ntnu.no [129.241.103.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0352E43FBD for ; Tue, 7 Oct 2003 12:01:42 -0700 (PDT) (envelope-from Tor.Egge@cvsup.no.freebsd.org) Received: from localhost (localhost [127.0.0.1])h97J1XWA079221; Tue, 7 Oct 2003 19:01:34 GMT (envelope-from Tor.Egge@cvsup.no.freebsd.org) Date: Tue, 07 Oct 2003 19:01:00 +0000 (GMT) Message-Id: <20031007.190100.74678681.Tor.Egge@cvsup.no.freebsd.org> To: t-yonetani@ergobrains.co.jp From: Tor Egge In-Reply-To: <20031007040349.GA10406@ergobrains.co.jp> References: <20031007040349.GA10406@ergobrains.co.jp> X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_Oct__7_19:01:00_2003_697)--" Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org Subject: Re: savecore: first and last dump headers disagree on /dev/ad0b X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Tue, 07 Oct 2003 19:01:45 -0000 ----Next_Part(Tue_Oct__7_19:01:00_2003_697)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit > Hello. > -CURRENT as of yesterday can't save kernel dump: > > savecore: first and last dump headers disagree on /dev/ad0b > savecore: unsaved dumps found but not saved > > Is this a known issue? Yes. I had the same problem on my development machine at the end of August and ended up using the enclosed patch to get working dumps. - Tor Egge ----Next_Part(Tue_Oct__7_19:01:00_2003_697)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename=atafix Index: sys/dev/ata/ata-all.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v retrieving revision 1.187 diff -u -r1.187 ata-all.c --- sys/dev/ata/ata-all.c 27 Aug 2003 15:27:56 -0000 1.187 +++ sys/dev/ata/ata-all.c 31 Aug 2003 22:31:33 -0000 @@ -109,9 +109,11 @@ ch->device[MASTER].channel = ch; ch->device[MASTER].unit = ATA_MASTER; ch->device[MASTER].mode = ATA_PIO; + ch->device[MASTER].dumping = 0; ch->device[SLAVE].channel = ch; ch->device[SLAVE].unit = ATA_SLAVE; ch->device[SLAVE].mode = ATA_PIO; + ch->device[SLAVE].dumping = 0; ch->dev = dev; ch->state = ATA_IDLE; bzero(&ch->queue_mtx, sizeof(struct mtx)); Index: sys/dev/ata/ata-all.h =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-all.h,v retrieving revision 1.65 diff -u -r1.65 ata-all.h --- sys/dev/ata/ata-all.h 25 Aug 2003 11:13:04 -0000 1.65 +++ sys/dev/ata/ata-all.h 31 Aug 2003 22:56:14 -0000 @@ -227,6 +227,7 @@ int cmd; /* last cmd executed */ int mode; /* transfermode */ + int dumping; /* panic dump in progress */ void (*setmode)(struct ata_device *atadev, int mode); }; Index: sys/dev/ata/ata-disk.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.c,v retrieving revision 1.159 diff -u -r1.159 ata-disk.c --- sys/dev/ata/ata-disk.c 25 Aug 2003 09:01:49 -0000 1.159 +++ sys/dev/ata/ata-disk.c 31 Aug 2003 23:18:40 -0000 @@ -336,6 +336,26 @@ if (!adp) return ENXIO; + /* Some chipsets must be configured for PIO before dump starts. */ + if (adp->device->dumping == 0) { + adp->device->dumping = 1; + adp->device->setmode(adp->device, ATA_PIO_MAX); + } + if (length == 0) { + int error = 0; + /* Commit dump to media */ + if (adp->device->param != NULL && + adp->device->param->support.command2 & ATA_SUPPORT_FLUSHCACHE) { + error = ata_controlcmd(adp->device, ATA_FLUSHCACHE, 0, 0, 0); + if (error != 0) + ata_prtdev(adp->device, "Flush cache failed\n"); + else + ata_prtdev(adp->device, "Flush cache succeeded\n"); + } else + ata_prtdev(adp->device, "Flush cache skipped\n"); + return error; + } + bzero(&request, sizeof(struct ata_request)); request.device = adp->device; request.data = virtual; @@ -352,13 +372,15 @@ if (adp->device->channel->hw.transaction(&request) == ATA_OP_FINISHED) return EIO; - while (request.bytecount > request.donecount) { + while (adp->device->channel->running == &request) { DELAY(20); - adp->device->channel->running = &request; adp->device->channel->hw.interrupt(adp->device->channel); - adp->device->channel->running = NULL; if (request.status & ATA_S_ERROR) return EIO; + } + if (request.bytecount > request.donecount) { + printf("Short write?"); + return EIO; } return 0; } Index: sys/dev/ata/ata-queue.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-queue.c,v retrieving revision 1.4 diff -u -r1.4 ata-queue.c --- sys/dev/ata/ata-queue.c 28 Aug 2003 08:22:53 -0000 1.4 +++ sys/dev/ata/ata-queue.c 31 Aug 2003 22:35:30 -0000 @@ -106,9 +106,36 @@ ata_controlcmd(struct ata_device *atadev, u_int8_t command, u_int16_t feature, u_int64_t lba, u_int16_t count) { - struct ata_request *request = ata_alloc_request(); + struct ata_request *request; int error = ENOMEM; + /* Handle calls from addump */ + if (atadev->dumping) { + struct ata_request request2; + request = &request2; + bzero(request, sizeof(struct ata_request)); + request->device = atadev; + request->u.ata.command = command; + request->u.ata.lba = lba; + request->u.ata.count = count; + request->u.ata.feature = feature; + request->flags = ATA_R_CONTROL; + request->timeout = 5; + if (atadev->channel->hw.transaction(request) == + ATA_OP_CONTINUES) { + while (atadev->channel->running == request && + (request->status & ATA_S_ERROR) == 0) { + DELAY(20); + atadev->channel->hw.interrupt(atadev->channel); + } + } + error = request->result; + if ((request->status & ATA_S_ERROR) != 0 && error == 0) + error = EIO; + return error; + } + request = ata_alloc_request(); + if (request) { request->device = atadev; request->u.ata.command = command; ----Next_Part(Tue_Oct__7_19:01:00_2003_697)----