All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: e1000-devel@lists.sourceforge.net, linux-pci@vger.kernel.org,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v2 6/7] PCI/PM: warn about incomplete actions in ->runtime_suspend() callback
Date: Mon, 04 Feb 2013 21:22:03 +0100	[thread overview]
Message-ID: <2146717.YNnkIQ37Mr@vostro.rjw.lan> (raw)
In-Reply-To: <20130204115612.5569.49895.stgit@zurg>

On Monday, February 04, 2013 03:56:12 PM Konstantin Khlebnikov wrote:
> Documentation/power/pci.txt says:
> | It is expected that the device driver's pm->runtime_suspend() callback will
> | not attempt to prepare the device for signaling wakeup or to put it into a
> | low-power state.  The driver ought to leave these tasks to the PCI subsystem
> | that has all of the information necessary to perform them.
> 
> After commit 42eca2302146fed51335b95128e949ee6f54478f
> ("PCI: Don't touch card regs after runtime suspend D3")
> | If the driver takes care of state saving, don't touch any registers on it.
> pci_pm_runtime_suspend() thinks if state has been saved by ->runtime_suspend()
> that means device alredy prepared for wakeup and probably no longer accessible.
> 
> Thus driver must either do all actions or leave all these tasks to PCI subsystem.

I don't like this one, because it will generate noise for drivers that
legitimately use pci_save_state() in their runtime suspend callbacks
and know what they are doing.

Thanks,
Rafael


> Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: linux-pci@vger.kernel.org
> ---
>  drivers/pci/pci-driver.c |   15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index f9aa311..2b0ff9a 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1009,12 +1009,19 @@ static int pci_pm_runtime_suspend(struct device *dev)
>  		return 0;
>  	}
>  
> -	if (!pci_dev->state_saved) {
> -		pci_save_state(pci_dev);
> -		pci_finish_runtime_suspend(pci_dev);
> +	if (pci_dev->state_saved) {
> +		WARN_ONCE(pci_dev->current_state == prev,
> +			"PCI PM: Power state of device not changed by %pF\n",
> +			pm->runtime_suspend);
> +		WARN_ONCE(pci_dev_run_wake(pci_dev) &&
> +				!pci_dev->wakeup_prepared,
> +			"PCI PM: Waking of device not configured by %pF\n",
> +			pm->runtime_suspend);
> +		return 0;
>  	}
>  
> -	return 0;
> +	pci_save_state(pci_dev);
> +	return pci_finish_runtime_suspend(pci_dev);
>  }
>  
>  static int pci_pm_runtime_resume(struct device *dev)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-02-04 20:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 11:55 [PATCH v2 0/7] pci/e1000e: return runtime-pm back to work Konstantin Khlebnikov
2013-02-04 11:55 ` [PATCH v2 1/7] e1000e: fix pci-device enable-counter balance Konstantin Khlebnikov
2013-02-04 11:55 ` [PATCH v2 2/7] PCI: don't touch enable_cnt in pci_device_shutdown() Konstantin Khlebnikov
2013-02-04 22:20   ` Khalid Aziz
2013-02-04 23:13     ` Bjorn Helgaas
2013-02-05 15:28       ` Khalid Aziz
2013-02-05 19:22         ` Bjorn Helgaas
2013-02-06  0:21           ` Khalid Aziz
2013-02-04 11:56 ` [PATCH v2 3/7] PCI: catch enable-counter underflows Konstantin Khlebnikov
2013-02-04 11:56 ` [PATCH v2 4/7] PCI/PM: clear state_saved during suspend Konstantin Khlebnikov
2013-02-04 11:56 ` [PATCH v2 5/7] e1000e: fix runtime power management transitions Konstantin Khlebnikov
2013-02-04 11:56 ` [PATCH v2 6/7] PCI/PM: warn about incomplete actions in ->runtime_suspend() callback Konstantin Khlebnikov
2013-02-04 20:22   ` Rafael J. Wysocki [this message]
2013-02-04 20:57     ` Konstantin Khlebnikov
2013-02-04 11:56 ` [PATCH v2 7/7] e1000e: fix accessing to suspended device Konstantin Khlebnikov
2013-02-04 20:23 ` [PATCH v2 0/7] pci/e1000e: return runtime-pm back to work Rafael J. Wysocki
2013-02-12  0:34   ` Bjorn Helgaas
2013-02-12  0:43     ` Bjorn Helgaas
2013-02-12 20:27       ` Rafael J. Wysocki

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=2146717.YNnkIQ37Mr@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=bhelgaas@google.com \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=khlebnikov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.