archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <>
To: "Rafael J. Wysocki" <>
Cc: Linux ACPI <>,
	LKML <>,
	Linux PM <>,
	Linux PCI <>,
	"Rafael J. Wysocki" <>,
	Bjorn Helgaas <>,
	Kai-Heng Feng <>
Subject: Re: [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()
Date: Wed, 25 Nov 2020 10:06:59 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <2261308.G18gbxz5ee@kreacher>

On Tue, Nov 24, 2020 at 08:44:00PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <>
> The idea behind acpi_pm_set_bridge_wakeup() was to allow bridges to
> be reference counted for wakeup enabling, because they may be enabled
> to signal wakeup on behalf of their subordinate devices and that
> may happen for multiple times in a row, whereas for the other devices
> it only makes sense to enable wakeup signaling once.
> However, this becomes problematic if the bridge itself is suspended,
> because it is treated as a "regular" device in that case and the
> reference counting doesn't work.
> For instance, suppose that there are two devices below a bridge and
> they both can signal wakeup.  Every time one of them is suspended,
> wakeup signaling is enabled for the bridge, so when they both have
> been suspended, the bridge's wakeup reference counter value is 2.
> Say that the bridge is suspended subsequently and acpi_pci_wakeup()
> is called for it.  Because the bridge can signal wakeup, that
> function will invoke acpi_pm_set_device_wakeup() to configure it
> and __acpi_pm_set_device_wakeup() will be called with the last
> argument equal to 1.  This causes __acpi_device_wakeup_enable()
> invoked by it to omit the reference counting, because the reference
> counter of the target device (the bridge) is 2 at that time.
> Now say that the bridge resumes and one of the device below it
> resumes too, so the bridge's reference counter becomes 0 and
> wakeup signaling is disabled for it, but there is still the other
> suspended device which may need the bridge to signal wakeup on its
> behalf and that is not going to work.
> To address this scenario, use wakeup enable reference counting for
> all devices, not just for bridges, so drop the last argument from
> __acpi_device_wakeup_enable() and __acpi_pm_set_device_wakeup(),
> which causes acpi_pm_set_device_wakeup() and
> acpi_pm_set_bridge_wakeup() to become identical, so drop the latter
> and use the former instead of it everywhere.
> Signed-off-by: Rafael J. Wysocki <>

Reviewed-by: Mika Westerberg <>

  reply	other threads:[~2020-11-25  8:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 19:41 [PATCH v1 0/2] PM: ACPI: PCI: Address issues related to signaling wakeup from bridges Rafael J. Wysocki
2020-11-24 19:44 ` [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() Rafael J. Wysocki
2020-11-25  8:06   ` Mika Westerberg [this message]
2020-12-04 23:21   ` Bjorn Helgaas
2020-11-24 19:46 ` [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time Rafael J. Wysocki
2020-11-25  8:09   ` Mika Westerberg

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).