Skip to contentSkip to conversation

net/mlx5: unique names for per device caches

PATCH In review Matt Fleming 2 participants 2 messages Dec 10, 2024 – Dec 11, 2024

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

PATCH 1/1 net/mlx5: unique names for per device caches

From: Sebastian Ott <[email protected]>

[ Upstream commit 25872a079bbbe952eb660249cc9f40fa75623e68 ]

Add the device name to the per device kmem_cache names to ensure their uniqueness. This fixes warnings like this:
"kmem_cache of name 'mlx5_fs_fgs' already exists".

---

This backport only needs applying to 6.12.y.

I also added a Fixes tag that was missing from the upstream commit

 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +5 -2
index 6e4f8aaf8d2f..2eabfcc247c6 100644
@@ -3698,6 +3698,7 @@ void mlx5_fs_core_free(struct mlx5_core_dev *dev)
 int mlx5_fs_core_alloc(struct mlx5_core_dev *dev)
 {
 	struct mlx5_flow_steering *steering;
+	char name[80];
 	int err = 0;
 
 	err = mlx5_init_fc_stats(dev);
@@ -3722,10 +3723,12 @@ int mlx5_fs_core_alloc(struct mlx5_core_dev *dev)
 	else
 		steering->mode = MLX5_FLOW_STEERING_MODE_DMFS;
 
-	steering->fgs_cache = kmem_cache_create("mlx5_fs_fgs",
+	snprintf(name, sizeof(name), "%s-mlx5_fs_fgs", dev_name(dev->device));
+	steering->fgs_cache = kmem_cache_create(name,
 						sizeof(struct mlx5_flow_group), 0,
 						0, NULL);
-	steering->ftes_cache = kmem_cache_create("mlx5_fs_ftes", sizeof(struct fs_fte), 0,
+	snprintf(name, sizeof(name), "%s-mlx5_fs_ftes", dev_name(dev->device));
+	steering->ftes_cache = kmem_cache_create(name, sizeof(struct fs_fte), 0,
 						 0, NULL);
 	if (!steering->ftes_cache || !steering->fgs_cache) {
 		err = -ENOMEM;
Signature · 1 line
2.34.1
maintainer Reviewed-by Breno Leitao Reviewed-by Tariq Toukan on v1 1/1
#1 lore raw

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 25872a079bbbe952eb660249cc9f40fa75623e68

WARNING: Author mismatch between patch and upstream commit:
Backport author: Matt Fleming <[email protected]> Commit author: Sebastian Ott <[email protected]>

Status in newer kernel trees:
6.12.y | Not found

Note: The patch differs from the upstream commit:
---
1: 25872a079bbbe ! 1: 48fb546e12d61 net/mlx5: unique names for per device caches
@@ Metadata
## Commit message ##
net/mlx5: unique names for per device caches

+ [ Upstream commit 25872a079bbbe952eb660249cc9f40fa75623e68 ]
+
Add the device name to the per device kmem_cache names to ensure their uniqueness. This fixes warnings like this:
"kmem_cache of name 'mlx5_fs_fgs' already exists".

+ Fixes: 4c39529663b9 ("slab: Warn on duplicate cache names when DEBUG_VM=y")

+ Signed-off-by: Matt Fleming <[email protected]>

## drivers/net/ethernet/mellanox/mlx5/core/fs_core.c ##
@@ drivers/net/ethernet/mellanox/mlx5/core/fs_core.c: void mlx5_fs_core_free(struct mlx5_core_dev *dev)
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Success    |  Success   |
| stable/linux-6.6.y        |  Success    |  Success   |
| stable/linux-6.1.y        |  Success    |  Success   |
| stable/linux-5.15.y       |  Failed     |  N/A       |
| stable/linux-5.10.y       |  Failed     |  N/A       |
| stable/linux-5.4.y        |  Failed     |  N/A       |