Bug 200691

Summary: [Regression] STR: System resumes/wakes up immediately after *first* suspend on ASRock E350M1
Product: ACPI Reporter: Paul Menzel (pmenzel+bugzilla.kernel.org)
Component: Power-Sleep-WakeAssignee: acpi_power-sleep-wake
Status: CLOSED CODE_FIX    
Severity: normal CC: hramrach, pmenzel+bugzilla.kernel.org, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.18-rc7+ Subsystem:
Regression: No Bisected commit-id:

Description Paul Menzel 2018-07-31 12:01:33 UTC
Commit v4.16-rc2-9-g18996f2db918 (18996f2db9186cbabe3a7e7085bfb80408b32755) below introduced a regression on the ASRock E350M1. The system resumes/wakes up immediately after the *first* suspend.

Bisecting results in the commit as the first bad commit.

18996f2db9186cbabe3a7e7085bfb80408b32755 is the first bad commit
commit 18996f2db9186cbabe3a7e7085bfb80408b32755
Author: Erik Schmauss <erik.schmauss@intel.com>
Date:   Wed Mar 14 16:12:57 2018 -0700

    ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume

    Unconditionally clearing ACPI IRQs during suspend/resume can lead to
    unexpected IRQ losts. This patch fixes this issue by removing such IRQ
    clearing code.

    If this patch triggers regression, the regression should be in the GPE
    handlers that cannot correctly determine some spurious triggered events as
    no-ops. Please report any regression related to this commit to the ACPI
    component on kernel bugzilla. Lv Zheng.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=196249
    Signed-off-by: Lv Zheng <lv.zheng@intel.com>
    Reported-and-tested-by: Eric Bakula-Davis <ericbakuladavis@gmail.com>
    Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

As asked for in the commit message, I am reporting this regression.

Here is the bisect log.

```
$ git bisect log
# bad: [d3cda2337bbc9edd2a26b83cb00eaa8c048ff274] mm/page_alloc: don't reserve ZONE_HIGHMEM for ZONE_MOVABLE request
# good: [0adb32858b0bddf4ada5f364a84ed60b196dbcda] Linux 4.16
git bisect start 'HEAD' 'v4.16'
# bad: [94514bbe9e5c402c4232af158a295a8fdfd72a2c] Merge tag 'for-4.17-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
git bisect bad 94514bbe9e5c402c4232af158a295a8fdfd72a2c
# bad: [77624cd2a7783fccf2c518768a6fd7a7aeccd002] Merge tag 'pinctrl-v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
git bisect bad 77624cd2a7783fccf2c518768a6fd7a7aeccd002
# good: [78230c46ec0a91dd4256c9e54934b3c7095a7ee3] Merge tag 'omapdrm-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next
git bisect good 78230c46ec0a91dd4256c9e54934b3c7095a7ee3
# good: [986b37c0ae4f0a3f93d8974d03a9cbc1502dd377] Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 986b37c0ae4f0a3f93d8974d03a9cbc1502dd377
# good: [642e7fd23353e22290e3d51719fcb658dc252342] Merge branch 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux
git bisect good 642e7fd23353e22290e3d51719fcb658dc252342
# bad: [75dcc7ef952af106c1b7051daa591b566632fd30] Merge tag 'spi-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
git bisect bad 75dcc7ef952af106c1b7051daa591b566632fd30
# bad: [f2d285669aae656dfeafa0bf25e86bbbc5d22329] Merge tag 'pm-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
git bisect bad f2d285669aae656dfeafa0bf25e86bbbc5d22329
# good: [a9f36db7ec653ddeba81ba43d56103eab1ab912a] Merge branch 'pm-cpufreq'
git bisect good a9f36db7ec653ddeba81ba43d56103eab1ab912a
# bad: [ae02168d7877daf3a8ffcc60237a64398ed943aa] Merge branch 'acpica'
git bisect bad ae02168d7877daf3a8ffcc60237a64398ed943aa
# bad: [87cd826b5979d91d4f2ba189e0652820f2da417f] ACPICA: Events: Dispatch GPEs after enabling for the first time
git bisect bad 87cd826b5979d91d4f2ba189e0652820f2da417f
# good: [5a8361f7ecceaed64b4064000d16cb703462be49] ACPICA: Integrate package handling with module-level code
git bisect good 5a8361f7ecceaed64b4064000d16cb703462be49
# good: [97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c] ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
git bisect good 97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c
# bad: [8d5934952f26c25431dbc21aa8ae7614bb8f88c3] ACPICA: Events: Add parallel GPE handling support to fix potential redundant _Exx evaluations
git bisect bad 8d5934952f26c25431dbc21aa8ae7614bb8f88c3
# bad: [18996f2db9186cbabe3a7e7085bfb80408b32755] ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume
git bisect bad 18996f2db9186cbabe3a7e7085bfb80408b32755
# first bad commit: [18996f2db9186cbabe3a7e7085bfb80408b32755] ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume
```
Comment 1 Paul Menzel 2018-08-10 08:29:06 UTC
Note, the issue also happens with the vendor firmware.

There is a patch on the list [1], which I’ll try over the weekend.

[1]: https://marc.info/?l=linux-acpi&m=153388828527640&w=2
Comment 2 Zhang Rui 2018-08-20 08:21:57 UTC
*** Bug 200841 has been marked as a duplicate of this bug. ***
Comment 3 Michal Suchanek 2018-08-22 11:12:36 UTC
The below patch works for me

https://patchwork.kernel.org/patch/10563631/ ACPICA: Clear status of all events when entering sleep states
Comment 4 Zhang Rui 2018-08-29 07:02:07 UTC
patch has been shipped in 4.19-rc1, bug closed