Received: by 10.213.65.68 with SMTP id h4csp190106imn; Fri, 30 Mar 2018 03:44:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+gpprvBwVuddwreY/UUY1XSRs0KL3rETbLtJ5pVR8SJ2p6NaVWPgMhRvD/DpiEeE4a9Pba X-Received: by 2002:a17:902:850c:: with SMTP id bj12-v6mr12607527plb.110.1522406692584; Fri, 30 Mar 2018 03:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522406692; cv=none; d=google.com; s=arc-20160816; b=tdUf0ECw6NvHd3KAV7KwlsWD8BCVHTayMqGGk2ZDCojfFsp6Nqo9Sf9duKT3hQazpM cEkEq//WjUKArKzna5A5n6cdhvfBVyCOXUK6fShxYkcNRAiSb/Djb9NM+GnGHHjqRJt4 tiHMuYnxEpoQNHJhZkiGY8QZX4eu4opGMv/x7KL2y66sYT+GEN36rKsvh9oZIXQHyA/7 KKDymCDMndCcIMSKHPhiB+uKGSkN4AmoeO89kUBXl0jHO/jWgFrKZomBwsXZZZDNQSNr axCZ5IvKWJ9NDszFpft8wSoN5VIv/C03WRNq5EPHKJcXUzzQ1773IxpUzTZzDdgcGDZf HD+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=g8SsIhiv6SrRDfOpLvbfDCRFftYi7r7b3SmTz/Tp+BI=; b=pW/Ga9nDYGaDa4y4zEkUc6DlXDXmbu3tiJe39MtvERVGBDbJKWZSTk5Xfho+PWFmOa lIkMq+U2S+HoxnqqS4Q3oeDyQYXz2YVMwJJhBMRV09ZOM1IFhaUy84NDq8uuZai1RBtI //giL3E9nxrQdFXvIKA0uQUPC17brLHKe7mf5GEW0vOT3+L7QP8iTjqksC8UvXHe/3nr WwosjLQ1Ie+jgbVVL17zS9kHOAMQp9p0Huq0dY2Iic7d+X/nl7SXpg2VxklDdy7W2e9s IY2ErxckVgRoNHw67wvquHi5Xi0YVB11FWryteeP/D4QEGDZcjB42GYetkdrtF2x7cUZ sg9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=k1Rrzc5q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si5425981pgn.781.2018.03.30.03.44.37; Fri, 30 Mar 2018 03:44:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=k1Rrzc5q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751247AbeC3KnY (ORCPT + 99 others); Fri, 30 Mar 2018 06:43:24 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:52000 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbeC3KnX (ORCPT ); Fri, 30 Mar 2018 06:43:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=g8SsIhiv6SrRDfOpLvbfDCRFftYi7r7b3SmTz/Tp+BI=; b=k1Rrzc5qFfykBXWBkKqMMW5DfMaYyFnrn0jBvB8jElkY4B0y9jgEqEpoIHBfzcV6btUKluGgNK5Dmg8gorjJ2dR3z2CafC5wtXMdeZJvTUPdO/WqgUdSjGrfkUaX+W8EsPcyp64NlbM35iQtSnCZugWAGMdfVdWa7CVwMWqMkLQ=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:39334) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1f1rV6-0004dB-7H; Fri, 30 Mar 2018 11:43:16 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1f1rV4-0008Fs-4G; Fri, 30 Mar 2018 11:43:14 +0100 Date: Fri, 30 Mar 2018 11:43:13 +0100 From: Russell King - ARM Linux To: Jisheng Zhang Cc: David Miller , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/2] net: mvneta: improve suspend/resume Message-ID: <20180330104312.GH16141@n2100.armlinux.org.uk> References: <20180330183332.3e180a1a@xhacker.debian> <20180330183615.6b34d153@xhacker.debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180330183615.6b34d153@xhacker.debian> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 30, 2018 at 06:36:15PM +0800, Jisheng Zhang wrote: > Current suspend/resume implementation reuses the mvneta_open() and > mvneta_close(), but it could be optimized to take only necessary > actions during suspend/resume. > > One obvious problem of current implementation is: after hundreds of > system suspend/resume cycles, the resume of mvneta could fail due to > fragmented dma coherent memory. After this patch, the non-necessary > memory alloc/free is optimized out. I don't think you've properly tested this. Please ensure that you test patches with the appropriate debug options enabled. > @@ -4586,16 +4586,43 @@ static int mvneta_remove(struct platform_device *pdev) > #ifdef CONFIG_PM_SLEEP > static int mvneta_suspend(struct device *device) > { > + int queue; > struct net_device *dev = dev_get_drvdata(device); > struct mvneta_port *pp = netdev_priv(dev); > > - rtnl_lock(); > - if (netif_running(dev)) > - mvneta_stop(dev); > - rtnl_unlock(); ... > + mvneta_stop_dev(pp); You're removing the rtnl_lock() that I introduced in 3b8bc67413de ("net: mvneta: ensure PM paths take the rtnl lock") which is necessary to provide phylink with consistent locking. mvneta_stop_dev() calls phylink_stop() which will check that the rtnl lock is held, and will print a warning if it isn't. Your patch will cause a regression here. > + > + for (queue = 0; queue < rxq_number; queue++) { > + struct mvneta_rx_queue *rxq = &pp->rxqs[queue]; > + > + mvneta_rxq_drop_pkts(pp, rxq); > + } > + > + for (queue = 0; queue < txq_number; queue++) { > + struct mvneta_tx_queue *txq = &pp->txqs[queue]; > + > + mvneta_txq_hw_deinit(pp, txq); > + } > + > +clean_exit: > netif_device_detach(dev); > clk_disable_unprepare(pp->clk_bus); > clk_disable_unprepare(pp->clk); > + > return 0; > } > > @@ -4604,7 +4631,7 @@ static int mvneta_resume(struct device *device) > struct platform_device *pdev = to_platform_device(device); > struct net_device *dev = dev_get_drvdata(device); > struct mvneta_port *pp = netdev_priv(dev); > - int err; > + int err, queue; > > clk_prepare_enable(pp->clk); > if (!IS_ERR(pp->clk_bus)) > @@ -4626,12 +4653,36 @@ static int mvneta_resume(struct device *device) > } > > netif_device_attach(dev); > - rtnl_lock(); > - if (netif_running(dev)) { > - mvneta_open(dev); > - mvneta_set_rx_mode(dev); ... > } > - rtnl_unlock(); ... > + mvneta_start_dev(pp); Same applies here. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up