Commit be4bde60 authored by Randy Hron's avatar Randy Hron Committed by Linus Torvalds

[PATCH] qlogic "this should not happen" fix

This patch is based on changes I've used for 2.5.31, 2.5.31-mm1,
2.5.32-mm1, 2.5.32-mm2, and 2.5.33-mm1.

Without the patch, 2.5.x during heavy benchmark/stress testing
eventually locks up with these final messages:

kernel: qlogicfc0 : no handle slots, this should not happen.
kernel: hostdata->queued is 6, in_ptr: 7d

This is a combination of Doug Ledford's patch:
http://marc.theaimsgroup.com/?l=linux-kernel&m=103005703808312&w=2
and Eric Weigle's patch:
http://marc.theaimsgroup.com/?l=linux-kernel&m=103005790509079&w=2

2.5.33 (and all predecessors i've tested) locked up without it.
parent f5831097
...@@ -1342,18 +1342,11 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *)) ...@@ -1342,18 +1342,11 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr); num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
num_free = (num_free > 2) ? num_free - 2 : 0; num_free = (num_free > 2) ? num_free - 2 : 0;
host->can_queue = hostdata->queued + num_free; host->can_queue = host->host_busy + num_free;
if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN) if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
host->can_queue = QLOGICFC_REQ_QUEUE_LEN; host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
host->sg_tablesize = QLOGICFC_MAX_SG(num_free); host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
/* this is really gross */
if (host->can_queue <= host->host_busy){
if (host->can_queue+2 < host->host_busy)
DEBUG(printk("qlogicfc%d.c crosses its fingers.\n", hostdata->host_id));
host->can_queue = host->host_busy + 1;
}
LEAVE("isp2x00_queuecommand"); LEAVE("isp2x00_queuecommand");
return 0; return 0;
...@@ -1623,17 +1616,11 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1623,17 +1616,11 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr); num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
num_free = (num_free > 2) ? num_free - 2 : 0; num_free = (num_free > 2) ? num_free - 2 : 0;
host->can_queue = hostdata->queued + num_free; host->can_queue = host->host_busy + num_free;
if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN) if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
host->can_queue = QLOGICFC_REQ_QUEUE_LEN; host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
host->sg_tablesize = QLOGICFC_MAX_SG(num_free); host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
if (host->can_queue <= host->host_busy){
if (host->can_queue+2 < host->host_busy)
DEBUG(printk("qlogicfc%d : crosses its fingers.\n", hostdata->host_id));
host->can_queue = host->host_busy + 1;
}
outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR); outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
LEAVE_INTR("isp2x00_intr_handler"); LEAVE_INTR("isp2x00_intr_handler");
} }
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#define DATASEGS_PER_COMMAND 2 #define DATASEGS_PER_COMMAND 2
#define DATASEGS_PER_CONT 5 #define DATASEGS_PER_CONT 5
#define QLOGICFC_REQ_QUEUE_LEN 127 /* must be power of two - 1 */ #define QLOGICFC_REQ_QUEUE_LEN 255 /* must be power of two - 1 */
#define QLOGICFC_MAX_SG(ql) (DATASEGS_PER_COMMAND + (((ql) > 0) ? DATASEGS_PER_CONT*((ql) - 1) : 0)) #define QLOGICFC_MAX_SG(ql) (DATASEGS_PER_COMMAND + (((ql) > 0) ? DATASEGS_PER_CONT*((ql) - 1) : 0))
#define QLOGICFC_CMD_PER_LUN 8 #define QLOGICFC_CMD_PER_LUN 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment