Date: Tue, 01 Sep 1998 16:31:35 +0930 (CST) From: "Daniel O'Connor" <doconnor@gsoft.com.au> To: freebsd-scsi@FreeBSD.ORG Subject: CAM crashes Message-ID: <XFMail.980901163135.doconnor@gsoft.com.au>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi,
I am using CAM on a 2.2.7 system (I have the 19980716 diffs applied) and I can
make it consistently panic the machine with vm_page_free: freeing busy page by
using cdda2wav (I will attach the patches I used to get it to work - they are
really rough though :)
Here is what I get out of gdb ->
test2# gdb -k kernel.0 vmcore.0
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-unknown-freebsd),
Copyright 1996 Free Software Foundation, Inc...
IdlePTD a50000
current pcb at 215e10
panic: vm_page_free: freeing busy page
#0 boot (howto=256) at ../../kern/kern_shutdown.c:266
266 dumppcb.pcb_cr3 = rcr3();
(kgdb) where
#0 boot (howto=256) at ../../kern/kern_shutdown.c:266
#1 0xf012fde3 in panic (fmt=0xf01c6bc2 "vm_page_free: freeing busy page")
at ../../kern/kern_shutdown.c:400
#2 0xf01c6c86 in vm_page_freechk_and_unqueue (m=0xf0b0a674)
at ../../vm/vm_page.c:948
#3 0xf01c6d0a in vm_page_free (m=0xf0b0a674) at ../../vm/vm_page.c:1014
#4 0xf01c4666 in vm_object_terminate (object=0xf1223280)
at ../../vm/vm_object.c:409
#5 0xf01c44b7 in vm_object_deallocate (object=0xf1223280)
at ../../vm/vm_object.c:353
#6 0xf013ca36 in shm_deallocate_segment (shmseg=0xf31634c0)
at ../../kern/sysv_shm.c:148
#7 0xf013cada in shm_delete_mapping (p=0xf1188c00, shmmap_s=0xf12381c0)
at ../../kern/sysv_shm.c:176
#8 0xf013d2f1 in shmexit (p=0xf1188c00) at ../../kern/sysv_shm.c:605
#9 0xf01295a2 in exit1 (p=0xf1188c00, rv=0) at ../../kern/kern_exit.c:176
#10 0xf0129484 in exit (p=0xf1188c00, uap=0xefbfff94, retval=0xefbfff84)
at ../../kern/kern_exit.c:106
#11 0xf01dc423 in syscall (frame={tf_es = 39, tf_ds = -272695257, tf_edi = 0,
tf_esi = -1, tf_ebp = -272639212, tf_isp = -272629788,
tf_ebx = 537620576, tf_edx = 0, tf_ecx = 1, tf_eax = 1, tf_trapno = 7,
tf_err = 7, tf_eip = 537571453, tf_cs = 31, tf_eflags = 646,
tf_esp = -272639232, tf_ss = 39}) at ../../i386/i386/trap.c:920
#12 0x200ab07d in ?? ()
(kgdb)
This crash is easily repeatable.. Sometimes though, cdda2wav works perfectly
and does not crash the machine when it exits, but I haven't worked those
circumstances out yet.
The command I was running at the time was
'cdda2wav -Owav -H -P -q -t1 track01.wav'
This system works fine for doing things like reading CD's normally and burning
them. It is a PII-350 with 64Mb of RAM. More information is available on
request (I could even mail you the crashdump if you want it :)
---------------------------------------------------------------------
|Daniel O'Connor software and network engineer for Genesis Software |
|http://www.gsoft.com.au |
|The nice thing about standards is that there are so many of them to|
|choose from. -- Andrew Tanenbaum |
---------------------------------------------------------------------
[-- Attachment #2 --]
Only in cdda2wav-0.95beta05.new: Makefile
Only in cdda2wav-0.95beta05.new: audiotrack01.mp3
diff -ru cdda2wav-0.95beta05/cdda2mp3 cdda2wav-0.95beta05.new/cdda2mp3
--- cdda2wav-0.95beta05/cdda2mp3 Sun Dec 14 10:24:05 1997
+++ cdda2wav-0.95beta05.new/cdda2mp3 Tue Aug 18 15:42:24 1998
@@ -1,4 +1,4 @@
-# !/bin/sh
+#!/usr/local/bin/bash
# Demo script for processing all audio tracks with a mp3 decoder
# based on a news article by Tom Kludy
# This variant uses named pipes in order to save space.
@@ -17,12 +17,12 @@
#
# specify the audio track listing program and its options
-LAT=list_audio_tracks
-LAT_OPTIONS=
+LAT='./cdda2wav'
+LAT_OPTIONS='-v 128'
# specify the sampling program and its options
# do not specify the track option here!
-CDDA2WAV=cdda2wav
+CDDA2WAV='./cdda2wav'
CDDA2WAV_OPTS='-Owav -H -P -q'
# for normal use, comment out the next line with a #
@@ -30,9 +30,10 @@
# the post processor is fed through a named pipe to avoid space waste
# specify the post processing program and its options
-MP_CODER=l3enc
+MP_CODER='8hz-mp3'
+MP_OPTIONS=
#MP_OPTIONS='2>/dev/null 1>/dev/null'
-MP_OPTIONS='-br 128000'
+#MP_OPTIONS='-br 128000'
#MP_OPTIONS='-hq'
# name of the named pipe
@@ -44,7 +45,7 @@
mkfifo $NPIPE
# clean up named pipe on exit, abort, ...
-trap "rm -rf $NPIPE" 0 2 3 4 6 7 8 10 11 12 13 15
+#trap "rm -rf $NPIPE" 0 2 3 4 6 7 8 10 11 12 13 15
# feed track numbers and start sectors into loop
$LAT $LAT_OPTIONS | while read TRACK STARTSECTOR;
Only in cdda2wav-0.95beta05.new: config.cache
Only in cdda2wav-0.95beta05.new: config.log
Only in cdda2wav-0.95beta05.new: config.status
Only in cdda2wav-0.95beta05.new/scsilib: Makefile
Only in cdda2wav-0.95beta05.new/scsilib: align.h
Only in cdda2wav-0.95beta05.new/scsilib: align_test
Only in cdda2wav-0.95beta05.new/scsilib: cam.patch
Only in cdda2wav-0.95beta05.new/scsilib: config.cache
Only in cdda2wav-0.95beta05.new/scsilib: config.log
Only in cdda2wav-0.95beta05.new/scsilib: config.status
diff -ru cdda2wav-0.95beta05/scsilib/scsi-bsd.c cdda2wav-0.95beta05.new/scsilib/
scsi-bsd.c
--- cdda2wav-0.95beta05/scsilib/scsi-bsd.c Mon Feb 23 03:26:34 1998
+++ cdda2wav-0.95beta05.new/scsilib/scsi-bsd.c Tue Aug 18 14:42:50 1998
@@ -30,6 +30,8 @@
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef BSD_CAM
+
#undef sense
#include <sys/scsiio.h>
@@ -283,3 +285,222 @@
return (ret);
}
#define sense u_sense.Sense
+
+#else /* BSD_CAM */
+/*
+ * Interface for the FreeBSD CAM passthrough device.
+ *
+ * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
+ * Copyright (c) 1998 Kenneth D. Merry <ken@kdm.org>
+ * Copyright (c) 1998 Joerg Schilling <schilling@fokus.gmd.de>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#undef sense
+#define scsi_sense CAM_scsi_sense
+#define scsi_inquiry CAM_scsi_inquiry
+#include <cam/cam.h>
+#include <cam/cam_ccb.h>
+#include <cam/scsi/scsi_message.h>
+#include <cam/scsi/scsi_pass.h>
+#include <camlib.h>
+
+#define CAM_MAXDEVS 128
+struct cam_device *cam_devices[CAM_MAXDEVS + 1];
+
+/*
+ * Build a list of everything we can find.
+ */
+EXPORT
+int scsi_open()
+{
+ struct cam_device *dev;
+ char name[16];
+ int unit;
+
+ bzero(cam_devices, sizeof(cam_devices));
+
+ for (unit = 0; unit < CAM_MAXDEVS; unit++) {
+ sprintf(name, "pass%d", unit);
+ cam_devices[unit] = cam_open_device(name, O_RDWR);
+ }
+ return(unit);
+}
+
+LOCAL
+long scsi_maxdma()
+{
+ return (MAXPHYS);
+}
+
+EXPORT void *
+scsi_getbuf(amt)
+ long amt;
+{
+ void *ret;
+
+ if (scg_maxdma == 0)
+ scg_maxdma = MAXPHYS;
+
+ if (amt <= 0 || amt > scg_maxdma)
+ return ((void *)0);
+ if (debug)
+ printf("scsi_getbuf: %ld bytes\n", amt);
+ ret = valloc((size_t)(amt));
+ return (ret);
+}
+
+EXPORT
+BOOL scsi_havebus(int busno)
+{
+ int unit;
+
+ for (unit = 0; cam_devices[unit] != NULL; unit++)
+ if (cam_devices[unit]->path_id == busno)
+ return(1);
+ return(0);
+}
+
+EXPORT
+int scsi_fileno(bus, unit, lun)
+{
+ int i;
+
+ for (i = 0; cam_devices[i] != NULL; i++)
+ if ((cam_devices[i]->path_id == bus) &&
+ (cam_devices[i]->target_id == unit) &&
+ (cam_devices[i]->target_lun == lun))
+ return(i);
+
+ fprintf(stderr, "lookup for %d,%d,%d failed\n", bus, unit, lun);
+ return(-1);
+}
+
+EXPORT
+int scsireset()
+{
+ /* XXX synchronous reset command - is this wise? */
+}
+
+LOCAL int
+scsi_send(int unit, struct scg_cmd *sp)
+{
+ struct cam_device *dev;
+ union ccb *ccb;
+ int rv, result;
+ u_int32_t ccb_flags;
+
+ if (unit < 0) {
+ fprintf(stderr, "attempt to reference invalid unit %d\n", unit);
+ sp->error = SCG_FATAL;
+ return (0);
+ }
+
+ dev = cam_devices[unit];
+ ccb = cam_getccb(dev);
+
+ /* Build the CCB */
+ bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio));
+ bcopy(sp->cdb.cmd_cdb, &ccb->csio.cdb_io.cdb_bytes, sp->cdb_len);
+
+ /*
+ * Set the data direction flags.
+ */
+ if (sp->size != 0)
+ ccb_flags = (sp->flags & SCG_RECV_DATA) ? CAM_DIR_IN :
+ CAM_DIR_OUT;
+ else
+ ccb_flags = CAM_DIR_NONE;
+
+ cam_fill_csio(&ccb->csio,
+ /* retries */ 1,
+ /* cbfncp */ NULL,
+ /* flags */ ccb_flags,
+ /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* data_ptr */ (u_int8_t *)sp->addr,
+ /* dxfer_len */ sp->size,
+ /* sense_len */ SSD_FULL_SIZE,
+ /* cdb_len */ sp->cdb_len,
+ /* timeout */ sp->timeout * 1000);
+
+ /* Run the command */
+ errno = 0;
+ if ((rv = cam_send_ccb(dev, ccb)) == -1) {
+ cam_freeccb(ccb);
+
+ return(rv);
+ } else {
+ /*
+ * Check for command status. Selection timeouts are fatal.
+ * For command timeouts, we pass back the appropriate
+ * error. If we completed successfully, there's (obviously)
+ * no error. We declare anything else "retryable".
+ */
+ switch(ccb->ccb_h.status & CAM_STATUS_MASK) {
+ case CAM_SEL_TIMEOUT:
+ result = SCG_FATAL;
+ break;
+ case CAM_CMD_TIMEOUT:
+ result = SCG_TIMEOUT;
+ break;
+ case CAM_REQ_CMP:
+ result = SCG_NO_ERROR;
+ break;
+ default:
+ result = SCG_RETRYABLE;
+ break;
+ }
+ }
+
+ sp->error = result;
+ if (result != SCG_NO_ERROR)
+ sp->ux_errno = EIO;
+
+ /* Pass the result back up */
+ bzero(&sp->scb, sizeof(sp->scb));
+ bzero(&sp->u_sense.cmd_sense, sizeof(sp->u_sense.cmd_sense));
+ sp->resid = ccb->csio.resid;
+ sp->sense_count = SSD_FULL_SIZE - ccb->csio.sense_resid;
+
+ /*
+ * Determine how much room we have for sense data.
+ */
+ if (sp->sense_count > SCG_MAX_SENSE)
+ sp->sense_count = SCG_MAX_SENSE;
+
+ /* Copy the sense data out */
+ bcopy(&ccb->csio.sense_data, &sp->u_sense.cmd_sense, sp->sense_count);
+
+ sp->u_scb.cmd_scb[0] = ccb->csio.scsi_status;
+
+ cam_freeccb(ccb);
+ return(0);
+}
+
+#undef scsi_sense
+#undef scsi_inquiry
+#define sense u_sense.Sense
+
+#endif /* BSD_CAM */
Only in cdda2wav-0.95beta05.new/scsilib: scsi-bsd.c.orig
diff -ru cdda2wav-0.95beta05/scsilib/scsihack.c cdda2wav-0.95beta05.new/scsilib/
scsihack.c
--- cdda2wav-0.95beta05/scsilib/scsihack.c Wed Feb 11 01:07:52 1998
+++ cdda2wav-0.95beta05.new/scsilib/scsihack.c Tue Aug 18 14:47:43 1998
@@ -42,6 +42,7 @@
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define SCSI_IMPL /* We have a SCSI implementation for *BSD */
+#define BSD_CAM
#include "scsi-bsd.c"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980901163135.doconnor>
