Skip to contentSkip to conversation

mlx5_core: warn if no space left in alloc_4k()

PATCH In review Dan Carpenter 4 participants 5 messages Nov 1, 2013 – Nov 5, 2013 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx5_core: warn if no space left in alloc_4k()

The warning was unreachable. In the original code, it would print the line number and the function but I have added an error message.

---
I haven't tested this, hopefully the warning is not annoying.

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +1 -1
index ba816c2..cb86265 100644
@@ -193,8 +193,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	unsigned n;
 
 	if (list_empty(&dev->priv.free_list)) {
+		mlx5_core_warn(dev, "no available space\n");
 		return -ENOMEM;
-		mlx5_core_warn(dev, "\n");
 	}
 
 	fp = list_entry(dev->priv.free_list.next, struct fw_page, list);

A message that is not in the archive (sent off-list or not yet received): 20131101102044.GB29795-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org

#2 lore raw
Quoted 12 lines · Dan Carpenter

The warning was unreachable. In the original code, it would print the line number and the function but I have added an error message.

---
I haven't tested this, hopefully the warning is not annoying.

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +0 -0
index ba816c2..cb86265 100644

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr) · line 198

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +1 -1
@@ -193,8 +193,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	unsigned n;
 
 	if (list_empty(&dev->priv.free_list)) {
+		mlx5_core_warn(dev, "no available space\n");
 		return -ENOMEM;
-		mlx5_core_warn(dev, "\n");
 	}

What we really need to do here is silently return -ENOMEM. The list can be found empty on a regular basis so we don't want to flood dmesg with annoying messages. The statement was probably left there from a previous debug cycle.

Quoted 6 lines
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +0 -1
 	fp = list_entry(dev->priv.free_list.next, struct fw_page, list);
--

To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 15 lines · Eli Cohen
Quoted 14 lines · Dan Carpenter

The warning was unreachable. In the original code, it would print the line number and the function but I have added an error message.

---
I haven't tested this, hopefully the warning is not annoying.

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +0 -0
index ba816c2..cb86265 100644
@@ -193,8 +193,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	unsigned n;
 
Quoted 10 lines

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr) · line 198

Quoted 5 lines
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +1 -1
 	if (list_empty(&dev->priv.free_list)) {
+		mlx5_core_warn(dev, "no available space\n");
 		return -ENOMEM;
-		mlx5_core_warn(dev, "\n");
 	}

What we really need to do here is silently return -ENOMEM. The list can be found empty on a regular basis so we don't want to flood dmesg with annoying messages. The statement was probably left there from a previous debug cycle.

Ah, ok. Thanks for the review. I will remove the message.

regards,
dan carpenter

#4 lore raw

PATCH v2 1/1 mlx5_core: delete some dead code

In reply to Eli Cohen

The printk() looks like it is left over debug code. I have removed it.

---
v2: Remove the printk instead of moving it infront of the return.

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +1 -3
index ba816c2..9b79067 100644
@@ -192,10 +192,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	struct fw_page *fp;
 	unsigned n;
 
-	if (list_empty(&dev->priv.free_list)) {
+	if (list_empty(&dev->priv.free_list))
 		return -ENOMEM;
-		mlx5_core_warn(dev, "\n");
-	}
 
 	fp = list_entry(dev->priv.free_list.next, struct fw_page, list);
 	n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask));
maintainer
#5 lore raw

Re: [patch v2] mlx5_core: delete some dead code

From: Dan Carpenter <[email protected]>
Date: Tue, 5 Nov 2013 01:20:56 +0300

Quoted 5 lines

The printk() looks like it is left over debug code. I have removed it.

---
v2: Remove the printk instead of moving it infront of the return.

This doesn't apply to the current tree, I suspect some recent changes made this fix no longer applicable. Please take a look.

Thanks!