From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: Re: [PATCH (net.git)] stmmac: fix resource management when resume
Date: Fri, 4 Dec 2015 08:28:42 +0100 [thread overview]
Message-ID: <566140AA.1030005@st.com> (raw)
In-Reply-To: <1449210066-30336-1-git-send-email-peppe.cavallaro@st.com>
Hi David
This is the v2, sorry I missed it in the subject.
Re-based on top of net.git.
peppe
On 12/4/2015 7:21 AM, Giuseppe Cavallaro wrote:
> There is a memleak when suspend/resume this driver version.
> Currently the stmmac, during resume step, reallocates all the resources
> but they are not released when suspend.
> The patch is not to release these resources but the logic has been changed.
> In fact, it is not necessary to free and reallocate all from scratch
> because the memory data will be always preserved.
> As final solution, the patch just reinit the descriptors and the rx/tx
> pointers only when resume. Tested done on STi boxes.
>
> Reported-by: ZhengShunQian <zhengsq@rock-chips.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 3c6549a..a5b869e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3046,8 +3046,6 @@ int stmmac_suspend(struct net_device *ndev)
> priv->hw->dma->stop_tx(priv->ioaddr);
> priv->hw->dma->stop_rx(priv->ioaddr);
>
> - stmmac_clear_descriptors(priv);
> -
> /* Enable Power down mode by programming the PMT regs */
> if (device_may_wakeup(priv->device)) {
> priv->hw->mac->pmt(priv->hw, priv->wolopts);
> @@ -3105,7 +3103,12 @@ int stmmac_resume(struct net_device *ndev)
>
> netif_device_attach(ndev);
>
> - init_dma_desc_rings(ndev, GFP_ATOMIC);
> + priv->cur_rx = 0;
> + priv->dirty_rx = 0;
> + priv->dirty_tx = 0;
> + priv->cur_tx = 0;
> + stmmac_clear_descriptors(priv);
> +
> stmmac_hw_setup(ndev, false);
> stmmac_init_tx_coalesce(priv);
> stmmac_set_rx_mode(ndev);
>
next prev parent reply other threads:[~2015-12-04 7:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 6:21 [PATCH (net.git)] stmmac: fix resource management when resume Giuseppe Cavallaro
2015-12-04 7:28 ` Giuseppe CAVALLARO [this message]
2015-12-05 22:49 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2015-11-22 8:44 [RFC PATCH v1] Trying to fix the stmmac memory leak during suspend/resume Shunqian Zheng
2015-11-26 10:32 ` [PATCH (net.git)] stmmac: fix resource management when resume Giuseppe Cavallaro
2015-11-30 19:54 ` David Miller
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=566140AA.1030005@st.com \
--to=peppe.cavallaro@st.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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).