Skip to contentSkip to conversation

2.5.75 - ppa unload PATCH and remaining problem

PATCH Andrew Morton 3 participants 9 messages Jul 13, 2003 – Jul 15, 2003 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Could someone (Mike?) please take a look at the ppa driver, see what it's doing wrong?

Thanks.

Begin forwarded message:

Date: Sun, 13 Jul 2003 18:47:39 +0400
From: Andrey Borzenkov <[email protected]>
To: [email protected]
Subject: 2.5.75 - ppa unload PATCH and remaining problem

rmmod ppa does not remove any attached device nodes and gives:

ppa: Version 2.07 (for Linux 2.4.x)
ppa: Found device at ID 4, Attempting to use EPP 32 bit
ppa: Found device at ID 4, Attempting to use PS/2
ppa: Communication established with ID 4 using PS/2 scsi0 : Iomega VPI0 (ppa) interface
Vendor: iomega Model: jaz 2GB Rev: E.17
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 4, lun 0 Attached scsi generic sg0 at scsi0, channel 0, id 4, lun 0, type 0
sda: Spinning up disk....ready
SCSI device sda: 2091050 512-byte hdwr sectors (1071 MB)
sda: Write Protect is off
sda: Mode Sense: 39 00 10 08
SCSI device sda: drive cache: write through
SCSI device sda: 2091050 512-byte hdwr sectors (1071 MB)
sda: Write Protect is off
sda: Mode Sense: 39 00 10 08
SCSI device sda: drive cache: write through
/dev/scsi/host0/bus0/target4/lun0: p4
Releasing ppa0
Iomega VPI0 (ppa) interface did not call scsi_unregister

Call Trace:
 [<d2d2fcf6>] exit_this_scsi_driver+0xb6/0xfa [ppa]
 [<c013f0ad>] sys_delete_module+0x11d/0x150
 [<c015787b>] do_munmap+0x13b/0x1a0
 [<c0157923>] sys_munmap+0x43/0x70
 [<c011d920>] do_page_fault+0x0/0x4b8
 [<c010b527>] syscall_call+0x7/0xb

adding scsi_unregister to ppa_release does remove all devices and sysfs node for ppa but leaves /dev/scsi/host0/bus0/target4 in place and does not remove /proc entries; loading ppa again creates second host with /proc/scsi looking funny:

{pts/3}% LC_ALL=C ls -l /proc/scsi
total 0

-r--r--r--    1 root     root            0 Jul 13 18:42 device_info
dr-xr-xr-x    2 root     root            0 Jul 13 18:42 ppa/
dr-xr-xr-x    2 root     root            0 Jul 13 18:42 ppa/
-r--r--r--    1 root     root            0 Jul 13 18:42 scsi
dr-xr-xr-x    2 root     root            0 Jul 13 18:42 sg/

attempt to access /proc/scsi after ppa has been unloaded (with my patch or without) even after the first time gives:

pts/3}% LC_ALL=C ls -lR /proc/scsi
zsh: segmentation fault LC_ALL=C ls -F --color=auto -lR /proc/scsi

dmesg ->

Unable to handle kernel paging request at virtual address d2d42320
 printing eip:
c0199360
*pde = 09fa3067
*pte = 00000000
Oops: 0000 [#1]
CPU:    0
EIP:    0060:[<c0199360>]    Tainted: P
EFLAGS: 00010202

EIP is at proc_get_inode+0xb0/0x1a0
eax: 00000000 ebx: c5a3e014 ecx: 00000002 edx: d2d42320
esi: c2f4a4fc edi: 00000001 ebp: c77afe30 esp: c77afe24
ds: 007b es: 007b ss: 0068
Process ls (pid: 2893, threadinfo=c77ae000 task=c76c9000)

Stack: 00000003 c5ab708b c2f4a54b c77afe5c c019cb29 cff93004 000011e7 c2f4a4fc
       c2f4a4fc ffffffea 00000000 fffffff4 cea33084 cea33014 c77afe80 c0173a25
       cea33014 c5ab7004 c77aff30 c5ab7004 c77afef4 c77aff30 cffb08e4 c77afea0
Call Trace:
 [<c019cb29>] proc_lookup+0x169/0x190
 [<c0173a25>] real_lookup+0xb5/0xe0
 [<c0173ebd>] do_lookup+0x6d/0x80
 [<c01744a7>] link_path_walk+0x5d7/0xb30
 [<c014c129>] kmem_cache_alloc+0x99/0x1a0
 [<c0174f92>] __user_walk+0x32/0x50
 [<c016f127>] vfs_lstat+0x17/0x50
 [<c016f724>] sys_lstat64+0x14/0x30
 [<c01796f4>] sys_getdents64+0x74/0xb2
 [<c017972d>] sys_getdents64+0xad/0xb2
 [<c010b527>] syscall_call+0x7/0xb

Code: 83 3a 02 0f 84 aa 00 00 00 c1 e0 05 8d 04 10 f0 ff 80 a0 00
 <6>note: ls[2893] exited with preempt_count 2
Debug: sleeping function called from illegal context at 
include/asm/semaphore.h:119
Call Trace:
 [<c0122bb8>] __might_sleep+0x58/0x70
 [<c01560bb>] remove_shared_vm_struct+0x2b/0x90
 [<c0157cfa>] exit_mmap+0x19a/0x250
 [<c012375c>] mmput+0x8c/0x100
 [<c012868c>] do_exit+0x19c/0x690
 [<c010cbf7>] die+0x137/0x140
 [<c011da6a>] do_page_fault+0x14a/0x4b8
 [<c014c1bb>] kmem_cache_alloc+0x12b/0x1a0
 [<c0199107>] proc_alloc_inode+0x17/0x70
 [<c0199136>] proc_alloc_inode+0x46/0x70
 [<c011d920>] do_page_fault+0x0/0x4b8
 [<c010c54d>] error_code+0x2d/0x40
 [<c018007b>] d_delete+0x15b/0x270
 [<c0199360>] proc_get_inode+0xb0/0x1a0
 [<c019cb29>] proc_lookup+0x169/0x190
 [<c0173a25>] real_lookup+0xb5/0xe0
 [<c0173ebd>] do_lookup+0x6d/0x80
 [<c01744a7>] link_path_walk+0x5d7/0xb30
 [<c014c129>] kmem_cache_alloc+0x99/0x1a0
 [<c0174f92>] __user_walk+0x32/0x50
 [<c016f127>] vfs_lstat+0x17/0x50
 [<c016f724>] sys_lstat64+0x14/0x30
 [<c01796f4>] sys_getdents64+0x74/0xb2
 [<c017972d>] sys_getdents64+0xad/0xb2
 [<c010b527>] syscall_call+0x7/0xb

Any pointers appreciated. It is tainted by nVidia if question arises.

TIA

-andrey

drivers/scsi/ppa.c renamed from drivers/scsi/ppa.c.scsi_unregister +1 -0
@@ -76,6 +76,7 @@ int ppa_release(struct Scsi_Host *host)
     int host_no = host->unique_id;
 
     printk("Releasing ppa%i\n", host_no);
+    scsi_unregister(host);
     parport_unregister_device(ppa_hosts[host_no].dev);
     return 0;
 }
#1 lore raw
Quoted 5 lines · Andrew Morton

sda: Mode Sense: 39 00 10 08
SCSI device sda: drive cache: write through
/dev/scsi/host0/bus0/target4/lun0: p4
Releasing ppa0
Iomega VPI0 (ppa) interface did not call scsi_unregister

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Andrew Morton

sda: Mode Sense: 39 00 10 08
SCSI device sda: drive cache: write through
/dev/scsi/host0/bus0/target4/lun0: p4
Releasing ppa0
Iomega VPI0 (ppa) interface did not call scsi_unregister

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Look at Andrey's report. His patch adds the scsi_unregister() call.

Then the thing oopses.

#3 lore raw

I believe this problem is related to /proc/scsi cleanup issues previously discussed by Alan Stern.

I refreshed Alan's patch and added my host present bit cleanups to the last series of patches sent to the list.

I do not have a ppa device, but on 2.5.75 I saw a similar error signature of the proc not getting cleaned up when I use the aic7xxx_old which uses the legacy registration interfaces also. When I switched to my patched view the aic7xxx_old cleans up ok. I have other sysfs cleanups in this patched tree, but I do not believe they are effecting the legacy proc cleanups.

-andmike
--
Michael Anderson
[email protected]

#4 lore raw
Quoted 7 lines · Mike Anderson

I believe this problem is related to /proc/scsi cleanup issues previously discussed by Alan Stern.

I refreshed Alan's patch and added my host present bit cleanups to the last series of patches sent to the list.

Quoted 6 lines

I do not have a ppa device, but on 2.5.75 I saw a similar error signature of the proc not getting cleaned up when I use the aic7xxx_old which uses the legacy registration interfaces also. When I switched to my patched view the aic7xxx_old cleans up ok. I have other sysfs cleanups in this patched tree, but I do not believe they are effecting the legacy proc cleanups.

OK, thanks.

Where could we get the relevant diffs from for testers?

#5 lore raw

I refreshed the patch against 2.6.0-test1 and I am testing it now. I should have it to Andrey within the hour.

Quoted 15 lines · Andrew Morton [[email protected]] wrote:
Quoted 7 lines · Mike Anderson

I believe this problem is related to /proc/scsi cleanup issues previously discussed by Alan Stern.

I refreshed Alan's patch and added my host present bit cleanups to the last series of patches sent to the list.

Quoted 6 lines

I do not have a ppa device, but on 2.5.75 I saw a similar error signature of the proc not getting cleaned up when I use the aic7xxx_old which uses the legacy registration interfaces also. When I switched to my patched view the aic7xxx_old cleans up ok. I have other sysfs cleanups in this patched tree, but I do not believe they are effecting the legacy proc cleanups.

Quoted 7 lines

OK, thanks.

Where could we get the relevant diffs from for testers?
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-andmike
--
Michael Anderson
[email protected]

#6 lore raw
In reply to Andrew Morton

Here is the patch rediffed against 2.6.0-test1. I also joined Alan Stern's patch and my reduction of scsi_host present users as this is the way I have been testing it.

This patch also applies to scsi-misc-2.5 with 2 offset warnings.

-andmike
--
Michael Anderson
[email protected]

DESC
This is a refresh of a patch by Alan Stern to correct the removal of scsi procfs host enteries

http://marc.theaimsgroup.com/?l=linux-scsi&m=105545175600506&w=2

This patch also contains a join of another patch that reduces the users of scsi_host present.

EDESC

 drivers/scsi/NCR53c406a.c    |    5 ++--
 drivers/scsi/aacraid/linit.c |    1 
 drivers/scsi/hosts.c         |    4 +--
 drivers/scsi/scsi_module.c   |    2 -
 drivers/scsi/scsi_priv.h     |    4 +++
 drivers/scsi/scsi_proc.c     |   49 ++++++++++++++++++++++++++++---------------
 6 files changed, 42 insertions(+), 23 deletions(-)
drivers/scsi/hosts.c renamed from drivers/scsi/hosts.c~stern_present +2 -2
diff -puN drivers/scsi/hosts.c~stern_present drivers/scsi/hosts.c
@@ -112,7 +112,7 @@ void scsi_free_shost(struct Scsi_Host *s
 		shost->eh_notify = NULL;
 	}
 
-	shost->hostt->present--;
+	scsi_proc_hostdir_rm(shost->hostt);
 	scsi_destroy_command_freelist(shost);
 	kfree(shost);
 }
@@ -219,7 +219,7 @@ struct Scsi_Host *scsi_host_alloc(struct
 	kernel_thread((int (*)(void *))scsi_error_handler, shost, 0);
 	wait_for_completion(&complete);
 	shost->eh_notify = NULL;
-	shost->hostt->present++;
+	scsi_proc_hostdir_add(shost->hostt);
 	return shost;
  fail:
 	kfree(shost);
drivers/scsi/scsi_priv.h renamed from drivers/scsi/scsi_priv.h~stern_present +4 -0
diff -puN drivers/scsi/scsi_priv.h~stern_present drivers/scsi/scsi_priv.h
@@ -90,11 +90,15 @@ extern void scsi_exit_queue(void);
 
 /* scsi_proc.c */
 #ifdef CONFIG_PROC_FS
+extern void scsi_proc_hostdir_add(struct scsi_host_template *);
+extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
 extern void scsi_proc_host_add(struct Scsi_Host *);
 extern void scsi_proc_host_rm(struct Scsi_Host *);
 extern int scsi_init_procfs(void);
 extern void scsi_exit_procfs(void);
 #else
+# define scsi_proc_hostdir_add(sht)	do { } while (0)
+# define scsi_proc_hostdir_rm(sht)	do { } while (0)
 # define scsi_proc_host_add(shost)	do { } while (0)
 # define scsi_proc_host_rm(shost)	do { } while (0)
 # define scsi_init_procfs()		(0)
drivers/scsi/scsi_proc.c renamed from drivers/scsi/scsi_proc.c~stern_present +32 -17

80 lines not on this page · raw message

drivers/scsi/aacraid/linit.c renamed from drivers/scsi/aacraid/linit.c~stern_present +0 -1
diff -puN drivers/scsi/aacraid/linit.c~stern_present drivers/scsi/aacraid/linit.c
@@ -295,7 +295,6 @@ static int aac_detect(Scsi_Host_Template
 			printk(KERN_WARNING "aacraid: unable to register \"aac\" device.\n");
 	}
 
-	template->present = aac_count; /* # of cards of this type found */
 	return aac_count;
 }
 
drivers/scsi/NCR53c406a.c renamed from drivers/scsi/NCR53c406a.c~stern_present +3 -2
diff -puN drivers/scsi/NCR53c406a.c~stern_present drivers/scsi/NCR53c406a.c
@@ -450,6 +450,7 @@ static __inline__ int NCR53c406a_pio_wri
 
 static int __init NCR53c406a_detect(Scsi_Host_Template * tpnt)
 {
+	int present = 0;
 	struct Scsi_Host *shpnt = NULL;
 #ifndef PORT_BASE
 	int i;
@@ -522,7 +523,7 @@ static int __init NCR53c406a_detect(Scsi
 
 	DEB(printk("NCR53c406a: using port_base 0x%x\n", port_base));
 
-	tpnt->present = 1;
+	present = 1;
 	tpnt->proc_name = "NCR53c406a";
 
 	shpnt = scsi_register(tpnt, 0);
@@ -576,7 +577,7 @@ static int __init NCR53c406a_detect(Scsi
 	sprintf(info_msg, "NCR53c406a at 0x%x, IRQ %d, %s PIO mode.", port_base, irq_level, fast_pio ? "fast" : "slow");
 #endif
 
-	return (tpnt->present);
+	return (present);
 
 #if USE_DMA
       err_free_irq:
drivers/scsi/scsi_module.c renamed from drivers/scsi/scsi_module.c~stern_present +1 -1
diff -puN drivers/scsi/scsi_module.c~stern_present drivers/scsi/scsi_module.c
@@ -33,7 +33,7 @@ static int __init init_this_scsi_driver(
 	INIT_LIST_HEAD(&sht->legacy_hosts);
 
 	sht->detect(sht);
-	if (!sht->present)
+	if (list_empty(&sht->legacy_hosts))
 		return -ENODEV;
 
 	list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list) {

_

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 4 lines · Andrey Borzenkov

Well, the reason is simple and is fixed in patch sent two days ago to lkml - fs/partitions/check.c:register_disk does not add .../disc if media capacity == 0 - i.e. no media present.

Please resend a tested, documented patch for that.

Things are slow at present - Linus is away, the big conference is next week, etc. So please be patient, keep working this and keep hassling folks over it, OK?

#9 lore raw
In reply to a message not in the archive
Quoted 16 lines · Andrey Borzenkov [[email protected]] wrote:

There are still remaining problems. Sorry if they are already known.

1. Removing USB memory stick without unmounting file system first results in dead system. It crashes in several seconds with stack (sorry, had to write down manually)

sync_sb_inodes+0x97/0x2f0
writeback_inodes
wb_kupdate
__pdflush
schedule_tail
pdflush_+0x00/0x20
pdflush_0xf/0x20
wb_kupdate
kernel_thread_helper

Quoted 6 lines

Only Alt-Sysrq-B works after that.

2.0.0-test1 + this patch + my ppa patch

This is currently showstopper for me :(

I previously posted a patch to linux-scsi for scsi host and scsi device ref count cleanups. The thread is available here:
http://marc.theaimsgroup.com/?t=105770318200001&r=1&w=2

I have updated the patch with comments, but still want to finish a change to scsi_free_sdev and do some testing before I send it out again.

I do not run devfs currently so I have not seen the issue related to devfs.

-andmike
--
Michael Anderson
[email protected]