mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: rct@gherkin.frus.com (Bob Tracy)
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: BAD_SG_DMA panic in aha1542
Date: Fri, 27 Apr 2007 23:13:46 +0100	[thread overview]
Message-ID: <20070427231346.647797bc@the-village.bc.nu> (raw)
In-Reply-To: <20070427214709.DC44BDBA2@gherkin.frus.com>

> As before, no problems using the sda hard disk (which is the boot drive):
> everything works reliably until I touch the cdrom 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) {

  reply	other threads:[~2007-04-27 22:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27 21:47 Bob Tracy
2007-04-27 22:13 ` Alan Cox [this message]
2007-04-27 23:56   ` Bob Tracy
2007-04-27 22:21 ` James Bottomley
2007-04-27 23:53   ` Bob Tracy
2007-04-30 14:33   ` Bob Tracy
2007-04-30 17:32   ` Jens Axboe
2007-04-30 17:39     ` Christoph Hellwig
2007-04-30 17:52       ` Jens Axboe
2007-05-01  2:10 Bob Tracy
2007-05-01 13:33 ` Jens Axboe
2007-05-01 13:42   ` Bob Tracy
2007-05-01 13:46 ` Alan Cox
2007-05-01 18:32   ` Bob Tracy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070427231346.647797bc@the-village.bc.nu \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rct@gherkin.frus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®