legacy megaraid driver bug in mm-series
Subsystems (2)
Begin forwarded message:
Date: Mon, 05 Sep 2005 21:05:40 -0400
From: Jack Byer <[email protected]>
To: [email protected]
Subject: legacy megaraid driver bug in mm-series
My AMI megaraid card no longer works with recent mm-series kernels. The bug appears on mm- kernels newer than 2.6.12-rc6-mm1; mainline kernels are not affected.
The driver will load and detect both devices on the card (sda and sdb). It will scan each device and read the partition table successfully, however the megaraid driver message will include the following errors:
sda: sector size 0 reported, assuming 512.
sda: asking for cache data failed.
sda: assuming drive cache: write through
When the kernel tries to mount the root file system, I get the following error:
ReiserFS: sda3: warning: sh-2006: read_super_block: bread failed (dev sda3, block 2, size 4096)
ReiserFS: sda3: warning: sh-2006: read_super_block: bread failed (dev sda3, block 16, size 4096)
VFS: Cannot open root device "sda3" or unknown-block(0,3)
Here is a summary of the kernels I have tested for this bug:
2.6.11-mm1: works
2.6.11-mm4: works
2.6.12-rc5-mm1: will not compile
2.6.12-rc6-mm1: works
2.6.12-mm1: will not compile megaraid driver
2.6.12-mm2: broken
2.6.13-mm1: broken
2.6.12: works
2.6.13: works
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 3 lines · Andrew Morton
Begin forwarded message:
This looks preyyu much like a breakage because we're now always sending S/G list down the scsi layer.
The patch below brings over code to handle that case from the megaraid_mbox driver. It's still wrong for the case someone sends a MODE_SENSE from highmem userspace, but it should at least boot with the patch applied.
drivers/scsi/megaraid.c +13 -3
@@ -621,8 +621,6 @@if (islogical) {switch (cmd->cmnd[0 ]) {case TEST_UNIT_READY : -memset (cmd->request_buffer,0 , cmd->request_bufflen); -#if MEGA_HAVE_CLUSTERING /* * Do we support clustering and is the support enabled
@@ -653,7 +651,19 @@#endif case MODE_SENSE : -memset (cmd->request_buffer,0 , cmd->cmnd[4 ]); +if (cmd->use_sg) { +struct scatterlist *sgl; +caddr_t vaddr; + + sgl = (struct scatterlist *)cmd->request_buffer; + vaddr = (caddr_t) + (page_address ((&sgl[0 ])->page) + + (&sgl[0 ])->offset); + +memset (vaddr,0 , cmd->cmnd[4 ]); + }else { +memset (cmd->request_buffer,0 , cmd->cmnd[4 ]); + } cmd->result = (DID_OK <<16 ); cmd->scsi_done (cmd);return NULL ;
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Andrew Morton
Quoted 9 lines
Quoted 1 line
Begin forwarded message:
This looks preyyu much like a breakage because we're now always sending S/G list down the scsi layer.
The patch below brings over code to handle that case from the
megaraid_mboxdriver. It's still wrong for the case someone sends aMODE_SENSEfrom highmem userspace, but it should at least boot with the patch applied.
Jack, have you had a chance to test this?
Thanks.
Quoted 35 lines
Index:
scsi-misc-2.6/drivers/scsi/megaraid.c
===================================================================drivers/scsi/megaraid.c +13
-3@@ -621,8 +621,6 @@if (islogical) {switch (cmd->cmnd[0 ]) {case TEST_UNIT_READY : -memset (cmd->request_buffer,0 , cmd->request_bufflen); -#if MEGA_HAVE_CLUSTERING /* * Do we support clustering and is the support enabled @@ -653,7 +651,19 @@#endif case MODE_SENSE : -memset (cmd->request_buffer,0 , cmd->cmnd[4 ]); +if (cmd->use_sg) { +struct scatterlist *sgl; +caddr_t vaddr; + + sgl = (struct scatterlist *)cmd->request_buffer; + vaddr = (caddr_t) + (page_address ((&sgl[0 ])->page) + + (&sgl[0 ])->offset); + +memset (vaddr,0 , cmd->cmnd[4 ]); + }else { +memset (cmd->request_buffer,0 , cmd->cmnd[4 ]); + } cmd->result = (DID_OK <<16 ); cmd->scsi_done (cmd);return NULL ;
Quoted 16 lines · Andrew Morton
Quoted 12 lines · Christoph Hellwig
Quoted 2 lines · Andrew Morton
Begin forwarded message:
This looks preyyu much like a breakage because we're now always sending S/G list down the scsi layer.
The patch below brings over code to handle that case from the
megaraid_mboxdriver. It's still wrong for the case someone sends aMODE_SENSEfrom highmem userspace, but it should at least boot with the patch applied.
Quoted 4 lines
Jack, have you had a chance to test this?
Thanks.
Sorry, I spent the weekend whitewater rafting :) I will be able to test this patch on Wednesday. Which kernel versions should I apply this patch to?
Quoted 37 lines
Quoted 35 lines
Index:
scsi-misc-2.6/drivers/scsi/megaraid.c
===================================================================drivers/scsi/megaraid.c +13
-3@@ -621,8 +621,6 @@if (islogical) {switch (cmd->cmnd[0 ]) {case TEST_UNIT_READY : -memset (cmd->request_buffer,0 , cmd->request_bufflen); -#if MEGA_HAVE_CLUSTERING /* * Do we support clustering and is the support enabled @@ -653,7 +651,19 @@#endif case MODE_SENSE : -memset (cmd->request_buffer,0 , cmd->cmnd[4 ]); +if (cmd->use_sg) { +struct scatterlist *sgl; +caddr_t vaddr; + + sgl = (struct scatterlist *)cmd->request_buffer; + vaddr = (caddr_t) + (page_address ((&sgl[0 ])->page) + + (&sgl[0 ])->offset); + +memset (vaddr,0 , cmd->cmnd[4 ]); + }else { +memset (cmd->request_buffer,0 , cmd->cmnd[4 ]); + } cmd->result = (DID_OK <<16 ); cmd->scsi_done (cmd);return NULL ;
Quoted 17 lines · Jack Byer
Quoted 16 lines · Andrew Morton
Quoted 12 lines · Christoph Hellwig
Quoted 2 lines · Andrew Morton
Begin forwarded message:
This looks preyyu much like a breakage because we're now always sending S/G list down the scsi layer.
The patch below brings over code to handle that case from the
megaraid_mboxdriver. It's still wrong for the case someone sends aMODE_SENSEfrom highmem userspace, but it should at least boot with the patch applied.
Quoted 6 lines
Quoted 4 lines
Jack, have you had a chance to test this?
Thanks.
Sorry, I spent the weekend whitewater rafting :) I will be able to test this patch on Wednesday. Which kernel versions should I apply this patch to?
I did it against the at that time latest scsi-misc tree. The old megaraid driver hasn'tt changed much for a long time so it should apply against any recent-ish tree.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 51 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 7 lines
This looks preyyu much like a breakage because we're now always sending S/G list down the scsi layer.
The patch below brings over code to handle that case from the
megaraid_mboxdriver. It's still wrong for the case someone sends aMODE_SENSEfrom highmem userspace, but it should at least boot with the patch applied.Jack, have you had a chance to test this?
Thanks.
Quoted 9 lines
Quoted 2 lines
Sorry, I spent the weekend whitewater rafting :) I will be able to test this patch on Wednesday. Which kernel versions should I apply this patch to?
I did it against the at that time latest scsi-misc tree. The old megaraid driver hasn'tt changed much for a long time so it should apply against any recent-ish tree.
I tried the patch on a 2.6.13-mm1 tree. It applied cleanly, but produced a few compiler warnings:
/usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c: In function `issue_scb':/usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1143: warning: passing arg 2 ofwritel' makes pointer from integer without a cast /usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c: In functionissue_scb_block':/usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1206: warning: passing arg 2 ofwritel' makes pointer from integer without a cast /usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1219: warning: passing arg 2 ofwritel' makes pointer from integer without a cast/usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1221: warning: passing arg 1 ofreadl' makes pointer from integer without a cast /usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c: In functionmegaraid_isr_memmapped':/usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1351: warning: passing arg 1 ofreadl' makes pointer from integer without a cast /usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1358: warning: passing arg 2 ofwritel' makes pointer from integer without a cast/usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1377: warning: passing arg 2 ofwritel' makes pointer from integer without a cast /usr/src/linux-2.6.13-mm1/drivers/scsi/megaraid.c:1381: warning: passing arg 1 ofreadl' makes pointer from integer without a cast
Quoted 3 lines
Booting the kernel resulted in the same symptoms as before (can not mount root fs).
I have also tested the 2-6-14-rc1 and I have the same bug.