* [dpdk-dev] [PATCH 1/1] net/mlx5: fix sharing context destroy order
@ 2019-04-03 14:14 Viacheslav Ovsiienko
2019-04-03 14:14 ` Viacheslav Ovsiienko
2019-04-05 13:29 ` [dpdk-dev] [PATCH v2 " Viacheslav Ovsiienko
0 siblings, 2 replies; 6+ messages in thread
From: Viacheslav Ovsiienko @ 2019-04-03 14:14 UTC (permalink / raw)
To: dev; +Cc: shahafs
At the mlx5 device closing the shared IB context was destroyed
before cleanup routines completion. As it was found on some
setups (Netlink fails with old kernel drivers and we have to use
sysfs to retrieve interface index, this requires IB device name,
which is stored in shared context) the mlx5_nl_mac_addr_flush()
requires IB device name, and if shared context is removed it
causes the segmentation fault.
Fixes: 17e19bc4dde7 ("net/mlx5: add IB shared context alloc/free functions")
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
drivers/net/mlx5/mlx5.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 9aa5f0b..570640d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -543,9 +543,6 @@ struct mlx5_dev_spawn_data {
#ifdef HAVE_MLX5DV_DR
mlx5_free_shared_dv(priv);
#endif
- if (priv->sh)
- mlx5_free_shared_ibctx(priv->sh);
- priv->sh = NULL;
if (priv->rss_conf.rss_key != NULL)
rte_free(priv->rss_conf.rss_key);
if (priv->reta_idx != NULL)
@@ -560,6 +557,16 @@ struct mlx5_dev_spawn_data {
close(priv->nl_socket_rdma);
if (priv->tcf_context)
mlx5_flow_tcf_context_destroy(priv->tcf_context);
+ if (priv->sh) {
+ /*
+ * Free the shared context in last turn, because the cleanup
+ * routines above may use some shared fields, like
+ * mlx5_nl_mac_addr_flush() uses ibdev_path for retrieveing
+ * ifindex if Netlink fails.
+ */
+ mlx5_free_shared_ibctx(priv->sh);
+ priv->sh = NULL;
+ }
ret = mlx5_hrxq_ibv_verify(dev);
if (ret)
DRV_LOG(WARNING, "port %u some hash Rx queue still remain",
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 1/1] net/mlx5: fix sharing context destroy order
2019-04-03 14:14 [dpdk-dev] [PATCH 1/1] net/mlx5: fix sharing context destroy order Viacheslav Ovsiienko
@ 2019-04-03 14:14 ` Viacheslav Ovsiienko
2019-04-05 13:29 ` [dpdk-dev] [PATCH v2 " Viacheslav Ovsiienko
1 sibling, 0 replies; 6+ messages in thread
From: Viacheslav Ovsiienko @ 2019-04-03 14:14 UTC (permalink / raw)
To: dev; +Cc: shahafs
At the mlx5 device closing the shared IB context was destroyed
before cleanup routines completion. As it was found on some
setups (Netlink fails with old kernel drivers and we have to use
sysfs to retrieve interface index, this requires IB device name,
which is stored in shared context) the mlx5_nl_mac_addr_flush()
requires IB device name, and if shared context is removed it
causes the segmentation fault.
Fixes: 17e19bc4dde7 ("net/mlx5: add IB shared context alloc/free functions")
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
drivers/net/mlx5/mlx5.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 9aa5f0b..570640d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -543,9 +543,6 @@ struct mlx5_dev_spawn_data {
#ifdef HAVE_MLX5DV_DR
mlx5_free_shared_dv(priv);
#endif
- if (priv->sh)
- mlx5_free_shared_ibctx(priv->sh);
- priv->sh = NULL;
if (priv->rss_conf.rss_key != NULL)
rte_free(priv->rss_conf.rss_key);
if (priv->reta_idx != NULL)
@@ -560,6 +557,16 @@ struct mlx5_dev_spawn_data {
close(priv->nl_socket_rdma);
if (priv->tcf_context)
mlx5_flow_tcf_context_destroy(priv->tcf_context);
+ if (priv->sh) {
+ /*
+ * Free the shared context in last turn, because the cleanup
+ * routines above may use some shared fields, like
+ * mlx5_nl_mac_addr_flush() uses ibdev_path for retrieveing
+ * ifindex if Netlink fails.
+ */
+ mlx5_free_shared_ibctx(priv->sh);
+ priv->sh = NULL;
+ }
ret = mlx5_hrxq_ibv_verify(dev);
if (ret)
DRV_LOG(WARNING, "port %u some hash Rx queue still remain",
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2 1/1] net/mlx5: fix sharing context destroy order
2019-04-03 14:14 [dpdk-dev] [PATCH 1/1] net/mlx5: fix sharing context destroy order Viacheslav Ovsiienko
2019-04-03 14:14 ` Viacheslav Ovsiienko
@ 2019-04-05 13:29 ` Viacheslav Ovsiienko
2019-04-05 13:29 ` Viacheslav Ovsiienko
2019-04-08 6:00 ` Shahaf Shuler
1 sibling, 2 replies; 6+ messages in thread
From: Viacheslav Ovsiienko @ 2019-04-05 13:29 UTC (permalink / raw)
To: dev; +Cc: shahafs
At the mlx5 device closing the shared IB context was destroyed
before cleanup routines completion. As it was found on some
setups (Netlink fails with old kernel drivers and we have to use
sysfs to retrieve interface index, this requires IB device name,
which is stored in shared context) the mlx5_nl_mac_addr_flush()
requires IB device name, and if shared context is removed it
causes the segmentation fault.
Fixes: 17e19bc4dde7 ("net/mlx5: add IB shared context alloc/free functions")
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
v2:
rebasing only
v1:
http://patches.dpdk.org/patch/52193/
drivers/net/mlx5/mlx5.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b7e6234..475c93d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -593,9 +593,6 @@ struct mlx5_dev_spawn_data {
mlx5_mr_release(dev);
assert(priv->sh);
mlx5_free_shared_dr(priv);
- if (priv->sh)
- mlx5_free_shared_ibctx(priv->sh);
- priv->sh = NULL;
if (priv->rss_conf.rss_key != NULL)
rte_free(priv->rss_conf.rss_key);
if (priv->reta_idx != NULL)
@@ -608,6 +605,16 @@ struct mlx5_dev_spawn_data {
close(priv->nl_socket_rdma);
if (priv->tcf_context)
mlx5_flow_tcf_context_destroy(priv->tcf_context);
+ if (priv->sh) {
+ /*
+ * Free the shared context in last turn, because the cleanup
+ * routines above may use some shared fields, like
+ * mlx5_nl_mac_addr_flush() uses ibdev_path for retrieveing
+ * ifindex if Netlink fails.
+ */
+ mlx5_free_shared_ibctx(priv->sh);
+ priv->sh = NULL;
+ }
ret = mlx5_hrxq_ibv_verify(dev);
if (ret)
DRV_LOG(WARNING, "port %u some hash Rx queue still remain",
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2 1/1] net/mlx5: fix sharing context destroy order
2019-04-05 13:29 ` [dpdk-dev] [PATCH v2 " Viacheslav Ovsiienko
@ 2019-04-05 13:29 ` Viacheslav Ovsiienko
2019-04-08 6:00 ` Shahaf Shuler
1 sibling, 0 replies; 6+ messages in thread
From: Viacheslav Ovsiienko @ 2019-04-05 13:29 UTC (permalink / raw)
To: dev; +Cc: shahafs
At the mlx5 device closing the shared IB context was destroyed
before cleanup routines completion. As it was found on some
setups (Netlink fails with old kernel drivers and we have to use
sysfs to retrieve interface index, this requires IB device name,
which is stored in shared context) the mlx5_nl_mac_addr_flush()
requires IB device name, and if shared context is removed it
causes the segmentation fault.
Fixes: 17e19bc4dde7 ("net/mlx5: add IB shared context alloc/free functions")
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
v2:
rebasing only
v1:
http://patches.dpdk.org/patch/52193/
drivers/net/mlx5/mlx5.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b7e6234..475c93d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -593,9 +593,6 @@ struct mlx5_dev_spawn_data {
mlx5_mr_release(dev);
assert(priv->sh);
mlx5_free_shared_dr(priv);
- if (priv->sh)
- mlx5_free_shared_ibctx(priv->sh);
- priv->sh = NULL;
if (priv->rss_conf.rss_key != NULL)
rte_free(priv->rss_conf.rss_key);
if (priv->reta_idx != NULL)
@@ -608,6 +605,16 @@ struct mlx5_dev_spawn_data {
close(priv->nl_socket_rdma);
if (priv->tcf_context)
mlx5_flow_tcf_context_destroy(priv->tcf_context);
+ if (priv->sh) {
+ /*
+ * Free the shared context in last turn, because the cleanup
+ * routines above may use some shared fields, like
+ * mlx5_nl_mac_addr_flush() uses ibdev_path for retrieveing
+ * ifindex if Netlink fails.
+ */
+ mlx5_free_shared_ibctx(priv->sh);
+ priv->sh = NULL;
+ }
ret = mlx5_hrxq_ibv_verify(dev);
if (ret)
DRV_LOG(WARNING, "port %u some hash Rx queue still remain",
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/1] net/mlx5: fix sharing context destroy order
2019-04-05 13:29 ` [dpdk-dev] [PATCH v2 " Viacheslav Ovsiienko
2019-04-05 13:29 ` Viacheslav Ovsiienko
@ 2019-04-08 6:00 ` Shahaf Shuler
2019-04-08 6:00 ` Shahaf Shuler
1 sibling, 1 reply; 6+ messages in thread
From: Shahaf Shuler @ 2019-04-08 6:00 UTC (permalink / raw)
To: Slava Ovsiienko, dev
Friday, April 5, 2019 4:29 PM, Viacheslav Ovsiienko:
> Subject: [dpdk-dev] [PATCH v2 1/1] net/mlx5: fix sharing context destroy
> order
>
> At the mlx5 device closing the shared IB context was destroyed before
> cleanup routines completion. As it was found on some setups (Netlink fails
> with old kernel drivers and we have to use sysfs to retrieve interface index,
> this requires IB device name, which is stored in shared context) the
> mlx5_nl_mac_addr_flush() requires IB device name, and if shared context is
> removed it causes the segmentation fault.
>
> Fixes: 17e19bc4dde7 ("net/mlx5: add IB shared context alloc/free functions")
>
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/1] net/mlx5: fix sharing context destroy order
2019-04-08 6:00 ` Shahaf Shuler
@ 2019-04-08 6:00 ` Shahaf Shuler
0 siblings, 0 replies; 6+ messages in thread
From: Shahaf Shuler @ 2019-04-08 6:00 UTC (permalink / raw)
To: Slava Ovsiienko, dev
Friday, April 5, 2019 4:29 PM, Viacheslav Ovsiienko:
> Subject: [dpdk-dev] [PATCH v2 1/1] net/mlx5: fix sharing context destroy
> order
>
> At the mlx5 device closing the shared IB context was destroyed before
> cleanup routines completion. As it was found on some setups (Netlink fails
> with old kernel drivers and we have to use sysfs to retrieve interface index,
> this requires IB device name, which is stored in shared context) the
> mlx5_nl_mac_addr_flush() requires IB device name, and if shared context is
> removed it causes the segmentation fault.
>
> Fixes: 17e19bc4dde7 ("net/mlx5: add IB shared context alloc/free functions")
>
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-04-08 6:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 14:14 [dpdk-dev] [PATCH 1/1] net/mlx5: fix sharing context destroy order Viacheslav Ovsiienko
2019-04-03 14:14 ` Viacheslav Ovsiienko
2019-04-05 13:29 ` [dpdk-dev] [PATCH v2 " Viacheslav Ovsiienko
2019-04-05 13:29 ` Viacheslav Ovsiienko
2019-04-08 6:00 ` Shahaf Shuler
2019-04-08 6:00 ` Shahaf Shuler
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).