Re: Module Ref Counting & ibmphp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 14 Mar 2006 16:02:12 -0800
Greg KH <[email protected]> wrote:

> On Wed, Mar 15, 2006 at 09:47:00AM +1100, Srihari Vijayaraghavan wrote:
> > Before (in 2.6.16-rc*):
> > $ egrep 'ibmphp' /proc/modules
> > ibmphp 67809 4294967295 - Live 0xf8910000
> >              ^^^^^^^^^^
> > 
> > After [1]:
> > ibmphp 64224 0 - Live 0xf8965000
> >              ^
> > 
> > Of course, now I'm able to successfully unload ibmphp
> > (& subsequently load it too :)) without any
> > observeable problems.
> > 
> > It'd seem, thro struct hotplug_slot_ops, module ref
> > count for ibmphp is taken care of. No?
> 
> No.  I don't think this driver likes to be unloaded due to the
> instability of the hardware if that happens.  So let's just let it not
> be unloaded, and hope that the hardware can die in peace and never get
> put into any new machines...
> 
> thanks,
> 
> greg k-h

The proper way to prevent unloading is just not to have a module exit routine,
rather than causing ref count to be off. The the module subsystem will
mark it as unsafe to unload. Unless it wants to allow unsafe forced unload.
But IMHO either it needs to be safe to unload or not allow it.

--- linux-2.6/drivers/pci/hotplug/ibmphp_core.c.orig	2006-03-14 16:18:14.000000000 -0800
+++ linux-2.6/drivers/pci/hotplug/ibmphp_core.c	2006-03-14 16:19:12.000000000 -0800
@@ -1398,10 +1398,6 @@ static int __init ibmphp_init(void)
 		goto error;
 	}
 
-	/* lock ourselves into memory with a module 
-	 * count of -1 so that no one can unload us. */
-	module_put(THIS_MODULE);
-
 exit:
 	return rc;
 
@@ -1409,14 +1405,4 @@ error:
 	ibmphp_unload();
 	goto exit;
 }
-
-static void __exit ibmphp_exit(void)
-{
-	ibmphp_hpc_stop_poll_thread();
-	debug("after polling\n");
-	ibmphp_unload();
-	debug("done\n");
-}
-
 module_init(ibmphp_init);
-module_exit(ibmphp_exit);




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux