Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754093AbbKYPNs (ORCPT ); Wed, 25 Nov 2015 10:13:48 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:57637 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591AbbKYPNq (ORCPT ); Wed, 25 Nov 2015 10:13:46 -0500 Message-ID: <5655D004.4040502@st.com> Date: Wed, 25 Nov 2015 16:13:08 +0100 From: Giuseppe CAVALLARO User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: David Miller , CC: , , , Subject: Re: [PATCH v1] net: stmmac: Free rx_skbufs before realloc References: <1448181858-5935-1-git-send-email-zhengsq@rock-chips.com> <1448181858-5935-2-git-send-email-zhengsq@rock-chips.com> <20151124.130924.1365382562223060152.davem@davemloft.net> In-Reply-To: <20151124.130924.1365382562223060152.davem@davemloft.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.139.52] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.15.21,1.0.33,0.0.0000 definitions=2015-11-25_11:2015-11-24,2015-11-25,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1563 Lines: 46 Hello On 11/24/2015 7:09 PM, David Miller wrote: > From: Shunqian Zheng > Date: Sun, 22 Nov 2015 16:44:18 +0800 > >> From: ZhengShunQian >> >> The init_dma_desc_rings() may realloc the rx_skbuff[] when >> suspend and resume. This patch free the rx_skbuff[] before >> reallocing memory. >> >> Signed-off-by: ZhengShunQian > > This isn't really the right way to fix this. > > I see two reasonable approaches: > > 1) suspend liberates the RX ring, although this approach is less > desirable > > 2) resume doesn't try to allocate already populated RX ring > entries > > Freeing the whole RX ring just to allocate it again immediately > makes no sense at all and is wasteful work. This is a bug in this driver version that, to be honest, we fixed with the first approach on STi kernel. The patch just called the dma_free_rx_skbufs(priv) in the suspend. I can give you this patch that is tested on my side too. But! I do think we should move on second approach. Indeed, also on ST platforms, when we play with suspend states the DDR although in self-refresh the data are not lost at all. No reason to free and reallocate all in suspend/resume. I can test that and then provide another patch to this mailing list asap. Let me know. peppe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/