public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC] Allow drivers/scsi/imm.c to compile in 2.5.1pre6
@ 2001-12-08  2:45 Rich Baum
  2001-12-08 14:02 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Baum @ 2001-12-08  2:45 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel, campbell

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

The attached patch fixes compile errors in imm.c in 2.5.1pre6.  At boot it 
will detect the drive however if a disk is in the drive I get an oops (see 
oops1.log).  If there is no disk it will boot just fine.

When I run 'eject /dev/sda' after I insert a disk in the drive I get an oops 
(see oops2.log).

Please give me some feedback on what can be done to fix these problems.  I 
can also do other tests and provide more information if need.

Thanks,
Rich

[-- Attachment #2: imm.diff --]
[-- Type: text/x-diff, Size: 1292 bytes --]

--- linux/drivers/scsi/imm.c	Sun Sep 30 14:26:07 2001
+++ linux-rb/drivers/scsi/imm.c	Sun Dec  2 20:45:20 2001
@@ -137,7 +137,7 @@
 
     if (!pb) {
 	printk("imm: parport reports no devices.\n");
-	spin_lock_irq(&io_request_lock);
+	spin_lock_irq(&hreg->host_lock);
 	return 0;
     }
   retry_entry:
@@ -163,7 +163,7 @@
 		      "pardevice is owning the port for too longtime!\n",
 			   i);
 		    parport_unregister_device (imm_hosts[i].dev);
-		    spin_lock_irq(&io_request_lock);
+		    spin_lock_irq(&hreg->host_lock);
 		    return 0;
 		}
 	    }
@@ -219,13 +219,13 @@
     }
     if (nhosts == 0) {
 	if (try_again == 1) {
-	    spin_lock_irq(&io_request_lock);
+	    spin_lock_irq(&hreg->host_lock);
 	    return 0;
 	}
 	try_again = 1;
 	goto retry_entry;
     } else {
-	spin_lock_irq (&io_request_lock);
+	spin_lock_irq (&hreg->host_lock);
 	return 1;		/* return number of hosts detected */
     }
 }
@@ -948,10 +948,10 @@
     if (cmd->SCp.phase > 0)
 	imm_pb_release(cmd->host->unique_id);
 
-    spin_lock_irqsave(&io_request_lock, flags);
+    spin_lock_irqsave(&cmd->host->host_lock, flags);
     tmp->cur_cmd = 0;
     cmd->scsi_done(cmd);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&cmd->host->host_lock, flags);
     return;
 }
 

[-- Attachment #3: oops1.log --]
[-- Type: text/plain, Size: 2553 bytes --]

ksymoops 2.4.3 on i586 2.5.1-pre1.  Options used
     -v /usr/src/linux-rb/vmlinux (specified)
     -K (specified)
     -L (specified)
     -o /lib/modules/2.5.1-pre6/ (specified)
     -m /usr/src/linux-rb/System.map (specified)

No modules in ksyms, skipping objects
CPU: 0
EIP: 0010:[<c0210bcf>]  Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 000010202
eax: 000003eb ebx: 00000200 ecx: 0000037a edx: 00000000
esi: 00000378 edi: 00000001 ebp: 00000025 esp: c030fe5c
ds: 0018 es:0018 ss:0018
Stack: 00000000 00000000 00000000 00000000 00000378 c0210eee 00000378 00000000
       00000200 c030dede 00000000 c7f15200 00000378 c0210eee 00000200 c7f15200
       00000000 00000378 c0211309 00000000 00000000 00000200 00000001 0000021f
Call Trace: [<c0210eee>] [<c0210eee>] [<c0211309>] [c0211823>] [<c02300d8>]
  [<c020f559>] [<c01192d8>] [<c011c54a>] [<c019dalf>] [<c0119235>] [<c011911c>]
  [<c0118ef3>] [<c0108465>] [<c010a598>] [<c01af292>] [<c01af0a0>] [<c0105262>]
  [<c0105000>]
Code: 88 02 89 ca 89 e8 ee 4b 75 e7 83 c4 04 b8 01 00 00 00 5b 5e

>>EIP; c0210bce <imm_byte_in+3e/60>   <=====
Trace; c0210eee <imm_in+16e/180>
Trace; c0210eee <imm_in+16e/180>
Trace; c0211308 <imm_completion+f8/200>
Trace; c020f558 <ncr_scatter_896R1+48/e0>
Trace; c01192d8 <__run_task_queue+48/60>
Trace; c011c54a <tqueue_bh+2a/30>
Trace; c0118ef2 <do_softirq+52/a0>
Trace; c0108464 <do_IRQ+84/a0>
Trace; c010a598 <call_do_IRQ+6/e>
Trace; c01af292 <pr_power_idle+1f2/240>
Trace; c01af0a0 <pr_power_idle+0/240>
Trace; c0105262 <cpu_idle+52/70>
Trace; c0105000 <_stext+0/0>
Code;  c0210bce <imm_byte_in+3e/60>
00000000 <_EIP>:
Code;  c0210bce <imm_byte_in+3e/60>   <=====
   0:   88 02                     mov    %al,(%edx)   <=====
Code;  c0210bd0 <imm_byte_in+40/60>
   2:   89 ca                     mov    %ecx,%edx
Code;  c0210bd2 <imm_byte_in+42/60>
   4:   89 e8                     mov    %ebp,%eax
Code;  c0210bd4 <imm_byte_in+44/60>
   6:   ee                        out    %al,(%dx)
Code;  c0210bd4 <imm_byte_in+44/60>
   7:   4b                        dec    %ebx
Code;  c0210bd6 <imm_byte_in+46/60>
   8:   75 e7                     jne    fffffff1 <_EIP+0xfffffff1> c0210bbe <imm_byte_in+2e/60>
Code;  c0210bd8 <imm_byte_in+48/60>
   a:   83 c4 04                  add    $0x4,%esp
Code;  c0210bda <imm_byte_in+4a/60>
   d:   b8 01 00 00 00            mov    $0x1,%eax
Code;  c0210be0 <imm_byte_in+50/60>
  12:   5b                        pop    %ebx
Code;  c0210be0 <imm_byte_in+50/60>
  13:   5e                        pop    %esi

[-- Attachment #4: oops2.log --]
[-- Type: text/plain, Size: 2560 bytes --]

ksymoops 2.4.3 on i586 2.5.1-pre1.  Options used
     -v /usr/src/linux-rb/vmlinux (specified)
     -K (specified)
     -L (specified)
     -o /lib/modules/2.5.1-pre6/ (specified)
     -m /usr/src/linux-rb/System.map (specified)

No modules in ksyms, skipping objects
CPU: 0
EIP: 0010:[<c0210bcf>]  Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 000010202
eax: 000003eb ebx: 00000200 ecx: 0000037a edx: 00000000
esi: 00000378 edi: 00000001 ebp: 00000025 esp: c030fe5c
ds: 0018 es:0018 ss:0018
Stack: 00000000 00000000 00000000 00000000 00000378 c0210eee 00000378 00000000
       00000200 c0137900 c11e787c 00000092 c7f8c624 c7f8c624 00000200 c7f15200
       00000000 00000378 c0211309 00000000 00000000 00000200 00000001 00003957
Call Trace: [<c0210eee>] [<c0137900>] [<c0211309>] [c0211823>] [<c01c0e41>]
  [<c020f559>] [<c01192d8>] [<c011c54a>] [<c019dalf>] [<c0119235>] [<c011911c>]
  [<c0118ef3>] [<c0108465>] [<c010a598>] [<c01af292>] [<c01af0a0>] [<c0105262>]
  [<c0105000>]
Code: 88 02 89 ca 89 e8 ee 4b 75 e7 83 c4 04 b8 01 00 00 00 5b 5e

>>EIP; c0210bce <imm_byte_in+3e/60>   <=====
Trace; c0210eee <imm_in+16e/180>
Trace; c0137900 <bio_destructor+c0/e0>
Trace; c0211308 <imm_completion+f8/200>
Trace; c020f558 <ncr_scatter_896R1+48/e0>
Trace; c01192d8 <__run_task_queue+48/60>
Trace; c011c54a <tqueue_bh+2a/30>
Trace; c0118ef2 <do_softirq+52/a0>
Trace; c0108464 <do_IRQ+84/a0>
Trace; c010a598 <call_do_IRQ+6/e>
Trace; c01af292 <pr_power_idle+1f2/240>
Trace; c01af0a0 <pr_power_idle+0/240>
Trace; c0105262 <cpu_idle+52/70>
Trace; c0105000 <_stext+0/0>
Code;  c0210bce <imm_byte_in+3e/60>
00000000 <_EIP>:
Code;  c0210bce <imm_byte_in+3e/60>   <=====
   0:   88 02                     mov    %al,(%edx)   <=====
Code;  c0210bd0 <imm_byte_in+40/60>
   2:   89 ca                     mov    %ecx,%edx
Code;  c0210bd2 <imm_byte_in+42/60>
   4:   89 e8                     mov    %ebp,%eax
Code;  c0210bd4 <imm_byte_in+44/60>
   6:   ee                        out    %al,(%dx)
Code;  c0210bd4 <imm_byte_in+44/60>
   7:   4b                        dec    %ebx
Code;  c0210bd6 <imm_byte_in+46/60>
   8:   75 e7                     jne    fffffff1 <_EIP+0xfffffff1> c0210bbe <imm_byte_in+2e/60>
Code;  c0210bd8 <imm_byte_in+48/60>
   a:   83 c4 04                  add    $0x4,%esp
Code;  c0210bda <imm_byte_in+4a/60>
   d:   b8 01 00 00 00            mov    $0x1,%eax
Code;  c0210be0 <imm_byte_in+50/60>
  12:   5b                        pop    %ebx
Code;  c0210be0 <imm_byte_in+50/60>
  13:   5e                        pop    %esi


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][RFC] Allow drivers/scsi/imm.c to compile in 2.5.1pre6
  2001-12-08  2:45 [PATCH][RFC] Allow drivers/scsi/imm.c to compile in 2.5.1pre6 Rich Baum
@ 2001-12-08 14:02 ` Jens Axboe
  2001-12-08 14:06   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2001-12-08 14:02 UTC (permalink / raw)
  To: Rich Baum; +Cc: linux-kernel, campbell

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

On Fri, Dec 07 2001, Rich Baum wrote:
> The attached patch fixes compile errors in imm.c in 2.5.1pre6.  At boot it 
> will detect the drive however if a disk is in the drive I get an oops (see 
> oops1.log).  If there is no disk it will boot just fine.

Two problems:

- detect() is not run with lock held anymore
- use of ->address is deprecated

Please try attached patch -- it's a quickie, so no guarentees :-)

-- 
Jens Axboe


[-- Attachment #2: imm-1 --]
[-- Type: text/plain, Size: 2385 bytes --]

--- /opt/kernel/linux-2.5.1-pre7/drivers/scsi/imm.c	Sun Sep 30 15:26:07 2001
+++ drivers/scsi/imm.c	Sat Dec  8 08:58:55 2001
@@ -124,11 +124,6 @@
     int i, nhosts, try_again;
     struct parport *pb;
 
-    /*
-     * unlock to allow the lowlevel parport driver to probe
-     * the irqs
-     */
-    spin_unlock_irq(&io_request_lock);
     pb = parport_enumerate();
 
     printk("imm: Version %s\n", IMM_VERSION);
@@ -137,7 +132,6 @@
 
     if (!pb) {
 	printk("imm: parport reports no devices.\n");
-	spin_lock_irq(&io_request_lock);
 	return 0;
     }
   retry_entry:
@@ -163,7 +157,6 @@
 		      "pardevice is owning the port for too longtime!\n",
 			   i);
 		    parport_unregister_device (imm_hosts[i].dev);
-		    spin_lock_irq(&io_request_lock);
 		    return 0;
 		}
 	    }
@@ -219,13 +212,11 @@
     }
     if (nhosts == 0) {
 	if (try_again == 1) {
-	    spin_lock_irq(&io_request_lock);
 	    return 0;
 	}
 	try_again = 1;
 	goto retry_entry;
     } else {
-	spin_lock_irq (&io_request_lock);
 	return 1;		/* return number of hosts detected */
     }
 }
@@ -834,7 +825,7 @@
 	    if (cmd->SCp.buffers_residual--) {
 		cmd->SCp.buffer++;
 		cmd->SCp.this_residual = cmd->SCp.buffer->length;
-		cmd->SCp.ptr = cmd->SCp.buffer->address;
+		cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset;
 
 		/*
 		 * Make sure that we transfer even number of bytes
@@ -897,6 +888,7 @@
 {
     imm_struct *tmp = (imm_struct *) data;
     Scsi_Cmnd *cmd = tmp->cur_cmd;
+    struct Scsi_Host *host = cmd->host;
     unsigned long flags;
 
     if (!cmd) {
@@ -948,10 +940,10 @@
     if (cmd->SCp.phase > 0)
 	imm_pb_release(cmd->host->unique_id);
 
-    spin_lock_irqsave(&io_request_lock, flags);
+    spin_lock_irqsave(&host->host_lock, flags);
     tmp->cur_cmd = 0;
     cmd->scsi_done(cmd);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&host->host_lock, flags);
     return;
 }
 
@@ -1008,7 +1000,7 @@
 	    /* if many buffers are available, start filling the first */
 	    cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer;
 	    cmd->SCp.this_residual = cmd->SCp.buffer->length;
-	    cmd->SCp.ptr = cmd->SCp.buffer->address;
+	    cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset;
 	} else {
 	    /* else fill the only available buffer */
 	    cmd->SCp.buffer = NULL;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][RFC] Allow drivers/scsi/imm.c to compile in 2.5.1pre6
  2001-12-08 14:02 ` Jens Axboe
@ 2001-12-08 14:06   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2001-12-08 14:06 UTC (permalink / raw)
  To: Rich Baum; +Cc: linux-kernel, campbell

On Sat, Dec 08 2001, Jens Axboe wrote:
> Two problems:
> 
> - detect() is not run with lock held anymore
> - use of ->address is deprecated

Actually a third one too that is also right in my patch but I neglected
to mention -- don't rely on using cmd->host _after_ having called
->scsi_done() on this command.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-12-08 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-08  2:45 [PATCH][RFC] Allow drivers/scsi/imm.c to compile in 2.5.1pre6 Rich Baum
2001-12-08 14:02 ` Jens Axboe
2001-12-08 14:06   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox