* [PATCH] fix rmmod sbp2 hang in 2.6.7
@ 2004-07-14 3:48 Hugang
2004-07-14 8:13 ` Hugang
0 siblings, 1 reply; 8+ messages in thread
From: Hugang @ 2004-07-14 3:48 UTC (permalink / raw)
To: linux-kernel, bcollins
Hi:
http://sourceforge.net/mailarchive/forum.php?thread_id=5036991&forum_id=5389
* modified files
--- orig/drivers/base/driver.c
+++ mod/drivers/base/driver.c
@@ -106,8 +106,8 @@
void driver_unregister(struct device_driver * drv)
{
- bus_remove_driver(drv);
down(&drv->unload_sem);
+ bus_remove_driver(drv);
up(&drv->unload_sem);
}
---
Hu Gang / Steve
Linux Registered User 204016
GPG Public Key: http://soulinfo.com/~hugang/hugang.asc
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 3:48 [PATCH] fix rmmod sbp2 hang in 2.6.7 Hugang @ 2004-07-14 8:13 ` Hugang 2004-07-14 9:11 ` Hugang 0 siblings, 1 reply; 8+ messages in thread From: Hugang @ 2004-07-14 8:13 UTC (permalink / raw) Cc: linux-kernel, bcollins On Wed, 14 Jul 2004 11:48:54 +0800 Hugang <hugang@soulinfo.com> wrote: | Hi: | | http://sourceforge.net/mailarchive/forum.php?thread_id=5036991&forum_id=5389 | | * modified files | | --- orig/drivers/base/driver.c | +++ mod/drivers/base/driver.c | @@ -106,8 +106,8 @@ | | void driver_unregister(struct device_driver * drv) | { | - bus_remove_driver(drv); | down(&drv->unload_sem); | + bus_remove_driver(drv); | up(&drv->unload_sem); | } | Sorry, the above patch, can't fix rmmod sbp2 complete,I still got hang when rmmod sbp2 in my PowerBook G4 sometimes. -- Hu Gang / Steve Linux Registered User 204016 GPG Public Key: http://soulinfo.com/~hugang/hugang.asc ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 8:13 ` Hugang @ 2004-07-14 9:11 ` Hugang 2004-07-14 9:24 ` Russell King 0 siblings, 1 reply; 8+ messages in thread From: Hugang @ 2004-07-14 9:11 UTC (permalink / raw) Cc: linux-kernel, bcollins On Wed, 14 Jul 2004 16:13:57 +0800 Hugang <hugang@soulinfo.com> wrote: | On Wed, 14 Jul 2004 11:48:54 +0800 | Hugang <hugang@soulinfo.com> wrote: | .... | Sorry, the above patch, can't fix rmmod sbp2 complete,I still got hang when | rmmod sbp2 in my PowerBook G4 sometimes. | This new patch can complete fix the bug. That's really hack. Any comment are welcome. --- orig/drivers/base/driver.c +++ mod/drivers/base/driver.c @@ -107,8 +107,8 @@ void driver_unregister(struct device_driver * drv) { bus_remove_driver(drv); - down(&drv->unload_sem); - up(&drv->unload_sem); + //down(&drv->unload_sem); + //up(&drv->unload_sem); } -- Hu Gang / Steve Linux Registered User 204016 GPG Public Key: http://soulinfo.com/~hugang/hugang.asc ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 9:11 ` Hugang @ 2004-07-14 9:24 ` Russell King 2004-07-14 9:29 ` Hugang 2004-07-14 11:33 ` Ben Collins 0 siblings, 2 replies; 8+ messages in thread From: Russell King @ 2004-07-14 9:24 UTC (permalink / raw) To: Hugang; +Cc: linux-kernel, bcollins On Wed, Jul 14, 2004 at 05:11:07PM +0800, Hugang wrote: > On Wed, 14 Jul 2004 16:13:57 +0800 > Hugang <hugang@soulinfo.com> wrote: > | On Wed, 14 Jul 2004 11:48:54 +0800 > | Hugang <hugang@soulinfo.com> wrote: > | > .... > | Sorry, the above patch, can't fix rmmod sbp2 complete,I still got hang when > | rmmod sbp2 in my PowerBook G4 sometimes. > | > > This new patch can complete fix the bug. That's really hack. Any comment are > welcome. This down+up prevents drivers from being unloaded until there are no references to their struct device_driver. By removing this, you open the very real possibility for an oops to occur. If you're waiting inside that function for the last reference to be dropped, the real question is why you still have references to it. -- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 9:24 ` Russell King @ 2004-07-14 9:29 ` Hugang 2004-07-14 10:20 ` Russell King 2004-07-14 11:33 ` Ben Collins 1 sibling, 1 reply; 8+ messages in thread From: Hugang @ 2004-07-14 9:29 UTC (permalink / raw) To: Russell King; +Cc: linux-kernel, bcollins On Wed, 14 Jul 2004 10:24:17 +0100 Russell King <rmk+lkml@arm.linux.org.uk> wrote: | This down+up prevents drivers from being unloaded until there are no | references to their struct device_driver. By removing this, you open | the very real possibility for an oops to occur. Yes, I agree with you. When sbp2 is using the module count is not zero, so I can rmmod it, So I think, for sbp2 that's safe, That's true on my laptop. | | If you're waiting inside that function for the last reference to be | dropped, the real question is why you still have references to it. There are tree places that reference ->unload_sem in linux kernel tree, but I don't known, why the same code in 2.6.4 can works fine. :) bus.c:68: up(&drv->unload_sem); driver.c:110: down(&drv->unload_sem); driver.c:111: up(&drv->unload_sem); -- Hu Gang / Steve Linux Registered User 204016 GPG Public Key: http://soulinfo.com/~hugang/hugang.asc ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 9:29 ` Hugang @ 2004-07-14 10:20 ` Russell King 0 siblings, 0 replies; 8+ messages in thread From: Russell King @ 2004-07-14 10:20 UTC (permalink / raw) To: Hugang; +Cc: linux-kernel, bcollins On Wed, Jul 14, 2004 at 05:29:57PM +0800, Hugang wrote: > On Wed, 14 Jul 2004 10:24:17 +0100 > Russell King <rmk+lkml@arm.linux.org.uk> wrote: > | This down+up prevents drivers from being unloaded until there are no > | references to their struct device_driver. By removing this, you open > | the very real possibility for an oops to occur. > Yes, I agree with you. When sbp2 is using the module count is not zero, > so I can rmmod it, So I think, for sbp2 that's safe, That's true on my > laptop. The module count does not cover all cases, especially the case which this semaphore protects against. -- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 9:24 ` Russell King 2004-07-14 9:29 ` Hugang @ 2004-07-14 11:33 ` Ben Collins 2004-07-17 18:43 ` Tim Wright 1 sibling, 1 reply; 8+ messages in thread From: Ben Collins @ 2004-07-14 11:33 UTC (permalink / raw) To: Hugang, linux-kernel On Wed, Jul 14, 2004 at 10:24:17AM +0100, Russell King wrote: > On Wed, Jul 14, 2004 at 05:11:07PM +0800, Hugang wrote: > > On Wed, 14 Jul 2004 16:13:57 +0800 > > Hugang <hugang@soulinfo.com> wrote: > > | On Wed, 14 Jul 2004 11:48:54 +0800 > > | Hugang <hugang@soulinfo.com> wrote: > > | > > .... > > | Sorry, the above patch, can't fix rmmod sbp2 complete,I still got hang when > > | rmmod sbp2 in my PowerBook G4 sometimes. > > | > > > > This new patch can complete fix the bug. That's really hack. Any comment are > > welcome. > > This down+up prevents drivers from being unloaded until there are no > references to their struct device_driver. By removing this, you open > the very real possibility for an oops to occur. > > If you're waiting inside that function for the last reference to be > dropped, the real question is why you still have references to it. Seems like every 2 months or so I have to revisit the sbp2 module to see where the scsi layer has changed (or the driver model) so that I can get all the reference counting to equal out properly. Guess it's been two months again :) -- Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ WatchGuard - http://www.watchguard.com/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fix rmmod sbp2 hang in 2.6.7 2004-07-14 11:33 ` Ben Collins @ 2004-07-17 18:43 ` Tim Wright 0 siblings, 0 replies; 8+ messages in thread From: Tim Wright @ 2004-07-17 18:43 UTC (permalink / raw) To: Ben Collins; +Cc: Hugang, linux-kernel Here's a wild guess. Is the 'sg' driver loaded. This sounds similar to my complaint with trying to rmmod 'st'. When I load my SCSI HBA driver, it automagically pulls in st for my tape drive *and* sg. Now, if you try to remove it, it "hangs". It's because sg also got a reference. If you rmmod 'sg' then the rmmod of st frees up too. The problem above is that st has module use count of 0, but that's a lie. sg has glommed on that device, and the true reference count is actually one (if you consider that st owns the tape device). It seems to me that what should happen is for the SCSI layer/drivers to handle kicking sg out when they want to unload. If the consensus is that this is desirable, I'm happy to go off and see what needs to be done. Otherwise, I'll crawl back into my hole :-) Tim On Wed, 2004-07-14 at 04:33, Ben Collins wrote: > On Wed, Jul 14, 2004 at 10:24:17AM +0100, Russell King wrote: > > On Wed, Jul 14, 2004 at 05:11:07PM +0800, Hugang wrote: > > > On Wed, 14 Jul 2004 16:13:57 +0800 > > > Hugang <hugang@soulinfo.com> wrote: > > > | On Wed, 14 Jul 2004 11:48:54 +0800 > > > | Hugang <hugang@soulinfo.com> wrote: > > > | > > > .... > > > | Sorry, the above patch, can't fix rmmod sbp2 complete,I still got hang when > > > | rmmod sbp2 in my PowerBook G4 sometimes. > > > | > > > > > > This new patch can complete fix the bug. That's really hack. Any comment are > > > welcome. > > > > This down+up prevents drivers from being unloaded until there are no > > references to their struct device_driver. By removing this, you open > > the very real possibility for an oops to occur. > > > > If you're waiting inside that function for the last reference to be > > dropped, the real question is why you still have references to it. > > Seems like every 2 months or so I have to revisit the sbp2 module to see > where the scsi layer has changed (or the driver model) so that I can get > all the reference counting to equal out properly. Guess it's been two > months again :) -- Tim Wright <timw@splhi.com> Splhi ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-07-17 18:44 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-07-14 3:48 [PATCH] fix rmmod sbp2 hang in 2.6.7 Hugang 2004-07-14 8:13 ` Hugang 2004-07-14 9:11 ` Hugang 2004-07-14 9:24 ` Russell King 2004-07-14 9:29 ` Hugang 2004-07-14 10:20 ` Russell King 2004-07-14 11:33 ` Ben Collins 2004-07-17 18:43 ` Tim Wright
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox