linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Kenneth R. Crudup" <kenny@panix.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: Help me fix a regression caused by 56b9918490 (PM: sleep: Simplify suspend-to-idle control flow)
Date: Tue, 26 Nov 2019 17:12:32 +0100	[thread overview]
Message-ID: <CAJZ5v0jbU3ikuju-oV6Y0g0f_F44w-3bkfvBZTFT8tUPycC69w@mail.gmail.com> (raw)
In-Reply-To: <CAJZ5v0jR8OQVOniR++NJeDukDn9Bgp+DZtvmSCF_d0pH1LDr6w@mail.gmail.com>

On Tue, Nov 26, 2019 at 9:50 AM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Tue, Nov 26, 2019 at 12:32 AM Kenneth R. Crudup <kenny@panix.com> wrote:
> >
> >
> > On Mon, 25 Nov 2019, Rafael J. Wysocki wrote:
> >
> > > It looks like the platform has problems with switching power between
> > > AC and battery while suspended.  Also this appears to be related to the EC.
> >
> > That being said, I always keep a stock kernel on this machine (latest is Kubuntu
> > vmlinuz-5.0.0-35-generic) and the failure mode isn't reproducible on that. I'm
> > still wondering what's substantially different between the versions.
> >
> > BTW, I've got breaking it down to a science now:
> >
> > - Let the battery drain pretty well down (< ~80%)
> > - Boot the kernel I wish to test, while still on battery
> > - Intiate a suspend/resume, which will come back OK
> > - Initiate another suspend
> > - Plug in the charger. If I have my power meter in, I see it do the PD
> >   negotiation (it'll start off at 20V/150mA, then it'll PD ramp up to
> >   a full 2.5-2.75A @20v to charge the battery)
> > - Try to resume. It'll be totally dead and I have to long-power-button
> >   to get it back
> >
> > - If I have "ec_no_wakeup=1" set, then the first time it seems to resume
> >   OK from the procedure above, then I'll wait about two minutes then
> >   flip the laptop around a bunch (apparently getting the accelerometer
> >   involved, which I guess happens during a car ride) which can also
> >   trigger the hard hangup when I plug it in before suspending
> >
> > > Also I'm wondering if the problem is reproducible with ec_no_wakeup
> > > and the last patch I posted applied.
> >
> > With the stock -rc kernel, I used to be able to work around this issue with
> > "ec_no_wakeup=1", but sometimes the battery would drain while "suspended"
> > far higher than idle at random.
> >
> > With the second patchset (the introduction of acpi_s2idle_sync()) the
> > *second* resume while the battery is charging locks it up hard.
> >
> > > But with that patch applied, please try to comment out the
> > > acpi_s2idle_sync() in acpi_s2idle_wake() and retest.
> >
> > So get this- I took it out of acpi_s2idle_wake() and left it in acpi_s2idle_restore() ;
> > when I do this, I get the issue where it seems to no longer care about the
> > charging state, BUT it is back to responding to charger events (i.e., it won't
> > go to sleep as long as it's plugged in, and "ec_no_wakeup=1" has no effect on this.
> >
> > It also turns out that it doesn't apparently matter if I remove the call of acpi_s2idle_sync()
> > from either of acpi_s2idle_wake() or acpi_s2idle_restore() but I get the behavior above.
> > I took a shot in the dark and commented out the call to acpi_ec_flush_work() in acpi_s2idle_sync()
> > and left the calls to acpi_s2idle_sync() in both _wake and _restore and also get this
> > behavior, which to me implies that whatever is in the acpi_ec_flush_work() call (and I
> > looked at it, but didn't go any further) is where it's hanging up.
>
> It doesn't have to be like that.
>
> What acpi_ec_flush_work() does it to process the EC events received so
> far and they may trigger notifications that are processed
> subsequently.  The next acpi_os_wait_events_complete() is there to
> wait for that processing to finish.
>
> It looks like it hangs somewhere in the platform firmware, but it is
> hard to say where exactly.
>
> > I can put WARN_ON(cond)
> > calls in places that'll write to EFI pstore, if you think that would be useful.
> >
> > As this workaround does at least (so far, anyway) keep the machine from going off into
> > a black hole,
>
> So to be precise you mean commenting out acpi_ec_flush_work() in
> acpi_s2idle_sync() with the
>
> https://lore.kernel.org/linux-pm/alpine.DEB.2.21.1911220920500.24730@hp-x360n/T/#m199e175157c9cddf48fdee16681f6c2f0549a364
>
> patch applied?
>
> And does the power button/lid wakeup work without that?
>
> > I'm willing to live with it until/as we find a workaround that gets it
> > right; even though it'll be somewhat annoying to not go to sleep when charged AND
> > automatically wake up on power connection/disconnection events (can those be filtered
> > out of /proc/acpi/wakeup_sources ? Nothing looked obvious) at least I have a laptop
> > when I need it.
>
> There should be a way to filter them out.
>
> From the above it looks like this happens with "ec_no_wakeup=1" too,
> is that correct?
>
> > Can you think of any other strategy to try (and I'm all ears at this point; this
> > kind of breakage- while almost certainly that something in this HP BIOS/ACPI
> > is doing wrong, should be properly worked around for the rest of us poor suckers
> > who got these devices so I'm willing to help either fix it,
>
> It's rather that the platform firmware has expectations that we don't
> know about.
>
> Yes, it should be possible to diagnose it further with some extra work.

To that end, please send me the output of dmidecode and acpidump from
your laptop.

  reply	other threads:[~2019-11-26 16:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  0:11 Help me fix a regression caused by 56b9918490 (PM: sleep: Simplify suspend-to-idle control flow) Kenneth R. Crudup
2019-11-22 10:12 ` Rafael J. Wysocki
2019-11-22 12:45   ` Rafael J. Wysocki
2019-11-22 17:35     ` Kenneth R. Crudup
2019-11-23 10:24     ` Kenneth R. Crudup
2019-11-24 16:02       ` Rafael J. Wysocki
2019-11-25  3:40         ` Kenneth R. Crudup
2019-11-25 13:27           ` Rafael J. Wysocki
2019-11-25 14:14             ` Rafael J. Wysocki
2019-11-25 18:27               ` Kenneth R. Crudup
2019-11-25 20:11                 ` Kenneth R. Crudup
2019-11-25 20:19                   ` Kenneth R. Crudup
2019-11-25 22:01                   ` Rafael J. Wysocki
2019-11-25 23:32                     ` Kenneth R. Crudup
2019-11-26  8:50                       ` Rafael J. Wysocki
2019-11-26 16:12                         ` Rafael J. Wysocki [this message]
2019-11-26 16:15                         ` Kenneth R. Crudup
2019-11-26 16:27                           ` Rafael J. Wysocki
2019-11-26 16:35                             ` Kenneth R. Crudup
2019-11-26 18:48                               ` Rafael J. Wysocki
2019-11-26 19:03                                 ` Kenneth R. Crudup
2019-11-26 19:09                                   ` Rafael J. Wysocki
2019-11-26 19:13                                     ` Kenneth R. Crudup
2019-11-26 19:45                                     ` Kenneth R. Crudup
2019-11-26 23:56                                     ` Kenneth R. Crudup
2019-11-27  2:35                                       ` Kenneth R. Crudup
2019-11-27  8:31                                         ` Rafael J. Wysocki
2019-11-27 22:30                                           ` Kenneth R. Crudup
2019-11-28 16:25                                             ` Rafael J. Wysocki
2019-11-25 21:47                 ` Rafael J. Wysocki
2019-11-25 16:21             ` Kenneth R. Crudup
2019-11-25 21:46               ` Rafael J. Wysocki
2019-11-25 23:02                 ` Kenneth R. Crudup
2019-11-26  8:53                   ` Rafael J. Wysocki
2019-11-25  5:50         ` Kenneth R. Crudup
2019-11-25  7:17           ` Kenneth R. Crudup
2019-11-22 17:29   ` Kenneth R. Crudup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJZ5v0jbU3ikuju-oV6Y0g0f_F44w-3bkfvBZTFT8tUPycC69w@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=kenny@panix.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).