Bug 261207 - framework laptop occasionally hangs during suspend to S3
Summary: framework laptop occasionally hangs during suspend to S3
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
: 255745 (view as bug list)
Depends on:
Blocks: frameworklaptop
  Show dependency treegraph
 
Reported: 2022-01-14 19:44 UTC by Mark Johnston
Modified: 2022-03-24 15:43 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Johnston freebsd_committer freebsd_triage 2022-01-14 19:44:29 UTC
My framework laptop can suspend/resume without problems most of the time, though resume takes a long time (~10s, maybe related to some nvme time messages that I see).  Suspend occasionally hangs.  When this happens, the display stays on, and I see a number of messages of the form

  hdac0: Unexpected unsolicited response from address 0: 00000000

These messages don't appear when suspend succeeds.  After that, some other devices detach, and the system hangs (can't switch to other vtys, no network, etc.).  It responds to keyboard input and I can scroll in the terminal but DDB prints output very slowly.  All CPUs are idle, but by inserting print statements I can see that the hang occurred somewhere in DEVICE_SUSPEND(root_bus).

I haven't been able to reproduce this problem if I manually detach hdac0 before suspending.
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2022-01-14 19:46:24 UTC
> All CPUs are idle

Oops, I lied.  There is an ithread executing hdac_intr_handler() when the system is hung.
Comment 2 Andriy Gapon freebsd_committer freebsd_triage 2022-01-15 11:32:24 UTC
This reminded me of base r342170.
I am not sure if there is any relation, but it perhaps there is a problem of a similar nature.
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2022-01-31 21:09:21 UTC
https://reviews.freebsd.org/D34117
Comment 4 Mark Johnston freebsd_committer freebsd_triage 2022-03-17 17:47:24 UTC
*** Bug 255745 has been marked as a duplicate of this bug. ***
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-03-17 19:40:48 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=077564cfdb7285ff7d256424715e563cbac36f8b

commit 077564cfdb7285ff7d256424715e563cbac36f8b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-16 16:09:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-17 19:39:00 +0000

    hdac: Handle interrupts racing with device suspend

    - Avoid looping forever if a concurrent reset causes a read of the
      interrupt status register to return all ones.
    - Lock the softc before reading the interrupt status, so as to avoid a
      similar infinite loop in hdac_one_intr().

    This fixes suspend-to-S3 on some laptops.

    PR:             261207
    Reviewed by:    mav, imp
    Tested by:      uqs
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D34117

 sys/dev/sound/pci/hda/hdac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-03-24 15:23:55 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=18a3bada308d89928f170f4098c85cd3f11db864

commit 18a3bada308d89928f170f4098c85cd3f11db864
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-16 16:09:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-24 14:28:14 +0000

    hdac: Handle interrupts racing with device suspend

    - Avoid looping forever if a concurrent reset causes a read of the
      interrupt status register to return all ones.
    - Lock the softc before reading the interrupt status, so as to avoid a
      similar infinite loop in hdac_one_intr().

    This fixes suspend-to-S3 on some laptops.

    PR:             261207
    Reviewed by:    mav, imp
    Tested by:      uqs
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 077564cfdb7285ff7d256424715e563cbac36f8b)

 sys/dev/sound/pci/hda/hdac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-03-24 15:43:00 UTC
A commit in branch releng/13.1 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2

commit 9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-16 16:09:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-24 15:42:11 +0000

    hdac: Handle interrupts racing with device suspend

    - Avoid looping forever if a concurrent reset causes a read of the
      interrupt status register to return all ones.
    - Lock the softc before reading the interrupt status, so as to avoid a
      similar infinite loop in hdac_one_intr().

    This fixes suspend-to-S3 on some laptops.

    Approved by:    re (gjb)
    PR:             261207
    Reviewed by:    mav, imp
    Tested by:      uqs
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 077564cfdb7285ff7d256424715e563cbac36f8b)
    (cherry picked from commit 18a3bada308d89928f170f4098c85cd3f11db864)

 sys/dev/sound/pci/hda/hdac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)