netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net,
	Akeem G Abodunrin <akeem.g.abodunrin@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jeffrey.t.kirsher@intel.com,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Andrew Bowers <andrewx.bowers@intel.com>
Subject: Re: [net-next 04/15] ice: Add advanced power mgmt for WoL
Date: Thu, 7 Aug 2025 08:20:46 +0200	[thread overview]
Message-ID: <aJRFvuh8F-jQd0rz@wunner.de> (raw)
In-Reply-To: <20200723234720.1547308-5-anthony.l.nguyen@intel.com>

On Thu, Jul 23, 2020 at 04:47:09PM -0700, Tony Nguyen wrote:
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> Add callbacks needed to support advanced power management for Wake on LAN.
> Also make ice_pf_state_is_nominal function available for all configurations
> not just CONFIG_PCI_IOV.

The above was applied as commit 769c500dcc1e.

> +static int ice_resume(struct device *dev)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +	enum ice_reset_req reset_type;
> +	struct ice_pf *pf;
> +	struct ice_hw *hw;
> +	int ret;
> +
> +	pci_set_power_state(pdev, PCI_D0);
> +	pci_restore_state(pdev);
> +	pci_save_state(pdev);
> +
> +	if (!pci_device_is_present(pdev))
> +		return -ENODEV;
> +
> +	ret = pci_enable_device_mem(pdev);
> +	if (ret) {
> +		dev_err(dev, "Cannot enable device after suspend\n");
> +		return ret;
> +	}

You're calling pci_enable_device_mem() on resume without having called
pci_disable_device() on suspend.  This leads to an imbalance of the
enable_cnt kept internally in the PCI core.

Every time you suspend, the enable_cnt keeps growing.

The user-visible effect is that if you suspend the device at least once
and then unbind the driver, pci_disable_device() isn't called because
the enable_cnt hasn't reached zero (and will never reach it again).

I recommend removing the call to pci_enable_device_mem() in ice_resume():
The call to pci_restore_state() should already be sufficient to set the
Memory Space bit in the Command register again on resume.

I cannot test this for lack of hardware but can provide a patch if you
want me to.

Thanks,

Lukas

  reply	other threads:[~2025-08-07  6:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 23:47 [net-next 00/15][pull request] 100GbE Intel Wired LAN Driver Updates 2020-07-23 Tony Nguyen
2020-07-23 23:47 ` [net-next 01/15] ice: refactor ice_discover_caps to avoid need to retry Tony Nguyen
2020-07-23 23:47 ` [net-next 02/15] ice: split ice_parse_caps into separate functions Tony Nguyen
2020-07-23 23:47 ` [net-next 03/15] ice: split ice_discover_caps into two functions Tony Nguyen
2020-07-23 23:47 ` [net-next 04/15] ice: Add advanced power mgmt for WoL Tony Nguyen
2025-08-07  6:20   ` Lukas Wunner [this message]
2025-08-07 18:21     ` Tony Nguyen
2020-07-23 23:47 ` [net-next 05/15] ice: refactor FC functions Tony Nguyen
2020-07-23 23:47 ` [net-next 06/15] ice: move auto FEC checks into ice_cfg_phy_fec() Tony Nguyen
2020-07-23 23:47 ` [net-next 07/15] ice: restore PHY settings on media insertion Tony Nguyen
2020-07-23 23:47 ` [net-next 08/15] ice: add link lenient and default override support Tony Nguyen
2020-07-23 23:47 ` [net-next 09/15] ice: support Total Port Shutdown on devices that support it Tony Nguyen
2020-07-23 23:47 ` [net-next 10/15] ice: add ice_aq_get_phy_caps() debug logs Tony Nguyen
2020-07-23 23:47 ` [net-next 11/15] ice: update reporting of autoneg capabilities Tony Nguyen
2020-07-23 23:47 ` [net-next 12/15] ice: Rename low_power_ctrl Tony Nguyen
2020-07-23 23:47 ` [net-next 13/15] ice: add AQC get link topology handle support Tony Nguyen
2020-07-23 23:47 ` [net-next 14/15] ice: Report AOC PHY Types as Fiber Tony Nguyen
2020-07-23 23:47 ` [net-next 15/15] ice: add 1G SGMII PHY type Tony Nguyen
2020-07-24  0:07   ` Stillwell Jr, Paul M
2020-07-24 23:39 ` [net-next 00/15][pull request] 100GbE Intel Wired LAN Driver Updates 2020-07-23 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=aJRFvuh8F-jQd0rz@wunner.de \
    --to=lukas@wunner.de \
    --cc=akeem.g.abodunrin@intel.com \
    --cc=andrewx.bowers@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /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).