All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baorui.Liu <baorliu@amd.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>
Cc: Len Brown <lenb@kernel.org>,
	Robert Moore <robert.moore@intel.com>,
	<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<acpica-devel@lists.linuxfoundation.org>,
	kernel test robot <lkp@intel.com>,
	"Baorui . Liu" <baorliu@amd.com>
Subject: Re: [PATCH v5] ACPI: button: Report wakeup key only for power button wakeups
Date: Fri, 30 Oct 2026 21:27:40 +0800	[thread overview]
Message-ID: <20261030132740.459-1-baorliu@amd.com> (raw)
In-Reply-To: <CAJZ5v0h_136ACZzxQ=MdvRx_7iYRu3L3z1tY01ONfkSz5JEXzw@mail.gmail.com>

Hi Rafael,

Thank you for pointing me at the Sashiko review. I went through the four
findings and agree with all of them. I have prepared a v6 on current
linux-pm/linux-next that addresses them as follows.

1) High: sleep-in-atomic in acpi_suspend_enter()
I agree. acpi_button_power_wakeup_pending() reached
acpi_get_first_physical_node(), which takes a mutex, while
acpi_suspend_enter() runs with IRQs disabled.

In v6, that early path no longer calls into the button driver. It only
sets plain flags in sleep.c: the existing pwr_btn_event_pending for
acpi_pm_finish()'s pm_wakeup_event(), plus pwr_btn_wakeup_pending for
KEY_WAKEUP. The button driver consumes the latter from resume via
acpi_sleep_pwr_btn_wakeup_pending().

2) Medium: IS_REACHABLE stub drops KEY_WAKEUP when CONFIG_ACPI_BUTTON=m
I agree this was a real functional hole. The v5 IS_REACHABLE() stub fixed
the LKP link error, but with a modular button driver the built-in call
site became a no-op after clearing the fixed power-button status bit.

Keeping the flag in built-in sleep.c and exporting a consumer for
button.ko fixes both the link issue and the modular KEY_WAKEUP loss. The
IS_REACHABLE stub is removed. The sleep.c flag uses WRITE_ONCE/READ_ONCE.

3) Medium: missing compiler barrier between the two stores in suspend
I agree. v6 uses WRITE_ONCE()/barrier()/READ_ONCE() around
wakeup_pending and suspended in acpi_button_suspend(). The same store
ordering is used when clearing them in resume: suspended is cleared
before wakeup_pending, with a barrier() between the two WRITE_ONCE()s.

4) Medium: race between clearing suspended and a late ACPI notify
I agree. v6 calls acpi_os_wait_events_complete() first so queued notifies
still observe suspended == true. It then samples the pending state and
reports KEY_WAKEUP before clearing suspended, so a notify that arrives
after sampling cannot set wakeup_pending only to have it dropped with
neither KEY_WAKEUP nor KEY_POWER. After KEY_WAKEUP, suspended is cleared
before wakeup_pending (with barrier()) so a new SCI takes the normal
KEY_POWER path.

I will send v6 shortly unless you prefer a different approach on any of
these points.

Thanks,
Baorui

  reply	other threads:[~2026-10-30 13:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 12:27 [PATCH] ACPI: button: Report wakeup key only for power button wakeups Baorui Liu
2026-08-07 14:12 ` Rafael J. Wysocki (Intel)
2026-08-19  8:55 ` [PATCH v2 0/1] " Baorui.Liu
2026-08-19  8:55   ` [PATCH v2 1/1] " Baorui.Liu
2026-09-09 14:41     ` Rafael J. Wysocki (Intel)
2026-09-17 14:31     ` [PATCH v3] " Baorui.Liu
2026-09-18 14:36       ` Rafael J. Wysocki (Intel)
2026-09-22  2:23         ` Baorui.Liu
2026-09-22  2:42       ` [PATCH v4] " Baorui.Liu
2026-10-12  6:08         ` [PATCH v5] " Baorui.Liu
2026-10-12 18:19           ` Rafael J. Wysocki (Intel)
2026-10-30 13:27             ` Baorui.Liu [this message]
2026-11-02  9:10           ` [PATCH v6] " Baorui.Liu
2026-11-02 17:14             ` kernel test robot
2026-11-02 21:47             ` kernel test robot
2026-11-09  8:27             ` [PATCH v7] " Baorui.Liu
2026-11-09  8:28             ` Baorui.Liu
2026-11-09 21:12               ` kernel test robot
2026-11-17  7:17               ` [PATCH v8] " Baorui.Liu
2026-11-20 13:56                 ` Rafael J. Wysocki (Intel)
2026-11-23  9:02                   ` Baorui.Liu
2026-08-20  7:07 ` [PATCH] " kernel test robot

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=20261030132740.459-1-baorliu@amd.com \
    --to=baorliu@amd.com \
    --cc=acpica-devel@lists.linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=rafael@kernel.org \
    --cc=robert.moore@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.