mlx4: Fix lock initializations
authorXiao Jia <stfairy@gmail.com>
Wed, 28 Oct 2015 00:36:33 +0000 (17:36 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Nov 2015 17:00:38 +0000 (12:00 -0500)
I was getting "Lock XXX tried to spin when it shouldn't" errors when
the kernel was compiled with spinlock debugging.

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/net/mlx4/alloc.c
kern/drivers/net/mlx4/cmd.c
kern/drivers/net/mlx4/mr.c

index da0b158..fdb26ee 100644 (file)
@@ -179,7 +179,7 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, uint32_t num, uint32_t mask,
        bitmap->reserved_top = reserved_top;
        bitmap->avail = num - reserved_top - reserved_bot;
        bitmap->effective_len = bitmap->avail;
-       spinlock_init_irqsave(&bitmap->lock);
+       spinlock_init(&bitmap->lock);
        bitmap->table = kzmalloc(BITS_TO_LONGS(bitmap->max) * sizeof(long),
                                 KMALLOC_WAIT);
        if (!bitmap->table)
@@ -227,7 +227,7 @@ struct mlx4_zone_allocator *mlx4_zone_allocator_create(enum mlx4_zone_alloc_flag
 
        INIT_LIST_HEAD(&zones->entries);
        INIT_LIST_HEAD(&zones->prios);
-       spinlock_init_irqsave(&zones->lock);
+       spinlock_init(&zones->lock);
        zones->last_uid = 0;
        zones->mask = 0;
        zones->flags = flags;
index b75f9ab..5f86dbe 100644 (file)
@@ -2483,7 +2483,7 @@ int mlx4_cmd_init(struct mlx4_dev *dev)
 
        if (!priv->cmd.initialized) {
                qlock_init(&priv->cmd.slave_cmd_mutex);
-               sema_init(&priv->cmd.poll_sem, 1);
+               sem_init(&priv->cmd.poll_sem, 1);
                priv->cmd.use_events = 0;
                priv->cmd.toggle     = 1;
                priv->cmd.initialized = 1;
@@ -2624,8 +2624,8 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
        priv->cmd.context[priv->cmd.max_cmds - 1].next = -1;
        priv->cmd.free_head = 0;
 
-       sema_init(&priv->cmd.event_sem, priv->cmd.max_cmds);
-       spinlock_init_irqsave(&priv->cmd.context_lock);
+       sem_init(&priv->cmd.event_sem, priv->cmd.max_cmds);
+       spinlock_init(&priv->cmd.context_lock);
 
        for (priv->cmd.token_mask = 1;
             priv->cmd.token_mask < priv->cmd.max_cmds;
index 927cf70..1eddbb8 100644 (file)
@@ -99,7 +99,7 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order)
        int i, s;
 
        buddy->max_order = max_order;
-       spinlock_init_irqsave(&buddy->lock);
+       spinlock_init(&buddy->lock);
 
        buddy->bits = kzmalloc((buddy->max_order + 1) * (sizeof(long *)),
                               KMALLOC_WAIT);