[ofa-general] Re: 2.6.30.1: possible irq lock inversion dependency detected

Roland Dreier rdreier at cisco.com
Fri Jul 10 11:52:09 PDT 2009


Wow, that is crazy lockdep output -- I can't really figure out what it
thinks is wrong exactly.

Can you apply the following total hack and redo the test, and send the
lockdep output?  It should make the lockdep warning trigger sooner and,
I hope, make the warning shorter and easier to read.

Thanks,
 Roland


diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index e319d91..9593be8 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1028,6 +1028,17 @@ static const struct net_device_ops ipoib_netdev_ops = {
 	.ndo_neigh_setup	 = ipoib_neigh_setup_dev,
 };
 
+extern void mlx4_hack_irq_set(void (*f)(void *), void *a);
+static void irqfunc(void *priv_ptr)
+{
+	struct ipoib_dev_priv *priv = priv_ptr;
+	unsigned long flags;
+
+	spin_lock_irqsave(&priv->lock, flags);
+	spin_unlock_irqrestore(&priv->lock, flags);
+	ipoib_warn(priv, "got irq\n");
+}
+
 static void ipoib_setup(struct net_device *dev)
 {
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -1064,6 +1075,7 @@ static void ipoib_setup(struct net_device *dev)
 	ipoib_lro_setup(priv);
 
 	spin_lock_init(&priv->lock);
+	mlx4_hack_irq_set(irqfunc, priv);
 
 	mutex_init(&priv->vlan_mutex);
 
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index b9ceddd..51572c2 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -136,6 +136,21 @@ struct mlx4_eqe {
 	u8			owner;
 } __attribute__((packed));
 
+static void (*irqfunc)(void *);
+static void *irqarg;
+static DEFINE_SPINLOCK(irqlock);
+
+void mlx4_hack_irq_set(void (*f)(void *), void *a)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&irqlock, flags);
+	irqfunc = f;
+	irqarg = a;
+	spin_unlock_irqrestore(&irqlock, flags);
+}
+EXPORT_SYMBOL(mlx4_hack_irq_set);
+
 static void eq_set_ci(struct mlx4_eq *eq, int req_not)
 {
 	__raw_writel((__force u32) cpu_to_be32((eq->cons_index & 0xffffff) |
@@ -278,6 +293,18 @@ static irqreturn_t mlx4_msi_x_interrupt(int irq, void *eq_ptr)
 {
 	struct mlx4_eq  *eq  = eq_ptr;
 	struct mlx4_dev *dev = eq->dev;
+	unsigned long flags;
+	void (*f)(void *);
+	void *a;
+
+	spin_lock_irqsave(&irqlock, flags);
+	f = irqfunc;
+	a = irqarg;
+	irqfunc = NULL;
+	spin_unlock_irqrestore(&irqlock, flags);
+
+	if (f)
+		f(a);
 
 	mlx4_eq_int(dev, eq);
 



More information about the general mailing list