10.0-123.el7 system hangs when we attempt to remove kernel module(rmmod)

Posted on

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 changed 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:**
*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 complete successfully...
then

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");//(Test)
   msleep(5);//(Test)

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

   /* 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");//(Test)
   msleep(5);//(Test)
   unregister_chrdev(giMajor, DRIVER_NAME);
   printk("\niphwae: Exiting unregister_chrdev()...\n");//(Test)
   msleep(5);//(Test)
#endif


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

   if (iError == 0)
   {
       printk("\niphwae: Entering cleanup trace buffer and MUTEX...\n");//(Test)
       msleep(5);//(Test)
      /* 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");//(Test)
       msleep(5);//(Test)
   }
   else
   {
       printk("\niphwae: failed to unregister the char device...\n");//(Test)
       msleep(5);//(Test)
      iph_TRACEK(TRCLVL_0, "[cleanup_module]: failed to unregister the char device");
   } 
   printk("\niphwae: Exiting iph_module_cleanup()...\n");//(Test)
   msleep(5);//(Test)
}

/*
 * 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);

Responses