All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: unique names for per device caches
@ 2024-09-20 14:33 Sebastian Ott
  2024-09-20 16:32 ` Parav Pandit
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Ott @ 2024-09-20 14:33 UTC (permalink / raw)
  To: netdev, linux-rdma, linux-kernel
  Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni

Add the pci 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".

Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 8505d5e241e1..5d54386a5669 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -3689,6 +3689,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);
@@ -3713,10 +3714,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", pci_name(dev->pdev));
+	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", pci_name(dev->pdev));
+	steering->ftes_cache = kmem_cache_create(name, sizeof(struct fs_fte), 0,
 						 0, NULL);
 	if (!steering->ftes_cache || !steering->fgs_cache) {
 		err = -ENOMEM;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] net/mlx5: unique names for per device caches
  2024-09-20 14:33 Sebastian Ott
@ 2024-09-20 16:32 ` Parav Pandit
  0 siblings, 0 replies; 4+ messages in thread
From: Parav Pandit @ 2024-09-20 16:32 UTC (permalink / raw)
  To: Sebastian Ott, netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
  Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni

Hi Sebastian,

> From: Sebastian Ott <sebott@redhat.com>
> Sent: Friday, September 20, 2024 8:04 PM
> 
> Add the pci 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".
> 
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> index 8505d5e241e1..5d54386a5669 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> @@ -3689,6 +3689,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);
> @@ -3713,10 +3714,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", pci_name(dev-
> >pdev));
> +	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", pci_name(dev-
> >pdev));
> +	steering->ftes_cache = kmem_cache_create(name, sizeof(struct
> fs_fte),
> +0,
Mlx5 SFs are attached to the auxiliary bus. Hence, they will have duplicate name and this warning will persist.
Please change it to 
pci_name(dev->pdev) to dev_name(dev->device)

This will uniformly work for PF, VF and SF.

>  						 0, NULL);
>  	if (!steering->ftes_cache || !steering->fgs_cache) {
>  		err = -ENOMEM;
> --
> 2.42.0
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] net/mlx5: unique names for per device caches
@ 2024-12-10 21:07 Matt Fleming
  2024-12-11 16:32 ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Fleming @ 2024-12-10 21:07 UTC (permalink / raw)
  To: Greg KH, Sasha Levin
  Cc: stable, kernel-team, Sebastian Ott, Breno Leitao, Tariq Toukan,
	Jakub Kicinski, Matt Fleming

From: Sebastian Ott <sebott@redhat.com>

[ 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: Sebastian Ott <sebott@redhat.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20241023134146.28448-1-sebott@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
---

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(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 6e4f8aaf8d2f..2eabfcc247c6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/mlx5: unique names for per device caches
  2024-12-10 21:07 [PATCH] net/mlx5: unique names for per device caches Matt Fleming
@ 2024-12-11 16:32 ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2024-12-11 16:32 UTC (permalink / raw)
  To: stable; +Cc: Matt Fleming, Sasha Levin

[ 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 <matt@readmodwrite.com>
Commit author: Sebastian Ott <sebott@redhat.com>


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: Sebastian Ott <sebott@redhat.com>
         Reviewed-by: Breno Leitao <leitao@debian.org>
         Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
         Link: https://patch.msgid.link/20241023134146.28448-1-sebott@redhat.com
         Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    +    Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
     
      ## 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       |

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-11 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10 21:07 [PATCH] net/mlx5: unique names for per device caches Matt Fleming
2024-12-11 16:32 ` Sasha Levin
  -- strict thread matches above, loose matches on Subject: below --
2024-09-20 14:33 Sebastian Ott
2024-09-20 16:32 ` Parav Pandit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.