On Mon, Dec 06, 2004 at 10:59:51AM -0800, Roland Dreier wrote:
>     Grant> Yes - that works. Please commit.
> 
> I rewrote things in a way that seems cleaner to me -- what I actually
> committed is below.  Please try one more time and make sure this still
> fixes the problem.

I've updated to svn 1316 and that has both the problem I
originally observed plus it "hangs" when the module is loaded.

...
> Index: infiniband/hw/mthca/mthca_cmd.c
> ===================================================================
> --- infiniband/hw/mthca/mthca_cmd.c   (revision 1310)
> +++ infiniband/hw/mthca/mthca_cmd.c   (working copy)
> @@ -293,6 +293,12 @@
>       complete(&context->done);
>  }
>  
> +void mthca_cmd_complete(struct mthca_dev *dev, int ncomp)
> +{
> +     while (ncomp--)
> +             up(&dev->cmd.event_sem);
> +}
> +
>  static void event_timeout(unsigned long context_ptr)
>  {
>       struct mthca_cmd_context *context =
> @@ -357,7 +363,6 @@
>       dev->cmd.free_head = context - dev->cmd.context;
>       spin_unlock(&dev->cmd.context_lock);
>  
> -     up(&dev->cmd.event_sem);
>       return err;
>  }

I have the feeling the timeout code isn't cleaning
up the event_sem and that's causing the hang.

trying to understand this now.

thanks,
grant

>  
> Index: infiniband/hw/mthca/mthca_eq.c
> ===================================================================
> --- infiniband/hw/mthca/mthca_eq.c    (revision 1310)
> +++ infiniband/hw/mthca/mthca_eq.c    (working copy)
> @@ -219,6 +219,7 @@
>       struct mthca_eqe *eqe;
>       int disarm_cqn;
>       int work = 0;
> +     int ncmd = 0;
>  
>       while (1) {
>               if (!next_eqe_sw(eq))
> @@ -274,6 +275,7 @@
>                                       be16_to_cpu(eqe->event.cmd.token),
>                                       eqe->event.cmd.status,
>                                       be64_to_cpu(eqe->event.cmd.out_param));
> +                     ++ncmd;
>                       break;
>  
>               case MTHCA_EVENT_TYPE_PORT_CHANGE:
> @@ -303,6 +305,9 @@
>               set_eq_ci(dev, eq->eqn, eq->cons_index);
>       }
>  
> +     if (ncmd)
> +             mthca_cmd_complete(dev, ncmd);
> +
>       eq_req_not(dev, eq->eqn);
>  }
>  
> Index: infiniband/hw/mthca/mthca_cmd.h
> ===================================================================
> --- infiniband/hw/mthca/mthca_cmd.h   (revision 1310)
> +++ infiniband/hw/mthca/mthca_cmd.h   (working copy)
> @@ -203,10 +203,9 @@
>  
>  int mthca_cmd_use_events(struct mthca_dev *dev);
>  void mthca_cmd_use_polling(struct mthca_dev *dev);
> -void mthca_cmd_event(struct mthca_dev *dev,
> -                  u16 token,
> -                  u8  status,
> -                  u64 out_param);
> +void mthca_cmd_event(struct mthca_dev *dev, u16 token,
> +                  u8  status, u64 out_param);
> +void mthca_cmd_complete(struct mthca_dev *dev, int ncomp);
>  
>  int mthca_SYS_EN(struct mthca_dev *dev, u8 *status);
>  int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status);
_______________________________________________
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