All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: Patch - SCSI host numbers - please apply
@ 2002-06-06 10:23 Itai Nahshon
  2002-06-12 21:59 ` Marcelo Tosatti
  0 siblings, 1 reply; 5+ messages in thread
From: Itai Nahshon @ 2002-06-06 10:23 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

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

This was sent on Apr 22 and probably lost.
This patch still applies cleanly to 2.4.19-pre10.

Can this get in the kernel before 2.4.19 final ?

-- Itai

----------  Forwarded Message  ----------

Subject: Patch - SCSI host numbers - please apply
Date: Mon, 22 Apr 2002 09:19:56 +0300
From: Itai Nahshon <nahshon@actcom.co.il>
To: Marcelo Tosatti <marcelo@conectiva.com.br>, Jens Axboe <axboe@suse.de>

Hello,
I think this has gone through enough testing...

History:
  A similar patch was submitted to to lkml and to linux-scsi
  two months ago. Verified by Aron Zeh <ARZEH@de.ibm.com> on Apr 9.
  The attached patch is a cleaned-up version
  (The original had #ifdef'ed the code that this one removes).

Kernel version info:
  2.4.x: Patch applies cleanly (and tested with) all 2.4.19-preX
        kernels.
  2.5.x: Patch applies with 8 line offset to 2.5.8.
        Bug verified only by "visual inspection". (but really nothing
	in the host_no allocation algorithm has changed since 2.4).

Bug info:
  Actually fixing two _different_ scenarios that look almost the same.
  Need two or more) scsi host adapters that are not required for
  normal system usage. I uses ide-scsi and usb-storage fr my
  tests. Start with a "clean system" (before any of these drivers
  is loaded). Suppose scsi host adapter drivers are named A and B.

  scenario 1:
	insmod A
	rmmod A
	insmod A
	insmod B

  scenario 2:
	insmod A
	rmmod A
	insmod B
	insmod A

  Without the patch, both scenarios end with both host adapters having
  the same host_no.

More tests:
  I tested also with param scsihosts=<host0>:<host1>:....
  (when loading scsi_mod)

Comment/motivation:
  This keeps max_scsi_host coherent with the length of the list
  scsi_host_no_list. Since we never shorten the list
  we should never decrement max_scsi_host.

Sincerely,
-- Itai

-------------------------------------------------------


[-- Attachment #2: scsi-host_no_fix.patch --]
[-- Type: text/x-diff, Size: 1130 bytes --]

--- drivers/scsi/hosts.c.orig	Mon Feb 25 21:38:04 2002
+++ drivers/scsi/hosts.c	Wed Apr 17 01:42:47 2002
@@ -81,8 +81,8 @@
 struct Scsi_Host * scsi_hostlist;
 struct Scsi_Device_Template * scsi_devicelist;
 
-int max_scsi_hosts;
-int next_scsi_host;
+int max_scsi_hosts;	/* host_no for next new host */
+int next_scsi_host;	/* count of registered scsi hosts */
 
 void
 scsi_unregister(struct Scsi_Host * sh){
@@ -107,21 +107,8 @@
     if (shn) shn->host_registered = 0;
     /* else {} : This should not happen, we should panic here... */
     
-    /* If we are removing the last host registered, it is safe to reuse
-     * its host number (this avoids "holes" at boot time) (DB) 
-     * It is also safe to reuse those of numbers directly below which have
-     * been released earlier (to avoid some holes in numbering).
-     */
-    if(sh->host_no == max_scsi_hosts - 1) {
-	while(--max_scsi_hosts >= next_scsi_host) {
-	    shpnt = scsi_hostlist;
-	    while(shpnt && shpnt->host_no != max_scsi_hosts - 1)
-		shpnt = shpnt->next;
-	    if(shpnt)
-		break;
-	}
-    }
     next_scsi_host--;
+
     kfree((char *) sh);
 }
 

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

* Re: Fwd: Patch - SCSI host numbers - please apply
  2002-06-06 10:23 Itai Nahshon
@ 2002-06-12 21:59 ` Marcelo Tosatti
  0 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2002-06-12 21:59 UTC (permalink / raw)
  To: Itai Nahshon; +Cc: lkml


On Thu, 6 Jun 2002, Itai Nahshon wrote:

> This was sent on Apr 22 and probably lost.
> This patch still applies cleanly to 2.4.19-pre10.
>
> Can this get in the kernel before 2.4.19 final ?

No. I dont consider the problem very serious for inclusion of the patch
now.

Resend me at 2.4.20pre time

Thanks


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

* Re: Fwd: Patch - SCSI host numbers - please apply
       [not found]   ` <200206181514.52827.nahshon@actcom.co.il>
@ 2002-06-18 21:18     ` Luben Tuikov
  2002-06-19  0:03       ` Itai Nahshon
  0 siblings, 1 reply; 5+ messages in thread
From: Luben Tuikov @ 2002-06-18 21:18 UTC (permalink / raw)
  To: nahshon, Marcelo Tosatti, linux-scsi

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

Itai,

After applying your patch to 2.4.18, I see the following
problems:

1. ide-scsi does NOT work. /proc/scsi/scsi shows NO
   devices and /proc/scsi/ide-scsi is empty.

2. /proc/scsi/{scsi, ide-scsi, scsi_test} are all empty!

3. After ``rmmod scsi_test'' and ``ls /proc/scsi''
   the kernel OOPS-es.

NONE of those problems exist with a non-patched kernel.

I used kernel 2.4.18, but doubt there'd difference for
2.5.x since the host_no stuff hasn't changed (2.5.22).

I've attached the OOPS and the tgz of my testing
module scsi_test.o.

Interested parties: this is in regards to the
scsi subsystem assigning _repeating_ host numbers
to hosts registered! See my message 
``/proc/scsi/driver/hosts with same numeric???''
dated 2002/05/29 on linux-scsi ML.

To repeat the problem:
$ insmod scsi_reg.o
$ rmmod scsi_reg
$ insmod scsi_req.o MaxHosts=20
$ ls /proc/scsi/scsi_test

Voila!

Here is the OOPS:
----------------------------
Jun 18 16:49:23 canoe kernel: Unable to handle kernel paging request at virtual address e5a59010
Jun 18 16:49:23 canoe kernel:  printing eip:
Jun 18 16:49:23 canoe kernel: c0150c68
Jun 18 16:49:23 canoe kernel: *pde = 1d58c067
Jun 18 16:49:23 canoe kernel: *pte = 00000000
Jun 18 16:49:23 canoe kernel: Oops: 0002
Jun 18 16:49:23 canoe kernel: CPU:    0
Jun 18 16:49:23 canoe kernel: EIP:    0010:[proc_get_inode+152/256]    Not tainted
Jun 18 16:49:23 canoe kernel: EIP:    0010:[<c0150c68>]    Not tainted
Jun 18 16:49:23 canoe kernel: EFLAGS: 00010286
Jun 18 16:49:23 canoe kernel: eax: e5a59000   ebx: dc921880   ecx: 00000001   edx: 00000003
Jun 18 16:49:23 canoe kernel: esi: dc337c80   edi: dc9218d5   ebp: dc06e600   esp: dc31de4c
Jun 18 16:49:23 canoe kernel: ds: 0018   es: 0018   ss: 0018
Jun 18 16:49:23 canoe kernel: Process ls (pid: 1151, stackpage=dc31d000)
Jun 18 16:49:23 canoe kernel: Stack: dff83800 dc06e665 c0152721 dff83800 000011bb dc921880 ffffffea
00000000 
Jun 18 16:49:23 canoe kernel:        dc62f400 c0145569 c1787100 000001f0 dc06e600 fffffff4 dc660580
dc62f400 
Jun 18 16:49:23 canoe kernel:        c013cc33 dc660580 dc06e600 dc31df64 00000000 dc660580 dc31df9c
c013d3ec 
Jun 18 16:49:23 canoe kernel: Call Trace: [proc_lookup+161/176] [d_alloc+25/368]
[real_lookup+163/208] [link_path_walk+1708/2000] [filldir64+239/352] 
Jun 18 16:49:23 canoe kernel: Call Trace: [<c0152721>] [<c0145569>] [<c013cc33>] [<c013d3ec>]
[<c014132f>] 
Jun 18 16:49:23 canoe kernel:    [do_page_fault+764/1239] [getname+109/176] [__user_walk+58/80]
[sys_lstat64+20/112] [error_code+52/60] [system_call+51/56] 
Jun 18 16:49:23 canoe kernel:    [<c011431c>] [<c013c90d>] [<c013d8ca>] [<c013a804>] [<c010705c>]
[<c0106f6b>] 
Jun 18 16:49:23 canoe kernel: 
Jun 18 16:49:23 canoe kernel: Code: ff 40 10 8b 43 24 83 48 14 18 8b 43 18 85 c0 74 06 89 86 88
------------------------------------

-- 
Luben

[-- Attachment #2: scsi_reg.tar.gz --]
[-- Type: application/x-gzip, Size: 1480 bytes --]

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

* Re: Fwd: Patch - SCSI host numbers - please apply
  2002-06-18 21:18     ` Fwd: Patch - SCSI host numbers - please apply Luben Tuikov
@ 2002-06-19  0:03       ` Itai Nahshon
  2002-06-19 16:26         ` Luben Tuikov
  0 siblings, 1 reply; 5+ messages in thread
From: Itai Nahshon @ 2002-06-19  0:03 UTC (permalink / raw)
  To: Luben Tuikov, Marcelo Tosatti, linux-scsi

On Wednesday 19 June 2002 00:18 am, Luben Tuikov wrote:
> Itai,
>
>
> After applying your patch to 2.4.18, I see the following
> problems:

Well, I just tried that with 2.4.18-pre10 + my patch and I do not
see any of the problems that you described. I suspect there
is something wrong with your configuration or with the
way that you run your tests.

I first loaded ide-scsi (which got host_no 0) and then
the object that I got from compiling yout code with
MaxHosts=30 (and it got host_nos 1 .. 30).
Removng the modules worked OK too. The hosts were
unregistered and off course, no oops.
Then reloaded scsi_reg.o with MaxHosts=100. Again no
problem.

My configuration:
RedHat 7.2, non-SMP. All the updates from RedHat applied +KDE-3.0.
Relevant RPMS:
	gcc-2.96-98
	cpp-2.96-98
	binutils-2.11.90.0.8-11
	modutils-2.4.13-0.7.1

The kernel source tree is symbolic linked to /usr/src/linux .
Your code extracted to /usr/src/scsi_reg/ .


-- Itai


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

* Re: Fwd: Patch - SCSI host numbers - please apply
  2002-06-19  0:03       ` Itai Nahshon
@ 2002-06-19 16:26         ` Luben Tuikov
  0 siblings, 0 replies; 5+ messages in thread
From: Luben Tuikov @ 2002-06-19 16:26 UTC (permalink / raw)
  To: nahshon; +Cc: Marcelo Tosatti, linux-scsi

Itai Nahshon wrote:

> I suspect there
> is something wrong with your configuration or with the
> way that you run your tests.

What could be wrong with my configuration? Anything specific
that you have in mind?

What do you mean ``they way you run your tests''?
Could you please elaborate...

The second time you loaded the module did you get
1 to 100 or 31 to 131?
 
> My configuration:
> RedHat 7.2, non-SMP. All the updates from RedHat applied +KDE-3.0.
> Relevant RPMS:
>         gcc-2.96-98
>         cpp-2.96-98
>         binutils-2.11.90.0.8-11
>         modutils-2.4.13-0.7.1

My configuration is as follows (RH7.1):
- kernel: 2.4.18
- gcc 3.0.4 
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/specs
Configured with: ../gcc-3.0.4/configure --host=i686-pc-linux-gnu --with-gnu-as --with-gnu-ld
--disable-win32-registry --enable-threads=posix
Thread model: posix
gcc version 3.0.4
- GNU ld version 2.10.91 (with BFD 2.10.91.0.2)
- modinfo (Linux modutils) 2.4.2

This is very strange, maybe we should get someone else to
independently test this? (scsi_reg.o with and without your patch
on a 2.4.18.)

Anyone?

-- 
Luben

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

end of thread, other threads:[~2002-06-19 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200206171604.57115.nahshon@actcom.co.il>
     [not found] ` <3D0E4F4F.1D3D68B3@splentec.com>
     [not found]   ` <200206181514.52827.nahshon@actcom.co.il>
2002-06-18 21:18     ` Fwd: Patch - SCSI host numbers - please apply Luben Tuikov
2002-06-19  0:03       ` Itai Nahshon
2002-06-19 16:26         ` Luben Tuikov
2002-06-06 10:23 Itai Nahshon
2002-06-12 21:59 ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.