Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752755AbdFTBNL (ORCPT ); Mon, 19 Jun 2017 21:13:11 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:33753 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665AbdFTBNJ (ORCPT ); Mon, 19 Jun 2017 21:13:09 -0400 MIME-Version: 1.0 In-Reply-To: References: <1979543.KIEJ8uyRaT@aspire.rjw.lan> <3454366.uzaJljlWGm@aspire.rjw.lan> <3689795.xuIczRHZsl@aspire.rjw.lan> <2026371.DVJN39QYJi@aspire.rjw.lan> From: "Rafael J. Wysocki" Date: Tue, 20 Jun 2017 03:13:07 +0200 X-Google-Sender-Auth: x38eGqgdUmPoC7DbXhaXkm1VK3M Message-ID: Subject: Re: [PATCH v2 3/3] ACPI / sleep: EC-based wakeup from suspend-to-idle on recent Dell systems To: Linus Torvalds Cc: "Rafael J. Wysocki" , Linux PM , Linux ACPI , Andy Shevchenko , Darren Hart , LKML , Srinivas Pandruvada , Mika Westerberg , Mario Limonciello , Tom Lanyon , =?UTF-8?B?SsOpcsO0bWUgZGUgQnJldGFnbmU=?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2021 Lines: 47 On Tue, Jun 20, 2017 at 2:07 AM, Linus Torvalds wrote: > On Tue, Jun 20, 2017 at 5:53 AM, Rafael J. Wysocki wrote: >> >> -> v2: Added acpi_sleep=no_ec_wakeup to prevent EC events from waking up >> the system from s2idle on systems where they do that by default. > > This seems a big hacky. > > Is there no way to simply make acpi_ec_suspend() smarter while going > to sleep? Instead of just unconditionally disabling every EC GPE, can > we see that "this gpe is the power botton" somehow? Unfortunately, the connection between the GPE and the power button is not direct. The EC GPE handler has no idea that it will generate power button events. It simply executes an AML method doing that. The AML method, in turn, executes Notify(power button device) and the "power button device" driver has to register a notify handler that will recognize and process the events. It doesn't know in principle where the events will come from, though. They may come from the EC or from a different GPE etc. Neither the EC driver, nor the "power button device" driver can figure out that the connection is there. > Disabling the power button event sounds fundamentally broken, and it > sounds like Windows doesn't do that. I doubt Windows has some hacky > whitelist. So I'd rather fix a deeper issue than have these kinds of > hacks, if at all possible. My understanding is that Windows uses the ACPI_FADT_LOW_POWER_S0 flag. It generally enables non-S3 suspend/resume when this flag is set and it doesn't touch S3 then. Keeping the EC GPE (and other GPEs for that matter) enabled over suspend/resume is part of that if my understanding is correct. During suspend we generally disable all GPEs that are not expected to generate wakeup events in order to avoid spurious wakeups, but we can try to keep them enabled if ACPI_FADT_LOW_POWER_S0 is set. That will reduce the ugliness, but the cost may be more energy used while suspended on some systems. Thanks, Rafael