DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/octeontx2: fix seg fault on running procinfo
@ 2020-05-25  8:51 Harman Kalra
  2020-06-26 14:41 ` Jerin Jacob
  0 siblings, 1 reply; 4+ messages in thread
From: Harman Kalra @ 2020-05-25  8:51 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram; +Cc: dev, Harman Kalra, stable

Segmentation fault has been observed while running procinfo
with reset options i.e. --stats-reset and --xstats-reset.
Reason is procinfo runs as a secondary process and tries to
hold a lock which is part of struct mdev, which was not
allocated as part of shared mememory.

Fixes: 5ca59711f771 ("common/octeontx2: add mailbox base support infra")
Cc: stable@dpdk.org

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/common/octeontx2/otx2_mbox.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_mbox.c b/drivers/common/octeontx2/otx2_mbox.c
index 2b7810929..6df1e8ea6 100644
--- a/drivers/common/octeontx2/otx2_mbox.c
+++ b/drivers/common/octeontx2/otx2_mbox.c
@@ -9,6 +9,7 @@
 
 #include <rte_atomic.h>
 #include <rte_cycles.h>
+#include <rte_malloc.h>
 
 #include "otx2_mbox.h"
 #include "otx2_dev.h"
@@ -36,7 +37,7 @@ otx2_mbox_fini(struct otx2_mbox *mbox)
 {
 	mbox->reg_base = 0;
 	mbox->hwbase = 0;
-	free(mbox->dev);
+	rte_free(mbox->dev);
 	mbox->dev = NULL;
 }
 
@@ -128,7 +129,9 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t reg_base,
 		return -ENODEV;
 	}
 
-	mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev));
+	mbox->dev = rte_zmalloc("mbox dev",
+				ndevs * sizeof(struct otx2_mbox_dev),
+				OTX2_ALIGN);
 	if (!mbox->dev) {
 		otx2_mbox_fini(mbox);
 		return -ENOMEM;
-- 
2.18.0


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

* Re: [dpdk-dev] [PATCH] net/octeontx2: fix seg fault on running procinfo
  2020-05-25  8:51 [dpdk-dev] [PATCH] net/octeontx2: fix seg fault on running procinfo Harman Kalra
@ 2020-06-26 14:41 ` Jerin Jacob
  2020-06-29 13:26   ` [dpdk-dev] [PATCH v2] common/octeontx2: " Harman Kalra
  0 siblings, 1 reply; 4+ messages in thread
From: Jerin Jacob @ 2020-06-26 14:41 UTC (permalink / raw)
  To: Harman Kalra; +Cc: Jerin Jacob, Nithin Dabilpuram, dpdk-dev, dpdk stable

On Mon, May 25, 2020 at 2:21 PM Harman Kalra <hkalra@marvell.com> wrote:
>
> Segmentation fault has been observed while running procinfo
> with reset options i.e. --stats-reset and --xstats-reset.
> Reason is procinfo runs as a secondary process and tries to
> hold a lock which is part of struct mdev, which was not
> allocated as part of shared mememory.

s/mememory/memory

please change the subject to "common/octeontx2"

>
> Fixes: 5ca59711f771 ("common/octeontx2: add mailbox base support infra")
> Cc: stable@dpdk.org
>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>
> ---
>  drivers/common/octeontx2/otx2_mbox.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/common/octeontx2/otx2_mbox.c b/drivers/common/octeontx2/otx2_mbox.c
> index 2b7810929..6df1e8ea6 100644
> --- a/drivers/common/octeontx2/otx2_mbox.c
> +++ b/drivers/common/octeontx2/otx2_mbox.c
> @@ -9,6 +9,7 @@
>
>  #include <rte_atomic.h>
>  #include <rte_cycles.h>
> +#include <rte_malloc.h>
>
>  #include "otx2_mbox.h"
>  #include "otx2_dev.h"
> @@ -36,7 +37,7 @@ otx2_mbox_fini(struct otx2_mbox *mbox)
>  {
>         mbox->reg_base = 0;
>         mbox->hwbase = 0;
> -       free(mbox->dev);
> +       rte_free(mbox->dev);
>         mbox->dev = NULL;
>  }
>
> @@ -128,7 +129,9 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t reg_base,
>                 return -ENODEV;
>         }
>
> -       mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev));
> +       mbox->dev = rte_zmalloc("mbox dev",
> +                               ndevs * sizeof(struct otx2_mbox_dev),
> +                               OTX2_ALIGN);
>         if (!mbox->dev) {
>                 otx2_mbox_fini(mbox);
>                 return -ENOMEM;
> --
> 2.18.0
>

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

* [dpdk-dev] [PATCH v2] common/octeontx2: fix seg fault on running procinfo
  2020-06-26 14:41 ` Jerin Jacob
@ 2020-06-29 13:26   ` Harman Kalra
  2020-06-30 10:44     ` Jerin Jacob
  0 siblings, 1 reply; 4+ messages in thread
From: Harman Kalra @ 2020-06-29 13:26 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram; +Cc: dev, Harman Kalra, stable

Segmentation fault has been observed while running procinfo
with reset options i.e. --stats-reset and --xstats-reset.
Reason is procinfo runs as a secondary process and tries to
hold a lock which is part of struct mdev, which was not
allocated as part of shared memory.

Fixes: 5ca59711f771 ("common/octeontx2: add mailbox base support infra")
Cc: stable@dpdk.org

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
*V2: Minor corrections in commit message.

 drivers/common/octeontx2/otx2_mbox.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_mbox.c b/drivers/common/octeontx2/otx2_mbox.c
index 2b7810929..6df1e8ea6 100644
--- a/drivers/common/octeontx2/otx2_mbox.c
+++ b/drivers/common/octeontx2/otx2_mbox.c
@@ -9,6 +9,7 @@
 
 #include <rte_atomic.h>
 #include <rte_cycles.h>
+#include <rte_malloc.h>
 
 #include "otx2_mbox.h"
 #include "otx2_dev.h"
@@ -36,7 +37,7 @@ otx2_mbox_fini(struct otx2_mbox *mbox)
 {
 	mbox->reg_base = 0;
 	mbox->hwbase = 0;
-	free(mbox->dev);
+	rte_free(mbox->dev);
 	mbox->dev = NULL;
 }
 
@@ -128,7 +129,9 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t reg_base,
 		return -ENODEV;
 	}
 
-	mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev));
+	mbox->dev = rte_zmalloc("mbox dev",
+				ndevs * sizeof(struct otx2_mbox_dev),
+				OTX2_ALIGN);
 	if (!mbox->dev) {
 		otx2_mbox_fini(mbox);
 		return -ENOMEM;
-- 
2.18.0


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

* Re: [dpdk-dev] [PATCH v2] common/octeontx2: fix seg fault on running procinfo
  2020-06-29 13:26   ` [dpdk-dev] [PATCH v2] common/octeontx2: " Harman Kalra
@ 2020-06-30 10:44     ` Jerin Jacob
  0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2020-06-30 10:44 UTC (permalink / raw)
  To: Harman Kalra, Thomas Monjalon
  Cc: Jerin Jacob, Nithin Dabilpuram, dpdk-dev, dpdk stable

On Mon, Jun 29, 2020 at 6:56 PM Harman Kalra <hkalra@marvell.com> wrote:
>
> Segmentation fault has been observed while running procinfo
> with reset options i.e. --stats-reset and --xstats-reset.
> Reason is procinfo runs as a secondary process and tries to
> hold a lock which is part of struct mdev, which was not
> allocated as part of shared memory.
>
> Fixes: 5ca59711f771 ("common/octeontx2: add mailbox base support infra")
> Cc: stable@dpdk.org
>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>

Delegated this patch to Thomas as it belongs to common/



> ---
> *V2: Minor corrections in commit message.
>
>  drivers/common/octeontx2/otx2_mbox.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/common/octeontx2/otx2_mbox.c b/drivers/common/octeontx2/otx2_mbox.c
> index 2b7810929..6df1e8ea6 100644
> --- a/drivers/common/octeontx2/otx2_mbox.c
> +++ b/drivers/common/octeontx2/otx2_mbox.c
> @@ -9,6 +9,7 @@
>
>  #include <rte_atomic.h>
>  #include <rte_cycles.h>
> +#include <rte_malloc.h>
>
>  #include "otx2_mbox.h"
>  #include "otx2_dev.h"
> @@ -36,7 +37,7 @@ otx2_mbox_fini(struct otx2_mbox *mbox)
>  {
>         mbox->reg_base = 0;
>         mbox->hwbase = 0;
> -       free(mbox->dev);
> +       rte_free(mbox->dev);
>         mbox->dev = NULL;
>  }
>
> @@ -128,7 +129,9 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t reg_base,
>                 return -ENODEV;
>         }
>
> -       mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev));
> +       mbox->dev = rte_zmalloc("mbox dev",
> +                               ndevs * sizeof(struct otx2_mbox_dev),
> +                               OTX2_ALIGN);
>         if (!mbox->dev) {
>                 otx2_mbox_fini(mbox);
>                 return -ENOMEM;
> --
> 2.18.0
>

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

end of thread, other threads:[~2020-06-30 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  8:51 [dpdk-dev] [PATCH] net/octeontx2: fix seg fault on running procinfo Harman Kalra
2020-06-26 14:41 ` Jerin Jacob
2020-06-29 13:26   ` [dpdk-dev] [PATCH v2] common/octeontx2: " Harman Kalra
2020-06-30 10:44     ` Jerin Jacob

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