netdev.vger.kernel.org archive mirror
 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; 9+ 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] 9+ messages in thread

* RE: [PATCH] net/mlx5: unique names for per device caches
  2024-09-20 14:33 [PATCH] net/mlx5: unique names for per device caches Sebastian Ott
@ 2024-09-20 16:32 ` Parav Pandit
  2024-09-20 18:11   ` [PATCH v2] " Sebastian Ott
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* [PATCH v2] net/mlx5: unique names for per device caches
  2024-09-20 16:32 ` Parav Pandit
@ 2024-09-20 18:11   ` Sebastian Ott
  2024-10-04 10:47     ` Breno Leitao
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sebastian Ott @ 2024-09-20 18:11 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, Parav Pandit

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".

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..c2db0a1c132b 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", 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.42.0


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

* Re: [PATCH v2] net/mlx5: unique names for per device caches
  2024-09-20 18:11   ` [PATCH v2] " Sebastian Ott
@ 2024-10-04 10:47     ` Breno Leitao
  2024-10-23 13:41     ` [PATCH v2 RESEND] " Sebastian Ott
  2024-10-25  4:03     ` [PATCH v2] " Kalesh Anakkur Purayil
  2 siblings, 0 replies; 9+ messages in thread
From: Breno Leitao @ 2024-10-04 10:47 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: netdev, linux-rdma, linux-kernel, Saeed Mahameed, Leon Romanovsky,
	Tariq Toukan, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Parav Pandit

On Fri, Sep 20, 2024 at 08:11:29PM +0200, Sebastian Ott wrote:
> 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".

Thanks for fixing it. I am hitting the same problem on my side as well:

	kmem_cache of name 'mlx5_fs_fgs' already exists
	WARNING: CPU: 0 PID: 10 at mm/slab_common.c:108 __kmem_cache_create_args+0xb8/0x320
> 
> Signed-off-by: Sebastian Ott <sebott@redhat.com>

Reviwed-by: Breno Leitao <leitao@debian.org>

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

* [PATCH v2 RESEND] net/mlx5: unique names for per device caches
  2024-09-20 18:11   ` [PATCH v2] " Sebastian Ott
  2024-10-04 10:47     ` Breno Leitao
@ 2024-10-23 13:41     ` Sebastian Ott
  2024-10-23 13:42       ` Breno Leitao
                         ` (2 more replies)
  2024-10-25  4:03     ` [PATCH v2] " Kalesh Anakkur Purayil
  2 siblings, 3 replies; 9+ messages in thread
From: Sebastian Ott @ 2024-10-23 13:41 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, Parav Pandit,
	Breno Leitao

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".

Reviwed-by: Breno Leitao <leitao@debian.org>
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..c2db0a1c132b 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", 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.42.0


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

* Re: [PATCH v2 RESEND] net/mlx5: unique names for per device caches
  2024-10-23 13:41     ` [PATCH v2 RESEND] " Sebastian Ott
@ 2024-10-23 13:42       ` Breno Leitao
  2024-10-24 16:47       ` Tariq Toukan
  2024-10-29  0:50       ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: Breno Leitao @ 2024-10-23 13:42 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: netdev, linux-rdma, linux-kernel, Saeed Mahameed, Leon Romanovsky,
	Tariq Toukan, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Parav Pandit

On Wed, Oct 23, 2024 at 03:41:46PM +0200, Sebastian Ott wrote:
> 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".
> 
> Reviwed-by: Breno Leitao <leitao@debian.org>
in fact, it should be:

Reviewed-by: Breno Leitao <leitao@debian.org>

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

* Re: [PATCH v2 RESEND] net/mlx5: unique names for per device caches
  2024-10-23 13:41     ` [PATCH v2 RESEND] " Sebastian Ott
  2024-10-23 13:42       ` Breno Leitao
@ 2024-10-24 16:47       ` Tariq Toukan
  2024-10-29  0:50       ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: Tariq Toukan @ 2024-10-24 16:47 UTC (permalink / raw)
  To: Sebastian Ott, netdev, linux-rdma, linux-kernel
  Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Parav Pandit,
	Breno Leitao



On 23/10/2024 16:41, Sebastian Ott wrote:
> 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".
> 
> Reviwed-by: Breno Leitao <leitao@debian.org>
> 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..c2db0a1c132b 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", 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;

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

Thanks.

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

* Re: [PATCH v2] net/mlx5: unique names for per device caches
  2024-09-20 18:11   ` [PATCH v2] " Sebastian Ott
  2024-10-04 10:47     ` Breno Leitao
  2024-10-23 13:41     ` [PATCH v2 RESEND] " Sebastian Ott
@ 2024-10-25  4:03     ` Kalesh Anakkur Purayil
  2 siblings, 0 replies; 9+ messages in thread
From: Kalesh Anakkur Purayil @ 2024-10-25  4:03 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: netdev, linux-rdma, linux-kernel, Saeed Mahameed, Leon Romanovsky,
	Tariq Toukan, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Parav Pandit

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

On Fri, Sep 20, 2024 at 11:41 PM Sebastian Ott <sebott@redhat.com> wrote:
>
> 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".
>
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
LGTM,
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>


-- 
Regards,
Kalesh A P

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]

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

* Re: [PATCH v2 RESEND] net/mlx5: unique names for per device caches
  2024-10-23 13:41     ` [PATCH v2 RESEND] " Sebastian Ott
  2024-10-23 13:42       ` Breno Leitao
  2024-10-24 16:47       ` Tariq Toukan
@ 2024-10-29  0:50       ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-29  0:50 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: netdev, linux-rdma, linux-kernel, saeedm, leon, tariqt, davem,
	edumazet, kuba, pabeni, parav, leitao

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 23 Oct 2024 15:41:46 +0200 you wrote:
> 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".
> 
> Reviwed-by: Breno Leitao <leitao@debian.org>
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> 
> [...]

Here is the summary with links:
  - [v2,RESEND] net/mlx5: unique names for per device caches
    https://git.kernel.org/netdev/net-next/c/25872a079bbb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-10-29  0:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 14:33 [PATCH] net/mlx5: unique names for per device caches Sebastian Ott
2024-09-20 16:32 ` Parav Pandit
2024-09-20 18:11   ` [PATCH v2] " Sebastian Ott
2024-10-04 10:47     ` Breno Leitao
2024-10-23 13:41     ` [PATCH v2 RESEND] " Sebastian Ott
2024-10-23 13:42       ` Breno Leitao
2024-10-24 16:47       ` Tariq Toukan
2024-10-29  0:50       ` patchwork-bot+netdevbpf
2024-10-25  4:03     ` [PATCH v2] " Kalesh Anakkur Purayil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).