Re: [Bug 197863] Thinkpad X240 resume dramatically slower on kernels 4.13+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> writes:
> On Sat, Feb 03, 2018 at 07:25:54PM +0100, Markus Demleitner wrote:
>
>> It's 662591461c4b9a1e3b9b159dbf37648a585ebaae.  To my eyes, it even
>> looks plausible that it's causing the problematic behaviour, but
>> since I can't say I understand what I'd be doing if I dabbled with
>> the change, I've refrained from guessing how to fix it.
>> 
>> I'm happy to try patches, though.
>
> Ok, thanks.  I've added the authors of this patch to the email here,
> perhaps they have an idea of what is going on?

This thing made me curious enough to dive into code I don't understand,
as I have experienced the annoying crazy fan behaviour in resume a few
times on my X1 Carbon 4th gen.

Maybe I missed something, but it looks like commit

 c3a696b6e8f8 ("ACPI / EC: Use busy polling mode when GPE is not enabled")

introduced suspend/resume busy polling for the "boot EC" unintentionally?

The patch moved acpi_ec_leave_noirq() and acpi_ec_leave_noirq()
functions outside the #ifdef CONFIG_PM_SLEEP, so they could be reused
while installing handlers.  But when doing that the

       if (ec == first_ec)

conditions on suspend/resume were silently dropped.  I assume the
intention might have been to move those intto acpi_ec_suspend_noirq()
and acpi_ec_resume_noirq() instead? But that didn't happen AFAICS.

Or did I misunderstand this completely?  Not unlikely given that I have
zero clue about what this code is doing...

But I do wonder if the attached (completely untested!!) patch makes
things any better?


Bjørn

>From 82b8f437a243854a3f1d3c82f85520fd2b788881 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@xxxxxxx>
Date: Sun, 4 Feb 2018 21:15:36 +0100
Subject: [PATCH] Revert "ACPI / EC: Drop EC noirq hooks to fix a regression"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 662591461c4b9a1e3b9b159dbf37648a585ebaae
and re-introduce the conditions dropped by commit c3a696b6e8f8
("ACPI / EC: Use busy polling mode when GPE is not enabled")

Fixes: c3a696b6e8f8 ("ACPI / EC: Use busy polling mode when GPE is not enabled")
Signed-off-by: Bjørn Mork <bjorn@xxxxxxx>
---
 drivers/acpi/ec.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d9f38c645e4a..24a772f66847 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1905,6 +1905,26 @@ int __init acpi_ec_ecdt_probe(void)
 }
 
 #ifdef CONFIG_PM_SLEEP
+static int acpi_ec_suspend_noirq(struct device *dev)
+{
+	struct acpi_ec *ec =
+		acpi_driver_data(to_acpi_device(dev));
+
+	if (ec == first_ec)
+		acpi_ec_enter_noirq(ec);
+	return 0;
+}
+
+static int acpi_ec_resume_noirq(struct device *dev)
+{
+	struct acpi_ec *ec =
+		acpi_driver_data(to_acpi_device(dev));
+
+	if (ec == first_ec)
+		acpi_ec_leave_noirq(ec);
+	return 0;
+}
+
 static int acpi_ec_suspend(struct device *dev)
 {
 	struct acpi_ec *ec =
-- 
2.11.0


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux