patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/4] net/mlx5: fix memory event on secondary process
       [not found] <20190307073314.18324-1-yskoh@mellanox.com>
@ 2019-03-07  7:33 ` Yongseok Koh
       [not found] ` <20190325191545.20707-1-yskoh@mellanox.com>
       [not found] ` <20190401211256.25930-1-yskoh@mellanox.com>
  2 siblings, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2019-03-07  7:33 UTC (permalink / raw)
  To: shahafs; +Cc: dev, stable

As the memory event is propagated to secondary processes, the event is
processed redundantly. This should be processed once because the data
structure used for MR and the event is global across the processes.

Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5.c    | 5 +++--
 drivers/net/mlx5/mlx5_mr.c | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 9706e351aa..f0ad5c73af 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -157,9 +157,10 @@ mlx5_prepare_shared_data(void)
 		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			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_mem_event_callback_register("MLX5_MEM_EVENT_CB",
-						mlx5_mr_mem_event_cb, NULL);
 	}
 	rte_spinlock_unlock(&mlx5_shared_data_lock);
 }
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 700d83d1bc..d336a77e40 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -891,6 +891,8 @@ mlx5_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr,
 	struct mlx5_priv *priv;
 	struct mlx5_dev_list *dev_list = &mlx5_shared_data->mem_event_cb_list;
 
+	/* Must be called from the primary process. */
+	assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
 	switch (event_type) {
 	case RTE_MEM_EVENT_FREE:
 		rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock);
-- 
2.11.0

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

* [dpdk-stable] [PATCH v2 1/4] net/mlx5: fix memory event on secondary process
       [not found] ` <20190325191545.20707-1-yskoh@mellanox.com>
@ 2019-03-25 19:15   ` Yongseok Koh
  2019-03-26 12:28     ` [dpdk-stable] [dpdk-dev] " Shahaf Shuler
  0 siblings, 1 reply; 4+ messages in thread
From: Yongseok Koh @ 2019-03-25 19:15 UTC (permalink / raw)
  To: shahafs; +Cc: dev, stable

As the memory event is propagated to secondary processes, the event is
processed redundantly. This should be processed once because the data
structure used for MR and the event is global across the processes.

Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5.c    | 5 +++--
 drivers/net/mlx5/mlx5_mr.c | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ae4b71695e..dd29eba955 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -157,9 +157,10 @@ mlx5_prepare_shared_data(void)
 		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			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_mem_event_callback_register("MLX5_MEM_EVENT_CB",
-						mlx5_mr_mem_event_cb, NULL);
 	}
 	rte_spinlock_unlock(&mlx5_shared_data_lock);
 }
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 700d83d1bc..d336a77e40 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -891,6 +891,8 @@ mlx5_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr,
 	struct mlx5_priv *priv;
 	struct mlx5_dev_list *dev_list = &mlx5_shared_data->mem_event_cb_list;
 
+	/* Must be called from the primary process. */
+	assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
 	switch (event_type) {
 	case RTE_MEM_EVENT_FREE:
 		rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock);
-- 
2.11.0


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/4] net/mlx5: fix memory event on secondary process
  2019-03-25 19:15   ` [dpdk-stable] [PATCH v2 " Yongseok Koh
@ 2019-03-26 12:28     ` Shahaf Shuler
  0 siblings, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2019-03-26 12:28 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: dev, stable

Monday, March 25, 2019 9:16 PM, Yongseok Koh:
> Subject: [dpdk-dev] [PATCH v2 1/4] net/mlx5: fix memory event on
> secondary process
> 
> As the memory event is propagated to secondary processes, the event is
> processed redundantly. This should be processed once because the data
> structure used for MR and the event is global across the processes.
> 
> Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>

Acked-by: Shahaf Shuler <shahafs@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5.c    | 5 +++--
>  drivers/net/mlx5/mlx5_mr.c | 2 ++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> ae4b71695e..dd29eba955 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -157,9 +157,10 @@ mlx5_prepare_shared_data(void)
>  		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
>  			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_mem_event_callback_register("MLX5_MEM_EVENT_CB",
> -						mlx5_mr_mem_event_cb,
> NULL);
>  	}
>  	rte_spinlock_unlock(&mlx5_shared_data_lock);
>  }
> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index
> 700d83d1bc..d336a77e40 100644
> --- a/drivers/net/mlx5/mlx5_mr.c
> +++ b/drivers/net/mlx5/mlx5_mr.c
> @@ -891,6 +891,8 @@ mlx5_mr_mem_event_cb(enum rte_mem_event
> event_type, const void *addr,
>  	struct mlx5_priv *priv;
>  	struct mlx5_dev_list *dev_list = &mlx5_shared_data-
> >mem_event_cb_list;
> 
> +	/* Must be called from the primary process. */
> +	assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
>  	switch (event_type) {
>  	case RTE_MEM_EVENT_FREE:
>  		rte_rwlock_write_lock(&mlx5_shared_data-
> >mem_event_rwlock);
> --
> 2.11.0


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

* [dpdk-stable] [PATCH v3 1/4] net/mlx5: fix memory event on secondary process
       [not found] ` <20190401211256.25930-1-yskoh@mellanox.com>
@ 2019-04-01 21:12   ` Yongseok Koh
  0 siblings, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2019-04-01 21:12 UTC (permalink / raw)
  To: shahafs; +Cc: dev, stable

As the memory event is propagated to secondary processes, the event is
processed redundantly. This should be processed once because the data
structure used for MR and the event is global across the processes.

Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.c    | 5 +++--
 drivers/net/mlx5/mlx5_mr.c | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1d7ca615bd..2208cc922a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -322,9 +322,10 @@ mlx5_prepare_shared_data(void)
 		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			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_mem_event_callback_register("MLX5_MEM_EVENT_CB",
-						mlx5_mr_mem_event_cb, NULL);
 	}
 	rte_spinlock_unlock(&mlx5_shared_data_lock);
 }
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 0f0a64f0a4..88484dd50b 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -892,6 +892,8 @@ mlx5_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr,
 	struct mlx5_priv *priv;
 	struct mlx5_dev_list *dev_list = &mlx5_shared_data->mem_event_cb_list;
 
+	/* Must be called from the primary process. */
+	assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
 	switch (event_type) {
 	case RTE_MEM_EVENT_FREE:
 		rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock);
-- 
2.11.0


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

end of thread, other threads:[~2019-04-01 21:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190307073314.18324-1-yskoh@mellanox.com>
2019-03-07  7:33 ` [dpdk-stable] [PATCH 1/4] net/mlx5: fix memory event on secondary process Yongseok Koh
     [not found] ` <20190325191545.20707-1-yskoh@mellanox.com>
2019-03-25 19:15   ` [dpdk-stable] [PATCH v2 " Yongseok Koh
2019-03-26 12:28     ` [dpdk-stable] [dpdk-dev] " Shahaf Shuler
     [not found] ` <20190401211256.25930-1-yskoh@mellanox.com>
2019-04-01 21:12   ` [dpdk-stable] [PATCH v3 " Yongseok Koh

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