Hi,

this is the patch to fix BUG: 574.
It serializes calls to register_mr() by using a spin_lock.

Regards
Stefan


---

Signed-off-by: Stefan Roscher <[EMAIL PROTECTED]>


 ehca_classes.h |    1 +
 ehca_main.c    |    2 ++
 hcp_if.c       |   16 ++++++++++++----
 3 files changed, 15 insertions(+), 4 deletions(-)


diff -Nurp ofa_kernel-1.2_old/drivers/infiniband/hw/ehca/ehca_classes.h 
ofa_kernel-1.2_fixed/drivers/infiniband/hw/ehca/ehca_classes.h
--- ofa_kernel-1.2_old/drivers/infiniband/hw/ehca/ehca_classes.h        
2007-04-24 14:54:05.000000000 +0200
+++ ofa_kernel-1.2_fixed/drivers/infiniband/hw/ehca/ehca_classes.h      
2007-04-24 14:52:22.000000000 +0200
@@ -272,6 +272,7 @@ void ehca_cleanup_mrmw_cache(void);
 
 extern spinlock_t ehca_qp_idr_lock;
 extern spinlock_t ehca_cq_idr_lock;
+extern spinlock_t hcall_lock;
 extern struct idr ehca_qp_idr;
 extern struct idr ehca_cq_idr;
 
diff -Nurp ofa_kernel-1.2_old/drivers/infiniband/hw/ehca/ehca_main.c 
ofa_kernel-1.2_fixed/drivers/infiniband/hw/ehca/ehca_main.c
--- ofa_kernel-1.2_old/drivers/infiniband/hw/ehca/ehca_main.c   2007-04-24 
14:54:05.000000000 +0200
+++ ofa_kernel-1.2_fixed/drivers/infiniband/hw/ehca/ehca_main.c 2007-04-24 
14:52:32.000000000 +0200
@@ -98,6 +98,7 @@ MODULE_PARM_DESC(scaling_code,
 
 spinlock_t ehca_qp_idr_lock;
 spinlock_t ehca_cq_idr_lock;
+spinlock_t hcall_lock;
 DEFINE_IDR(ehca_qp_idr);
 DEFINE_IDR(ehca_cq_idr);
 
@@ -815,6 +816,7 @@ int __init ehca_module_init(void)
        idr_init(&ehca_cq_idr);
        spin_lock_init(&ehca_qp_idr_lock);
        spin_lock_init(&ehca_cq_idr_lock);
+       spin_lock_init(&hcall_lock);
 
        INIT_LIST_HEAD(&shca_list);
        spin_lock_init(&shca_list_lock);
diff -Nurp ofa_kernel-1.2_old/drivers/infiniband/hw/ehca/hcp_if.c 
ofa_kernel-1.2_fixed/drivers/infiniband/hw/ehca/hcp_if.c
--- ofa_kernel-1.2_old/drivers/infiniband/hw/ehca/hcp_if.c      2007-04-04 
14:07:36.000000000 +0200
+++ ofa_kernel-1.2_fixed/drivers/infiniband/hw/ehca/hcp_if.c    2007-04-24 
15:06:47.000000000 +0200
@@ -136,7 +136,6 @@ static long ehca_plpar_hcall_norets(unsi
 
        return H_BUSY;
 }
-
 static long ehca_plpar_hcall9(unsigned long opcode,
                              unsigned long *outs, /* array of 9 outputs */
                              unsigned long arg1,
@@ -150,17 +149,27 @@ static long ehca_plpar_hcall9(unsigned l
                              unsigned long arg9)
 {
        long ret;
-       int i, sleep_msecs;
+       int i, sleep_msecs, lock_is_set = 0;
+       unsigned long flags;
+
 
        ehca_gen_dbg("opcode=%lx arg1=%lx arg2=%lx arg3=%lx arg4=%lx "
                     "arg5=%lx arg6=%lx arg7=%lx arg8=%lx arg9=%lx",
                     opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
                     arg8, arg9);
-
+       
        for (i = 0; i < 5; i++) {
+               if ((opcode == H_ALLOC_RESOURCE) && (arg2 == 5)) {
+                       spin_lock_irqsave(&hcall_lock, flags);
+                       lock_is_set = 1;
+               }
+
                ret = plpar_hcall9(opcode, outs,
                                   arg1, arg2, arg3, arg4, arg5,
                                   arg6, arg7, arg8, arg9);
+               
+               if (lock_is_set)
+                       spin_unlock_irqrestore(&hcall_lock, flags);
 
                if (H_IS_LONG_BUSY(ret)) {
                        sleep_msecs = get_longbusy_msecs(ret);
@@ -189,7 +198,6 @@ static long ehca_plpar_hcall9(unsigned l
                             opcode, ret, outs[0], outs[1], outs[2], outs[3],
                             outs[4], outs[5], outs[6], outs[7], outs[8]);
                return ret;
-
        }
 
        return H_BUSY;



_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

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

Reply via email to