A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

March 19, 2015

3.10.0-123.el7.x86 64 - System hangs during rmmod

SYSTEM: Linux version 3.10.0-123.el7.x86_64.debug-PC

Overview: Our driver supports configuration, management, and user level access to/from up to 6 32bit pci-comunications cards. We have made the necessary changes to our originally 2.6.X based kernel module to allow it to be loaded(insmod) and perform properly under 3.10.0-123.el7.

Problem: The 3.10.0-123.el7 system hangs when we attempt to remove the driver(rmmod).
I've included our "module_exit" (included below) with embedded printk's. When "rmmod iphwae" is executed the following output is seen, then the system hangs:

Mar 19 14:16:19 lab-247 kernel:
iphwae: Entering iph_module_cleanup...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Entering pci_unregister_driver()...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Exiting pci_unregister_driver()...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Entering unregister_chrdev()...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Exiting unregister_chrdev()...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Entering remove_proc_entry()...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Exiting remove_proc_entry()...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Entering cleanup trace buffer and MUTEX...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Exiting cleanup trace buffer and MUTEX...
Mar 19 14:16:19 lab-247 kernel:
iphwae: Exiting iph_module_cleanup()...

The printk's show that the kernal modules exit routine is completed successfully...


Any help with this problem would be GREATLY APPRECIATED


static void iph_module_cleanup(void)
{
int iError = 0;
void *pTraceHead;

printk("\niphwae: Entering iph_module_cleanup...\n");//(DAW)
msleep(5);//(DAW)

printk("\niphwae: Entering pci_unregister_driver()...\n");//(DAW)
msleep(5);//(DAW)
/* Deregister the driver from the pci module list */
pci_unregister_driver(&gIphwanDriver);
printk("\niphwae: Exiting pci_unregister_driver()...\n");//(DAW)
msleep(5);//(DAW)

/* Remove entry points and characteristics from the char module list */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
iError = unregister_chrdev(giMajor, DRIVER_NAME);
#else
printk("\niphwae: Entering unregister_chrdev()...\n");//(DAW)
msleep(5);//(DAW)
unregister_chrdev(giMajor, DRIVER_NAME);
printk("\niphwae: Exiting unregister_chrdev()...\n");//(DAW)
msleep(5);//(DAW)
#endif

printk("\niphwae: Entering remove_proc_entry()...\n");//(DAW)
msleep(5);//(DAW)
/* remove the /proc/iphxxx file */
remove_proc_entry(DRIVER_NAME, 0);
printk("\niphwae: Exiting remove_proc_entry()...\n");//(DAW)
msleep(5);//(DAW)

if (iError == 0)
{
printk("\niphwae: Entering cleanup trace buffer and MUTEX...\n");//(DAW)
msleep(5);//(DAW)
/* if the trace are active, we must destroy the mutex and release */
/* the trace buffer */
if (iph_gpucTrace != (byte *)0)
{
MUTEX_DESTROY(&iph_gTraceMutex);
pTraceHead = (void *)iph_gpucTrace;
iph_gpucTrace = NULL;
TMP_FREE(pTraceHead);
}
printk("\niphwae: Exiting cleanup trace buffer and MUTEX...\n");//(DAW)
msleep(5);//(DAW)
}
else
{
printk("\niphwae: failed to unregister the char device...\n");//(DAW)
msleep(5);//(DAW)
iph_TRACEK(TRCLVL_0, "[cleanup_module]: failed to unregister the char device");
}
printk("\niphwae: Exiting iph_module_cleanup()...\n");//(DAW)
msleep(5);//(DAW)
}

/*
* These two macros below are used to declare the two entry point of
* the driver. All loadable module must use theirs.
*/
module_init(iph_module_init);
module_exit(iph_module_cleanup);

Click Here!