Skip to contentSkip to conversation

octeontx2-pf: Fix resource leakage in VF driver unbind

PATCH Applied Hariprasad Kelam 4 participants 6 messages Jan 9, 2023 – Jan 10, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 octeontx2-pf: Fix resource leakage in VF driver unbind

resources allocated like mcam entries to support the Ntuple feature and hash tables for the tc feature are not getting freed in driver unbind. This patch fixes the issue.

Fixes 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +2 -0
index 86653bb8e403..7f8ffbf79cf7 100644
@@ -758,6 +758,8 @@ static void otx2vf_remove(struct pci_dev *pdev)
 	if (vf->otx2_wq)
 		destroy_workqueue(vf->otx2_wq);
 	otx2_ptp_destroy(vf);
+	otx2_mcam_flow_del(vf);
+	otx2_shutdown_tc(vf);
 	otx2vf_disable_mbox_intr(vf);
 	otx2_detach_resources(&vf->mbox);
 	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
Signature · 1 line
2.17.1
#1 lore raw
Quoted 3 lines · Hariprasad Kelam

resources allocated like mcam entries to support the Ntuple feature and hash tables for the tc feature are not getting freed in driver unbind. This patch fixes the issue.

It is not clear where in otx2vf_probe() these resource are allocated. Please add the stack trace to the commit message.

Thanks

Quoted 24 lines
Fixes 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +2 -0
index 86653bb8e403..7f8ffbf79cf7 100644
@@ -758,6 +758,8 @@ static void otx2vf_remove(struct pci_dev *pdev)
 	if (vf->otx2_wq)
 		destroy_workqueue(vf->otx2_wq);
 	otx2_ptp_destroy(vf);
+	otx2_mcam_flow_del(vf);
+	otx2_shutdown_tc(vf);
 	otx2vf_disable_mbox_intr(vf);
 	otx2_detach_resources(&vf->mbox);
 	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
Signature · 1 line
2.17.1
#2 lore raw
In reply to Hariprasad Kelam
This patch was applied to netdev/net.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Mon, 9 Jan 2023 11:43:25 +0530 you wrote:

resources allocated like mcam entries to support the Ntuple feature and hash tables for the tc feature are not getting freed in driver unbind. This patch fixes the issue.

Fixes 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")

[...]

Here is the summary with links:
- [net] octeontx2-pf: Fix resource leakage in VF driver unbind

    https://git.kernel.org/netdev/net/c/53da7aec3298

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
Quoted 14 lines · On Tue, Jan 10, 2023 at 10:20:15AM +0000, [email protected]…

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Mon, 9 Jan 2023 11:43:25 +0530 you wrote:

resources allocated like mcam entries to support the Ntuple feature and hash tables for the tc feature are not getting freed in driver unbind. This patch fixes the issue.

Fixes 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")
Quoted 5 lines
Quoted 1 line

[...]

Here is the summary with links:
- [net] octeontx2-pf: Fix resource leakage in VF driver unbind

    https://git.kernel.org/netdev/net/c/53da7aec3298

Paolo,

I don't think that this patch should be applied.

It looks like wrong Fixes to me and I don't see clearly how structures were allocated on VF which were cleared in this patch.

Thanks

Quoted 7 lines

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer
#4 lore raw

Hello,

Quoted 17 lines · Leon Romanovsky
Quoted 16 lines · On Tue, Jan 10, 2023 at 10:20:15AM +0000, [email protected]…

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Mon, 9 Jan 2023 11:43:25 +0530 you wrote:

resources allocated like mcam entries to support the Ntuple feature and hash tables for the tc feature are not getting freed in driver unbind. This patch fixes the issue.

Fixes 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")

[...]

Quoted 8 lines
Quoted 3 lines

Here is the summary with links:
- [net] octeontx2-pf: Fix resource leakage in VF driver unbind

    https://git.kernel.org/netdev/net/c/53da7aec3298

I don't think that this patch should be applied.

It looks like wrong Fixes to me and I don't see clearly how structures were allocated on VF which were cleared in this patch.

My understanding is that the resource allocation happens via:

otx2_dl_mcam_count_set()

which is registered as the devlink parameter write operation on the vf by the fixes commit - the patch looks legit to me.

Did I miss something?

Thanks!

Paolo

#5 lore raw
Quoted 29 lines · Paolo Abeni

Hello,

Quoted 17 lines · Leon Romanovsky
Quoted 16 lines · On Tue, Jan 10, 2023 at 10:20:15AM +0000, [email protected]…

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Mon, 9 Jan 2023 11:43:25 +0530 you wrote:

resources allocated like mcam entries to support the Ntuple feature and hash tables for the tc feature are not getting freed in driver unbind. This patch fixes the issue.

Fixes 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")

[...]

Quoted 8 lines
Quoted 3 lines

Here is the summary with links:
- [net] octeontx2-pf: Fix resource leakage in VF driver unbind

    https://git.kernel.org/netdev/net/c/53da7aec3298

I don't think that this patch should be applied.

It looks like wrong Fixes to me and I don't see clearly how structures were allocated on VF which were cleared in this patch.

Quoted 8 lines

My understanding is that the resource allocation happens via:

otx2_dl_mcam_count_set()

which is registered as the devlink parameter write operation on the vf by the fixes commit - the patch looks legit to me.

Did I miss something?

No, you are right. I'm not sure if I would be able to see that OTX2_FLAG_MCAM_ENTRIES_ALLOC flag without your hint.

Thanks