Re: BAD_SG_DMA panic in aha1542

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Bob Tracy <rct@...>
Cc: <linux-kernel@...>, <linux-scsi@...>
Date: Friday, April 27, 2007 - 6:13 pm

> As before, no problems using the sda hard disk (which is the boot drive):

A little quiet contemplation and gnome number 387 suggests trying the following
(and providing more detailed information such as the last message printed before
the DMA message). Stuff a BUG() before the panic in BAD_DMA (aha1542.c) if needed
to get a good trace.

Please report success/failure/change.

--- drivers/scsi/sr_ioctl.c~	2007-04-27 22:53:33.885035256 +0100
+++ drivers/scsi/sr_ioctl.c	2007-04-27 22:53:33.885035256 +0100
@@ -187,9 +187,10 @@
 	struct scsi_sense_hdr sshdr;
 	int result, err = 0, retries = 0;
 	struct request_sense *sense = cgc->sense;
-
+	void *zebedee = cgc->buffer;
+	
 	SDev = cd->device;
-
+	
 	if (!sense) {
 		sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
 		if (!sense) {
@@ -197,7 +198,22 @@
 			goto out;
 		}
 	}
-
+	
+	if (cgc->buflen && cd->device->host->unchecked_isa_dma) {
+		switch(cgc->data_direction) {
+			case DMA_NONE:
+				break;
+			case DMA_FROM_DEVICE:
+			case DMA_TO_DEVICE: /* Boing!!!! said Zebedee */
+				zebedee = kmalloc(cgc->buflen, GFP_KERNEL|GFP_DMA);
+				if (zebedee ==NULL) {
+					err = -ENOMEM;
+					goto out;
+				}
+		}
+		if (cgc->data_direction == DMA_TO_DEVICE)
+			memcpy(zebedee, cgc->buffer, cgc->buflen);
+	}
       retry:
 	if (!scsi_block_when_processing_errors(SDev)) {
 		err = -ENODEV;
@@ -206,10 +222,13 @@
 
 	memset(sense, 0, sizeof(*sense));
 	result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
-			      cgc->buffer, cgc->buflen, (char *)sense,
+			      zebedee, cgc->buflen, (char *)sense,
 			      cgc->timeout, IOCTL_RETRIES, 0);
 
 	scsi_normalize_sense((char *)sense, sizeof(*sense), &sshdr);
+	
+	if (zebedeee != cgc->buffer && cgc->data_direction == DMA_FROM_DEVICE)
+		memcpy(cgc->buffer, zebedee, cgc->buflen);
 
 	/* Minimal error checking.  Ignore cases we know about, and report the rest. */
 	if (driver_byte(result) != 0) {
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
BAD_SG_DMA panic in aha1542, Bob Tracy, (Fri Apr 27, 5:47 pm)
Re: BAD_SG_DMA panic in aha1542, James Bottomley, (Fri Apr 27, 6:21 pm)
Re: BAD_SG_DMA panic in aha1542, Jens Axboe, (Mon Apr 30, 1:32 pm)
Re: BAD_SG_DMA panic in aha1542, Christoph Hellwig, (Mon Apr 30, 1:39 pm)
Re: BAD_SG_DMA panic in aha1542, Jens Axboe, (Mon Apr 30, 1:52 pm)
Re: BAD_SG_DMA panic in aha1542, Bob Tracy, (Mon Apr 30, 10:33 am)
Re: BAD_SG_DMA panic in aha1542, Bob Tracy, (Fri Apr 27, 7:53 pm)
Re: BAD_SG_DMA panic in aha1542, Alan Cox, (Fri Apr 27, 6:13 pm)
Re: BAD_SG_DMA panic in aha1542, Bob Tracy, (Fri Apr 27, 7:56 pm)