DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Raslan Darawsheh <rasland@mellanox.com>
Cc: shahafs@mellanox.com, dev@dpdk.org, thomas@monjalon.net,
	ophirmu@mellanox.com
Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/mlx5: free eth dev port in case of error
Date: Mon, 7 May 2018 10:55:36 -0700	[thread overview]
Message-ID: <20180507175534.GA42287@yongseok-MBP.local> (raw)
In-Reply-To: <1525705833-8573-2-git-send-email-rasland@mellanox.com>

On Mon, May 07, 2018 at 06:10:33PM +0300, Raslan Darawsheh wrote:

Please refine the title. No use of 'eth dev...'

> If something went wrong in mlx5 pci prop need to free the eth_dev
> that was previously allocated during the port setup.

Shouldn't it be sent to stable branches if it is a bug?

> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> 
> ---
> v2 changes:
>  Reword the commit log.
> ---
> ---
>  drivers/net/mlx5/mlx5.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 3831e3d..bffe90f 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1063,6 +1063,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  			claim_zero(mlx5_glue->dealloc_pd(pd));
>  		if (ctx)
>  			claim_zero(mlx5_glue->close_device(ctx));
> +		if (eth_dev)
> +			rte_eth_dev_release_port(eth_dev);

I worry about the case where secondary process has some failure above. Secondary
process doesn't call rte_eth_dev_allocate() but rte_eth_dev_attach_secondary().
But, rte_eth_dev_release_port() clears the shared data,
	memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));

Then, the primary process will be malfunctioning. This seems a bug in the
rte_eth_dev_release_port(), 

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index e5605242d..20180146b 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -352,7 +352,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)

	eth_dev->state = RTE_ETH_DEV_UNUSED;

-       memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+               memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));

	rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);

Or _detach_secondary() may be necessary. You might want to talk to Thomas
because he is the maintainer of ethdev.

Thanks,
Yongseok

      reply	other threads:[~2018-05-07 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07 15:10 [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Raslan Darawsheh
2018-05-07 15:10 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: free eth dev port in case of error Raslan Darawsheh
2018-05-07 17:55   ` Yongseok Koh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180507175534.GA42287@yongseok-MBP.local \
    --to=yskoh@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=ophirmu@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).