linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-04 20:28 Bjørn Mork
  0 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2018-02-04 20:28 UTC (permalink / raw)
  To: Greg KH
  Cc: Markus Demleitner, Lv Zheng, Rafael J. Wysocki, Andreas Lindhe,
	Gjorgji Jankovski, Damjan Georgievski, Fernando Chaves,
	Tomislav Ivek, Denis P., All applicable, linux-usb

Greg KH <gregkh@linuxfoundation.org> 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@mork.no>
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@mork.no>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-05 10:55 Rafael J. Wysocki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2018-02-05 10:55 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Greg KH, Markus Demleitner, Lv Zheng, Andreas Lindhe,
	Gjorgji Jankovski, Damjan Georgievski, Fernando Chaves,
	Tomislav Ivek, Denis P., All applicable, linux-usb,
	linux-acpi@vger.kernel.org

On 2/4/2018 9:28 PM, Bjørn Mork wrote:
> Greg KH <gregkh@linuxfoundation.org> 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?

I don't think so, the macro is needed too.

I'll queue up a full revert of 662591461c4b9a1e3b.

Thanks,
Rafael
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-05 14:14 Bjørn Mork
  0 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2018-02-05 14:14 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Greg KH, Markus Demleitner, Lv Zheng, Andreas Lindhe,
	Gjorgji Jankovski, Damjan Georgievski, Fernando Chaves,
	Tomislav Ivek, Denis P., All applicable, linux-usb,
	linux-acpi@vger.kernel.org

"Rafael J. Wysocki" <rafael.j.wysocki@intel.com> writes:
> On 2/4/2018 9:28 PM, Bjørn Mork wrote:
>
>> But I do wonder if the attached (completely untested!!) patch makes
>> things any better?
>
> I don't think so, the macro is needed too.

Doh! Obviously.  Don't know how I managed to miss that.

> I'll queue up a full revert of 662591461c4b9a1e3b.

Still with the additional exception for "ec == first_ec"?



Bjørn
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-05 17:06 Rafael J. Wysocki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2018-02-05 17:06 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Greg KH, Markus Demleitner, Lv Zheng, Andreas Lindhe,
	Gjorgji Jankovski, Damjan Georgievski, Fernando Chaves,
	Tomislav Ivek, Denis P., All applicable, linux-usb,
	linux-acpi@vger.kernel.org

On 2/5/2018 3:14 PM, Bjørn Mork wrote:
> "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> writes:
>> On 2/4/2018 9:28 PM, Bjørn Mork wrote:
>>
>>> But I do wonder if the attached (completely untested!!) patch makes
>>> things any better?
>> I don't think so, the macro is needed too.
> Doh! Obviously.  Don't know how I managed to miss that.
>
>> I'll queue up a full revert of 662591461c4b9a1e3b.
> Still with the additional exception for "ec == first_ec"?
>

No, just a full revert for now.

The above can be fixed on top of that.

Thanks,
Rafael
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-07 22:44 Rafael J. Wysocki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2018-02-07 22:44 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Bjørn Mork, Greg KH, Markus Demleitner, Lv Zheng,
	Andreas Lindhe, Gjorgji Jankovski, Damjan Georgievski,
	Fernando Chaves, Tomislav Ivek, Denis P., All applicable,
	open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:,
	linux-acpi@vger.kernel.org

On Mon, Feb 5, 2018 at 6:06 PM, Rafael J. Wysocki
<rafael.j.wysocki@intel.com> wrote:
> On 2/5/2018 3:14 PM, Bjørn Mork wrote:
>>
>> "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> writes:
>>>
>>> On 2/4/2018 9:28 PM, Bjørn Mork wrote:
>>>
>>>> But I do wonder if the attached (completely untested!!) patch makes
>>>> things any better?
>>>
>>> I don't think so, the macro is needed too.
>>
>> Doh! Obviously.  Don't know how I managed to miss that.
>>
>>> I'll queue up a full revert of 662591461c4b9a1e3b.
>>
>> Still with the additional exception for "ec == first_ec"?
>>
>
> No, just a full revert for now.

That doesn't work, because we made some changes on top of this commit.

I'll send a patch to try tomorrow.

Thanks,
Rafael
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-09 13:43 Markus Demleitner
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Demleitner @ 2018-02-09 13:43 UTC (permalink / raw)
  To: linux-acpi, linux-usb

On Thu, Feb 08, 2018 at 08:12:06PM +0100, Rafael J. Wysocki wrote:
> On Wednesday, February 7, 2018 11:44:15 PM CET Rafael J. Wysocki wrote:
> > On Mon, Feb 5, 2018 at 6:06 PM, Rafael J. Wysocki
> > <rafael.j.wysocki@intel.com> wrote:
> > > On 2/5/2018 3:14 PM, Bjørn Mork wrote:
> > >>
> > >> "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> writes:
> > >>>
> > >>> On 2/4/2018 9:28 PM, Bjørn Mork wrote:
> > >>>
> > >>>> But I do wonder if the attached (completely untested!!) patch makes
> > >>>> things any better?
> > >>>
> > >>> I don't think so, the macro is needed too.
> > >>
> > >> Doh! Obviously.  Don't know how I managed to miss that.
> > >>
> > >>> I'll queue up a full revert of 662591461c4b9a1e3b.
> > >>
> > >> Still with the additional exception for "ec == first_ec"?
> > >>
> > >
> > > No, just a full revert for now.
> > 
> > That doesn't work, because we made some changes on top of this commit.
> > 
> > I'll send a patch to try tomorrow.
> 
> Below is a patch for the mainline (should be applicable to 4.15.y) to test.
> Please let me know if it improves things for you.

It pretty certainly does (patch applied on top of 4.15.0 from
tarball).  Five out of five wakeup cycles were fast, and the cell
modem is still properly initialised -- the message went out via the
resumed modem.

Thanks!

     -- Markus

[patch retained for reference:]

> 
> The corresponding fix for -stable would still be a full revert of
> 662591461c4b9a1e3b, but it needs to be fixed in the mainline first.
> 
> ---
>  drivers/acpi/ec.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> Index: linux-pm/drivers/acpi/ec.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/ec.c
> +++ linux-pm/drivers/acpi/ec.c
> @@ -1927,6 +1927,9 @@ static int acpi_ec_suspend_noirq(struct
>  	    ec->reference_count >= 1)
>  		acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
>  
> +	if (acpi_sleep_no_ec_events())
> +		acpi_ec_enter_noirq(ec);
> +
>  	return 0;
>  }
>  
> @@ -1934,6 +1937,9 @@ static int acpi_ec_resume_noirq(struct d
>  {
>  	struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev));
>  
> +	if (acpi_sleep_no_ec_events())
> +		acpi_ec_leave_noirq(ec);
> +
>  	if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) &&
>  	    ec->reference_count >= 1)
>  		acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+
@ 2018-02-09 21:26 Rafael J. Wysocki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2018-02-09 21:26 UTC (permalink / raw)
  To: Markus Demleitner
  Cc: ACPI Devel Maling List, open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:

On Fri, Feb 9, 2018 at 2:43 PM, Markus Demleitner <m@tfiu.de> wrote:
> On Thu, Feb 08, 2018 at 08:12:06PM +0100, Rafael J. Wysocki wrote:
>> On Wednesday, February 7, 2018 11:44:15 PM CET Rafael J. Wysocki wrote:
>> > On Mon, Feb 5, 2018 at 6:06 PM, Rafael J. Wysocki
>> > <rafael.j.wysocki@intel.com> wrote:
>> > > On 2/5/2018 3:14 PM, Bjørn Mork wrote:
>> > >>
>> > >> "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> writes:
>> > >>>
>> > >>> On 2/4/2018 9:28 PM, Bjørn Mork wrote:
>> > >>>
>> > >>>> But I do wonder if the attached (completely untested!!) patch makes
>> > >>>> things any better?
>> > >>>
>> > >>> I don't think so, the macro is needed too.
>> > >>
>> > >> Doh! Obviously.  Don't know how I managed to miss that.
>> > >>
>> > >>> I'll queue up a full revert of 662591461c4b9a1e3b.
>> > >>
>> > >> Still with the additional exception for "ec == first_ec"?
>> > >>
>> > >
>> > > No, just a full revert for now.
>> >
>> > That doesn't work, because we made some changes on top of this commit.
>> >
>> > I'll send a patch to try tomorrow.
>>
>> Below is a patch for the mainline (should be applicable to 4.15.y) to test.
>> Please let me know if it improves things for you.
>
> It pretty certainly does (patch applied on top of 4.15.0 from
> tarball).  Five out of five wakeup cycles were fast, and the cell
> modem is still properly initialised -- the message went out via the
> resumed modem.

OK, let's do it, then.

Thanks for testing!
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-09 21:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-05 17:06 [Bug,197863] Thinkpad X240 resume dramatically slower on kernels 4.13+ Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2018-02-09 21:26 Rafael J. Wysocki
2018-02-09 13:43 Markus Demleitner
2018-02-07 22:44 Rafael J. Wysocki
2018-02-05 14:14 Bjørn Mork
2018-02-05 10:55 Rafael J. Wysocki
2018-02-04 20:28 Bjørn Mork

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