From: Chaoyong He <chaoyong.he@corigine.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: oss-drivers <oss-drivers@corigine.com>,
"stable@dpdk.org" <stable@dpdk.org>,
Long Wu <Long.Wu@nephogine.com>,
Nole Zhang <peng.zhang@corigine.com>
Subject: RE: [PATCH 5/7] net/nfp: fix resource leak for exit of CoreNIC firmware
Date: Fri, 1 Dec 2023 10:03:24 +0000 [thread overview]
Message-ID: <SJ0PR13MB5545B91E1C6BE39BF98048F99E81A@SJ0PR13MB5545.namprd13.prod.outlook.com> (raw)
In-Reply-To: <bece2ddf-f8c0-42cf-9015-de6568ad0c7f@amd.com>
> On 12/1/2023 3:00 AM, Chaoyong He wrote:
> >> On 11/30/2023 8:52 AM, Chaoyong He wrote:
> >>> Fix the resource leak problem in the exit logic of CoreNIC firmware.
> >>>
> >>> Fixes: 646ea79ce481 ("net/nfp: move PF functions into its own file")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> >>> Reviewed-by: Long Wu <long.wu@corigine.com>
> >>> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> >>
> >> <...>
> >>
> >>> +static int
> >>> +nfp_pf_secondary_uninit(struct nfp_pf_dev *pf_dev) {
> >>> + free(pf_dev->sym_tbl);
> >>> + rte_free(pf_dev);
> >>> +
> >>> + return 0;
> >>> +}
> >>> +
> >>> /* Reset and stop device. The device can not be restarted. */
> >>> static int nfp_net_close(struct rte_eth_dev *dev) @@ -333,14
> >>> +381,25 @@ nfp_net_close(struct rte_eth_dev *dev)
> >>> struct rte_pci_device *pci_dev;
> >>> struct nfp_app_fw_nic *app_fw_nic;
> >>>
> >>> - if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> >>> - return 0;
> >>> -
> >>> hw = dev->data->dev_private;
> >>> pf_dev = hw->pf_dev;
> >>> pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> >>> app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv);
> >>>
> >>> + /*
> >>> + * In secondary process, a released eth device can be found by its
> >> name
> >>> + * in shared memory.
> >>> + * If the state of the eth device is RTE_ETH_DEV_UNUSED, it means the
> >>> + * eth device has been released.
> >>> + */
> >>> + if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> >>> + if (dev->state == RTE_ETH_DEV_UNUSED)
> >>> + return 0;
> >>> +
> >>> + nfp_pf_secondary_uninit(pf_dev);
> >>> + return 0;
> >>> + }
> >>> +
> >>>
> >>
> >> Mostly expectation is secondary process doesn't free shared
> >> resources, but init and free done by primary process.
> >
> > I agree.
> > Maybe the comment here make reader a little confused.
> > But the `nfp_pf_secondary_uninit()` does not free any shared resources, it
> only free two memory which private to each secondary process.
> >
>
> What freed is not process private, it is in the shared memory:
>
> hw = dev->data->dev_private;
> pf_dev = hw->pf_dev;
> rte_free(pf_dev);
>
>
> And when there are multiple secondaries, one of them frees `pf_dev`, how
> this is not effecting others that may use `pf_dev`?
Oh, I see what you mean now.
I will a v2 patch to fix this.
Thanks.
>
> >> When there are multiple secondaries active, and if one of them closes
> >> the port, will system behave properly? Can you please double check above
> logic?
> >
> > Yes, the system behave properly.
> >
next prev parent reply other threads:[~2023-12-01 10:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 8:52 [PATCH 0/7] fix resource leak problems Chaoyong He
2023-11-30 8:52 ` [PATCH 1/7] net/nfp: fix resource leak for device initialization Chaoyong He
2023-11-30 8:52 ` [PATCH 2/7] net/nfp: fix resource leak for CoreNIC firmware Chaoyong He
2023-11-30 8:52 ` [PATCH 3/7] net/nfp: fix resource leak for PF initialization Chaoyong He
2023-11-30 8:52 ` [PATCH 4/7] net/nfp: fix resource leak for flower firmware Chaoyong He
2023-11-30 8:52 ` [PATCH 5/7] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2023-11-30 11:00 ` Ferruh Yigit
2023-12-01 3:00 ` Chaoyong He
2023-12-01 9:41 ` Ferruh Yigit
2023-12-01 10:03 ` Chaoyong He [this message]
2023-11-30 8:52 ` [PATCH 6/7] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2023-11-30 8:52 ` [PATCH 7/7] net/nfp: fix resource leak for VF Chaoyong He
2023-12-04 1:57 ` [PATCH v2 0/8] fix resource leak problems Chaoyong He
2023-12-04 1:57 ` [PATCH v2 1/8] net/nfp: modify the process private data Chaoyong He
2023-12-04 1:57 ` [PATCH v2 2/8] net/nfp: fix resource leak for device initialization Chaoyong He
2023-12-04 1:57 ` [PATCH v2 3/8] net/nfp: fix resource leak for CoreNIC firmware Chaoyong He
2023-12-04 1:57 ` [PATCH v2 4/8] net/nfp: fix resource leak for PF initialization Chaoyong He
2023-12-04 1:57 ` [PATCH v2 5/8] net/nfp: fix resource leak for flower firmware Chaoyong He
2023-12-04 1:57 ` [PATCH v2 6/8] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2023-12-04 1:57 ` [PATCH v2 7/8] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2023-12-04 1:57 ` [PATCH v2 8/8] net/nfp: fix resource leak for VF Chaoyong He
2023-12-04 12:22 ` [PATCH v2 0/8] fix resource leak problems Ferruh Yigit
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=SJ0PR13MB5545B91E1C6BE39BF98048F99E81A@SJ0PR13MB5545.namprd13.prod.outlook.com \
--to=chaoyong.he@corigine.com \
--cc=Long.Wu@nephogine.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
--cc=stable@dpdk.org \
/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).