Hi folks,

Here's a new spin of the patch to fix the problem of the ipath module causing errors if no ipath hardware is present. This new version of the patch should fix the potential problem Roland spotted if the kernel is doing multithreaded probes.

Roland: please review and queue for 2.6.19 if you're satisfied with this approach. I still don't have an answer about why modprobe hangs when this patch isn't applied - I'll get to that in the next day or so when I have a moment.

Michael: please consider replacing the last patch we sent to OFED for this with this new version. I suspect that, once again, you will be required to modify the patch to get it to apply cleanly. I'd like to avoid having you do this, but I don't have a clear idea how to get hold of the OFED-next-release-in-progress stuff. Bryan handled this previously, but he's on vacation for the next several weeks. Do you have some instructions written down somewhere you could point me at on how to submit patches that would make your life a little easier in this regard?

Regards,
 Robert.
IB/ipath - initialize diagpkt file on device init only

Don't attempt to set up the diagpkt device in the module init code.
Instead, wait until a piece of hardware is initted.  Fixes a problem
when loading the ib_ipath module when no InfiniPath hardware is present:
modprobe would go into the D state and stay there.

Signed-off-by: Robert Walsh <[EMAIL PROTECTED]>

diff -r d168d78758ca drivers/infiniband/hw/ipath/ipath_diag.c
--- a/drivers/infiniband/hw/ipath/ipath_diag.c  Tue Oct 03 15:01:29 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c  Tue Oct 03 15:04:44 2006 -0700
@@ -286,17 +286,20 @@ static struct file_operations diagpkt_fi
 
 static struct cdev *diagpkt_cdev;
 static struct class_device *diagpkt_class_dev;
-
-int __init ipath_diagpkt_add(void)
-{
-       return ipath_cdev_init(IPATH_DIAGPKT_MINOR,
-                              "ipath_diagpkt", &diagpkt_file_ops,
-                              &diagpkt_cdev, &diagpkt_class_dev);
-}
-
-void __exit ipath_diagpkt_remove(void)
-{
-       ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev);
+static atomic_t diagpkt_count = ATOMIC_INIT(0);
+
+void ipath_diagpkt_add(void)
+{
+       if (atomic_inc_return(&diagpkt_count) == 1)
+               ipath_cdev_init(IPATH_DIAGPKT_MINOR,
+                               "ipath_diagpkt", &diagpkt_file_ops,
+                               &diagpkt_cdev, &diagpkt_class_dev);
+}
+
+void ipath_diagpkt_remove(void)
+{
+       if (atomic_dec_and_test(&diagpkt_count))
+               ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev);
 }
 
 /**
diff -r d168d78758ca drivers/infiniband/hw/ipath/ipath_driver.c
--- a/drivers/infiniband/hw/ipath/ipath_driver.c        Tue Oct 03 15:01:29 
2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c        Tue Oct 03 15:01:29 
2006 -0700
@@ -559,6 +559,7 @@ static int __devinit ipath_init_one(stru
        ipathfs_add_device(dd);
        ipath_user_add(dd);
        ipath_diag_add(dd);
+       ipath_diagpkt_add();
        ipath_register_ib_device(dd);
 
        /* Check that we have a LID in LID_TIMEOUT seconds. */
@@ -700,6 +701,7 @@ static void __devexit ipath_remove_one(s
        if (dd->verbs_dev)
                ipath_unregister_ib_device(dd->verbs_dev);
 
+       ipath_diagpkt_remove();
        ipath_diag_remove(dd);
        ipath_user_remove(dd);
        ipathfs_remove_device(dd);
@@ -2183,17 +2185,7 @@ static int __init infinipath_init(void)
                goto bail_group;
        }
 
-       ret = ipath_diagpkt_add();
-       if (ret < 0) {
-               printk(KERN_ERR IPATH_DRV_NAME ": Unable to create "
-                      "diag data device: error %d\n", -ret);
-               goto bail_ipathfs;
-       }
- 
        goto bail;
-
-bail_ipathfs:
-       ipath_exit_ipathfs();
 
 bail_group:
        ipath_driver_remove_group(&ipath_driver.driver);
diff -r d168d78758ca drivers/infiniband/hw/ipath/ipath_kernel.h
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h        Tue Oct 03 15:01:29 
2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h        Tue Oct 03 15:01:29 
2006 -0700
@@ -889,7 +889,7 @@ void ipath_device_remove_group(struct de
 void ipath_device_remove_group(struct device *, struct ipath_devdata *);
 int ipath_expose_reset(struct device *);
 
-int ipath_diagpkt_add(void);
+void ipath_diagpkt_add(void);
 void ipath_diagpkt_remove(void);
 
 int ipath_init_ipathfs(void);
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to