BAD_SG_DMA panic in aha1542
I previously reported an ISA DMA issue for the 2.6.12 kernel. The issue persists through at least 2.6.18. SCSI controller is an Adaptec AHA-1542B (ISA).
The action "mount -t iso9660 /dev/scd0 /mnt/cdrom -r"
produces
(cdrom detection messages as various modules autoload, then...) sgpnt[0:1] page c1ee5af0/0x1ee5af0 length 32
Kernel panic - not syncing: Buffer at physical address > 16 Mb used for aha1542
As before, no problems using the sda hard disk (which is the boot drive):
everything works reliably until I touch the cdrom drive.
I'll be happy to assist with the debugging, but the system with the aha1542 has no development facilities, i.e., I'll have to build test kernels on a different system, and turnaround is going to be slow :-(.
Thanks in advance for helping me get this old machine working again. No issues with 2.4 kernels. I have no idea about 2.5 kernels and 2.6 kernels prior to 2.6.12. As for why I didn't report this before now, the aha1542b was in my parts bin until I cobbled a system together approx. two weeks ago, mostly to see if a useful system could still be had using legacy hardware and modern GNU/Linux software. I'm happy to report the answer is mostly "yes".
Signature · 4 lines
----------------------------------------------------------------------- Bob Tracy WTO + WIPO = DMCA? http://www.anti-dmca.org [email protected] -----------------------------------------------------------------------
Quoted 2 lines
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.
scsi/sr_ioctl.c renamed from scsi/sr_ioctl.c~ +23 -4
@@ -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 ) {
Quoted 9 lines · Bob Tracy
I previously reported an ISA DMA issue for the 2.6.12 kernel. The issue persists through at least 2.6.18. SCSI controller is an Adaptec AHA-1542B (ISA).
The action "mount -t iso9660
/dev/scd0/mnt/cdrom-r"produces
(cdrom detection messages as various modules autoload, then...)
Knowing what these messages are is would be helpful; it tells me what point in the initialisation it got to.
Quoted 9 lines
sgpnt[0:1] page c1ee5af0/0x1ee5af0 length 32
Kernel panic - not syncing: Buffer at physical address > 16 Mb used for aha1542As before, no problems using the sda hard disk (which is the boot drive):
everything works reliably until I touch the cdrom drive.I'll be happy to assist with the debugging, but the system with the aha1542 has no development facilities, i.e., I'll have to build test kernels on a different system, and turnaround is going to be slow :-(.
I'm interested.
This is clearly a use_sg==1 path that has failed to bounce the buffer for some reason ... and I was contemplating eliminating the GFP_DMA from our sr driver because I thought the block bouncing had it covered.
It might also be helpful to apply this patch. It should give a stack trace of the problem command and not immediately panic the box.
Thanks,
James
drivers/scsi/aha1542.c +6 -2
@@ -75,7 +75,7 @@ static void BAD_SG_DMA(Scsi_Cmnd * SCpnt,/* * Not safe to continue. */ -panic ("Buffer at physical address > 16Mb used for aha1542" ); +WARN_ON (1 ); }#include <linux/stat.h>
@@ -725,8 +725,12 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))panic ("Foooooooood fight!" ); };any2scsi (cptr[i].dataptr,SCSI_SG_PA (&sgpnt[i])); -if (SCSI_SG_PA (&sgpnt[i]) + sgpnt[i].length -1 >ISA_DMA_THRESHOLD ) +if (SCSI_SG_PA (&sgpnt[i]) + sgpnt[i].length -1 >ISA_DMA_THRESHOLD ) {BAD_SG_DMA (SCpnt, sgpnt, SCpnt->use_sg, i); + SCpnt->result =DID_ERROR <<16 ; +done (SCpnt); +return 0 ; + }any2scsi (cptr[i].datalen, sgpnt[i].length); };any2scsi (ccb[mbo].datalen, SCpnt->use_sg *sizeof (struct chain ));
Quoted 5 lines · James Bottomley
Quoted 4 lines · Bob Tracy
I previously reported an ISA DMA issue for the 2.6.12 kernel. The issue persists through at least 2.6.18. SCSI controller is an Adaptec AHA-1542B (ISA).
Quoted 8 lines
Quoted 5 lines
The action "mount -t iso9660
/dev/scd0/mnt/cdrom-r"produces
(cdrom detection messages as various modules autoload, then...)
Knowing what these messages are is would be helpful; it tells me what point in the initialisation it got to.
Sorry about that... I'm running the DSL-N distribution (based on Knoppix), and having to transcribe the log messages by hand from the console, i.e., there's no logfile to cut-and-paste from :-(. I don't have access to the machine except on weekdays, but I'll repeat the crash first thing Monday morning and copy everything that's there...
Quoted 8 lines
I'm interested.
This is clearly a use_sg==1 path that has failed to bounce the buffer for some reason ... and I was contemplating eliminating the
GFP_DMAfrom our sr driver because I thought the block bouncing had it covered.It might also be helpful to apply this patch. It should give a stack trace of the problem command and not immediately panic the box.
I'll throw together a 2.6.21 kernel with this patch and give it a try. Again, it will be at least Monday before you hear back from me on this.
Thanks!
Signature · 4 lines
----------------------------------------------------------------------- Bob Tracy WTO + WIPO = DMCA? http://www.anti-dmca.org [email protected] -----------------------------------------------------------------------
Quoted 9 lines · Alan Cox
Quoted 2 lines
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 inBAD_DMA(aha1542.c) if needed to get a good trace.Please report success/failure/change.
Can do. I don't have access to the machine on weekends, so it will be at least Monday before I can give this a whirl. Thanks!
Signature · 4 lines
----------------------------------------------------------------------- Bob Tracy WTO + WIPO = DMCA? http://www.anti-dmca.org [email protected] -----------------------------------------------------------------------
Apologies to all concerned for an unfortunate delay in resolving this. I chose "unwisely" when I picked a popular experimental distro's 2.6.20 kernel source as a base for my troubleshooting efforts. The resulting kernel panics when it tries to load the initial ramdisk, and I don't have the patience to track down which of the turned-on-by-default experimental configuration parameters might be causing the problem.
I'll go retrieve a more conservatively-configured source tree (closer to what DSL-N uses) and start over...
Signature · 4 lines
----------------------------------------------------------------------- Bob Tracy WTO + WIPO = DMCA? http://www.anti-dmca.org [email protected] -----------------------------------------------------------------------
Quoted 10 lines · James Bottomley
Quoted 9 lines
sgpnt[0:1] page c1ee5af0/0x1ee5af0 length 32
Kernel panic - not syncing: Buffer at physical address > 16 Mb used for aha1542As before, no problems using the sda hard disk (which is the boot drive):
everything works reliably until I touch the cdrom drive.I'll be happy to assist with the debugging, but the system with the aha1542 has no development facilities, i.e., I'll have to build test kernels on a different system, and turnaround is going to be slow :-(.
Quoted 8 lines
I'm interested.
This is clearly a use_sg==1 path that has failed to bounce the buffer for some reason ... and I was contemplating eliminating the
GFP_DMAfrom our sr driver because I thought the block bouncing had it covered.It might also be helpful to apply this patch. It should give a stack trace of the problem command and not immediately panic the box.
It's due to the crappy ->generic_packet() ioctl stuff, it bypasses the block layer. So that needs to be converted to use block pc requests and the block layer interface, then things will just work.
Christoph had a sort-of ready patch for that some time ago. Christoph, did that ever materialize into a full blown patch?
Signature · 1 line
Jens Axboe
Quoted 6 lines · Jens Axboe
It's due to the crappy ->generic_packet() ioctl stuff, it bypasses the block layer. So that needs to be converted to use block pc requests and the block layer interface, then things will just work.
Christoph had a sort-of ready patch for that some time ago. Christoph, did that ever materialize into a full blown patch?
I had a fullblown patch somewhere. The only drawback was that I didn't convert pcd because I neither understand enough of the hardware nor do I really understand what's going on there.
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Jens Axboe
It's due to the crappy ->generic_packet() ioctl stuff, it bypasses the block layer. So that needs to be converted to use block pc requests and the block layer interface, then things will just work.
Christoph had a sort-of ready patch for that some time ago. Christoph, did that ever materialize into a full blown patch?
I had a fullblown patch somewhere. The only drawback was that I didn't convert pcd because I neither understand enough of the hardware nor do I really understand what's going on there.
Cool, pass the patch and I'll try to see if I can convert pcd.
Signature · 1 line
Jens Axboe