DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: probb@iol.unh.edu, Thomas Monjalon <thomas@monjalon.net>,
	 Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	 Anatoly Burakov <anatoly.burakov@intel.com>
Subject: Re: [PATCH 2/2] ethdev: cleanup shared data with the last port
Date: Fri, 18 Aug 2023 13:36:10 +0200	[thread overview]
Message-ID: <CAJFAV8y64xu_8KGkut0tDOBS4=1iz7U6wyVg4Pvb5=HeF=CEhw@mail.gmail.com> (raw)
In-Reply-To: <20230818091321.2404089-3-david.marchand@redhat.com>

On Fri, Aug 18, 2023 at 11:13 AM David Marchand
<david.marchand@redhat.com> wrote:
> @@ -253,6 +255,10 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
>                 rte_free(eth_dev->data->dev_private);
>                 pthread_mutex_destroy(&eth_dev->data->flow_ops_mutex);
>                 memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));

At device cleanup stage (rte_eal_cleanup -> bus -> device),
eth_dev_allocated() may still be called and use a leftover reference
to (freed) data.
So here, we need to reset it to NULL (caught by ASan with test-null.sh
in the CI).

This will be in v2.


> +
> +               eth_dev_shared_data->allocated_count--;
> +               if (eth_dev_shared_data->allocated_count == 0)
> +                       eth_dev_shared_data_release();
>         }
>
>         rte_spinlock_unlock(rte_mcfg_ethdev_get_lock());


-- 
David Marchand


  reply	other threads:[~2023-08-18 11:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18  9:13 [PATCH 0/2] Release ethdev shared memory on port cleanup David Marchand
2023-08-18  9:13 ` [PATCH 1/2] ethdev: protect shared memory accesses under one lock David Marchand
2023-08-18  9:13 ` [PATCH 2/2] ethdev: cleanup shared data with the last port David Marchand
2023-08-18 11:36   ` David Marchand [this message]
2023-08-18 10:18 ` [PATCH 0/2] Release ethdev shared memory on port cleanup Morten Brørup
2023-08-31 15:34   ` Thomas Monjalon
2023-08-18 13:41 ` [PATCH v2 " David Marchand
2023-08-18 13:41   ` [PATCH v2 1/2] ethdev: protect shared memory accesses under one lock David Marchand
2023-08-18 13:41   ` [PATCH v2 2/2] ethdev: cleanup shared data with the last port David Marchand
2023-08-21  8:58 ` [PATCH v3 0/3] Release ethdev shared memory on port cleanup David Marchand
2023-08-21  8:58   ` [PATCH v3 1/3] ethdev: protect shared memory accesses under one lock David Marchand
2023-08-21  8:58   ` [PATCH v3 2/3] ethdev: avoid panicking in absence of ethdev shared data David Marchand
2023-08-21  8:58   ` [PATCH v3 3/3] ethdev: cleanup shared data with the last port David Marchand
2023-08-31 16:05   ` [PATCH v3 0/3] Release ethdev shared memory on port cleanup Thomas Monjalon
2023-09-01  7:32     ` David Marchand
2023-09-27 11:45 ` [PATCH v4 " David Marchand
2023-09-27 11:45   ` [PATCH v4 1/3] ethdev: protect shared memory accesses under one lock David Marchand
2023-09-27 11:45   ` [PATCH v4 2/3] ethdev: avoid panicking in absence of ethdev shared data David Marchand
2023-09-27 11:45   ` [PATCH v4 3/3] ethdev: cleanup shared data with the last port David Marchand
2023-10-11 12:53   ` [PATCH v4 0/3] Release ethdev shared memory on port cleanup Thomas Monjalon

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='CAJFAV8y64xu_8KGkut0tDOBS4=1iz7U6wyVg4Pvb5=HeF=CEhw@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=probb@iol.unh.edu \
    --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).