All of lore.kernel.org
 help / color / mirror / Atom feed
* Dell XPS13 9360 - 1,000ms acpi_pm_finish()
@ 2017-11-29  6:06 Len Brown
  2017-11-29 14:34 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Len Brown @ 2017-11-29  6:06 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux acpi

Rafael,

Per our discussion...

As of Linux-4.14, acpi_pm_finish() takes over 1,000 ms on the Dell
XPS13.  This routine accounts for 50% of the total resume time of this
machine.

So I commented _WAK out of acpi_hw_legacy_wake(), and  that 1000ms
became 2ms.  (and the system also seemed to resume fine without _WAK,
though I didn't test it extensively)

So I effectively pre-pended acpi_pm_finish() to acpi_pm_end() with the
hack patch below, and that seems to work fine.

(Note that it seems that the relative ordering of enabling run-time
GPEs and invoking _WAK is already correct in acpi_hw_legacy_wake() --
the GPEs are enabled first.)

So the question becomes...  How early does _WAK really need to be?

thanks
Len Brown, Intel Open Source Technology Center

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8082871b409a..f25f1874cfaf 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -495,6 +495,8 @@ static void acpi_pm_start(u32 acpi_state)
  */
 static void acpi_pm_end(void)
 {
+       printk("lenb: acpi_pm_finish from within acpi_pm_end\n");
+       acpi_pm_finish();
        acpi_turn_off_unused_power_resources();
        acpi_scan_lock_release();
        /*
@@ -639,7 +641,6 @@ static const struct platform_suspend_ops
acpi_suspend_ops = {
        .begin = acpi_suspend_begin,
        .prepare_late = acpi_pm_prepare,
        .enter = acpi_suspend_enter,
-       .wake = acpi_pm_finish,
        .end = acpi_pm_end,
 };

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

* Re: Dell XPS13 9360 - 1,000ms acpi_pm_finish()
  2017-11-29  6:06 Dell XPS13 9360 - 1,000ms acpi_pm_finish() Len Brown
@ 2017-11-29 14:34 ` Rafael J. Wysocki
  2017-11-29 15:01   ` Zhang, Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2017-11-29 14:34 UTC (permalink / raw)
  To: Len Brown; +Cc: Rafael J. Wysocki, linux acpi

On Wed, Nov 29, 2017 at 7:06 AM, Len Brown <lenb@kernel.org> wrote:
> Rafael,
>
> Per our discussion...
>
> As of Linux-4.14, acpi_pm_finish() takes over 1,000 ms on the Dell
> XPS13.  This routine accounts for 50% of the total resume time of this
> machine.
>
> So I commented _WAK out of acpi_hw_legacy_wake(), and  that 1000ms
> became 2ms.  (and the system also seemed to resume fine without _WAK,
> though I didn't test it extensively)
>
> So I effectively pre-pended acpi_pm_finish() to acpi_pm_end() with the
> hack patch below, and that seems to work fine.
>
> (Note that it seems that the relative ordering of enabling run-time
> GPEs and invoking _WAK is already correct in acpi_hw_legacy_wake() --
> the GPEs are enabled first.)

The ordering is correct, but the GPEs should be enabled before the SCI
is enabled by resume_device_irqs().  Arguably, they may just be
enabled as soon as the kernel gets control back as the SCI won't
trigger anyway before resume_device_irqs().

> So the question becomes...  How early does _WAK really need to be?

On this system, apparently, it may go late in the resume path.  There
are systems on which moving it after the PCI resume introduced issues,
which is why the default ordering is what it is IIRC (but that was
bundled with the GPE stuff then, so there could be effects of that
too).

In any case, we may play with the ordering, but that's fragile.  Or we
can enable the EC polling just for the time of executing _WAK (which
should avoid the thermal issues on Lenovo and similar).

Thanks,
Rafael

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

* RE: Dell XPS13 9360 - 1,000ms acpi_pm_finish()
  2017-11-29 14:34 ` Rafael J. Wysocki
@ 2017-11-29 15:01   ` Zhang, Rui
  2017-11-29 16:11     ` Len Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Rui @ 2017-11-29 15:01 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Rafael J. Wysocki, linux acpi



> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> Sent: Wednesday, November 29, 2017 10:35 PM
> To: Len Brown <lenb@kernel.org>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>; linux acpi <linux-
> acpi@vger.kernel.org>
> Subject: Re: Dell XPS13 9360 - 1,000ms acpi_pm_finish()
> 
> On Wed, Nov 29, 2017 at 7:06 AM, Len Brown <lenb@kernel.org> wrote:
> > Rafael,
> >
> > Per our discussion...
> >
> > As of Linux-4.14, acpi_pm_finish() takes over 1,000 ms on the Dell
> > XPS13.  This routine accounts for 50% of the total resume time of this
> > machine.
> >
> > So I commented _WAK out of acpi_hw_legacy_wake(), and  that 1000ms
> > became 2ms.  (and the system also seemed to resume fine without _WAK,
> > though I didn't test it extensively)
> >
How long does acpi_pm_finish() take in 4.12 kernel?
It's good to know how much the reverted EC busy_polling mechanism can improve on this case.

Thanks,
rui
> > So I effectively pre-pended acpi_pm_finish() to acpi_pm_end() with the
> > hack patch below, and that seems to work fine.
> >
> > (Note that it seems that the relative ordering of enabling run-time
> > GPEs and invoking _WAK is already correct in acpi_hw_legacy_wake() --
> > the GPEs are enabled first.)
> 
> The ordering is correct, but the GPEs should be enabled before the SCI is
> enabled by resume_device_irqs().  Arguably, they may just be enabled as
> soon as the kernel gets control back as the SCI won't trigger anyway before
> resume_device_irqs().
> 
> > So the question becomes...  How early does _WAK really need to be?
> 
> On this system, apparently, it may go late in the resume path.  There are
> systems on which moving it after the PCI resume introduced issues, which is
> why the default ordering is what it is IIRC (but that was bundled with the GPE
> stuff then, so there could be effects of that too).
> 
> In any case, we may play with the ordering, but that's fragile.  Or we can
> enable the EC polling just for the time of executing _WAK (which should
> avoid the thermal issues on Lenovo and similar).
> 
> Thanks,
> Rafael
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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] 4+ messages in thread

* Re: Dell XPS13 9360 - 1,000ms acpi_pm_finish()
  2017-11-29 15:01   ` Zhang, Rui
@ 2017-11-29 16:11     ` Len Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2017-11-29 16:11 UTC (permalink / raw)
  To: Zhang, Rui; +Cc: Rafael J. Wysocki, Rafael J. Wysocki, linux acpi

> How long does acpi_pm_finish() take in 4.12 kernel?
> It's good to know how much the reverted EC busy_polling mechanism can improve on this case.

4.12.0 acpi_pm_finish() takes on the order of 40ms (it varies somewhat),
which is about the same speed as when this hack patch is applied.

This is compared to over 1,100ms in current 4.14.

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

end of thread, other threads:[~2017-11-29 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29  6:06 Dell XPS13 9360 - 1,000ms acpi_pm_finish() Len Brown
2017-11-29 14:34 ` Rafael J. Wysocki
2017-11-29 15:01   ` Zhang, Rui
2017-11-29 16:11     ` Len Brown

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.