Skip to contentSkip to conversation

net/mlx5: only register memory callback when probing a device

PATCH Applied David Marchand 4 participants 5 messages May 30, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: only register memory callback when probing a device

The callback should be invoked only for memory that has been registered in a device, hence, no need to track cleanup events if no device is present.

Bugzilla-ID: 56

Fixes 974f1e7ef146 ("net/mlx5: add new memory region support")
---
 drivers/net/mlx5/mlx5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
index d77a20db4..601d03f71 100644
@@ -138,6 +138,8 @@ mlx5_prepare_shared_data(void)
 			LIST_INIT(&mlx5_shared_data->mem_event_cb_list);
 			rte_rwlock_init(&mlx5_shared_data->mem_event_rwlock);
 		}
+		rte_mem_event_callback_register("MLX5_MEM_EVENT_CB",
+						mlx5_mr_mem_event_cb, NULL);
 	}
 	rte_spinlock_unlock(&mlx5_shared_data_lock);
 }
@@ -1460,8 +1462,6 @@ rte_mlx5_pmd_init(void)
 	}
 	mlx5_glue->fork_init();
 	rte_pci_register(&mlx5_driver);
-	rte_mem_event_callback_register("MLX5_MEM_EVENT_CB",
-					mlx5_mr_mem_event_cb, NULL);
 }
 
 RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · David Marchand

The callback should be invoked only for memory that has been registered in a device, hence, no need to track cleanup events if no device is present.

Bugzilla-ID: 56

Fixes 974f1e7ef146 ("net/mlx5: add new memory region support")

---

Good finding! Thank you so much for the patch.
Patch is good. Just to be sure, I've run traffic with testpmd and also run multi-process test examples with traffic. It runs well.

Thanks

Quoted 28 lines

drivers/net/mlx5/mlx5.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
index d77a20db4..601d03f71 100644
@@ -138,6 +138,8 @@ mlx5_prepare_shared_data(void)
 			LIST_INIT(&mlx5_shared_data->mem_event_cb_list);
 			rte_rwlock_init(&mlx5_shared_data->mem_event_rwlock);
 		}
+		rte_mem_event_callback_register("MLX5_MEM_EVENT_CB",
+						mlx5_mr_mem_event_cb, NULL);
 	}
 	rte_spinlock_unlock(&mlx5_shared_data_lock);
 }
@@ -1460,8 +1462,6 @@ rte_mlx5_pmd_init(void)
 	}
 	mlx5_glue->fork_init();
 	rte_pci_register(&mlx5_driver);
-	rte_mem_event_callback_register("MLX5_MEM_EVENT_CB",
-					mlx5_mr_mem_event_cb, NULL);
 }
 
 RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__);
Signature · 1 line
2.11.0
#2 lore raw
Quoted 9 lines · Yongseok Koh
Quoted 9 lines · David Marchand

The callback should be invoked only for memory that has been registered in a device, hence, no need to track cleanup events if no device is present.

Bugzilla-ID: 56

Fixes 974f1e7ef146 ("net/mlx5: add new memory region support")
Quoted 8 lines
Quoted 2 lines

---

Good finding! Thank you so much for the patch.
Patch is good. Just to be sure, I've run traffic with testpmd and also run multi-process test examples with traffic. It runs well.

Well, this is a quick fix, the mlx5_prepare_shared_data() now does more than initialising the shared data...
Might be better to revisit later, but this should do the job for 18.05.

Thanks.

Signature · 1 line
David Marchand
#3 lore raw

30/05/2018 18:04, David Marchand:

Quoted 17 lines · Yongseok Koh
Quoted 16 lines
Quoted 11 lines · David Marchand

The callback should be invoked only for memory that has been registered in a device, hence, no need to track cleanup events if no device is present.

Bugzilla-ID: 56

Fixes 974f1e7ef146 ("net/mlx5: add new memory region support")

---

Good finding! Thank you so much for the patch.
Patch is good. Just to be sure, I've run traffic with testpmd and also run multi-process test examples with traffic. It runs well.

Quoted 5 lines
Quoted 1 line

Well, this is a quick fix, the mlx5_prepare_shared_data() now does more than initialising the shared data...
Might be better to revisit later, but this should do the job for 18.05.

Applied, thanks

Tested-by on v1 1/1
#4 lore raw
In reply to David Marchand
Quoted 8 lines · David Marchand

The callback should be invoked only for memory that has been registered in a device, hence, no need to track cleanup events if no device is present.

Bugzilla-ID: 56

Fixes 974f1e7ef146 ("net/mlx5: add new memory region support")

(Reproduced using the suggested tespmd update in Bug 56, verified this patch fixes it.)