Skip to content

SB2 freezes in sleep mode or after closing the lid #223

Description

@bitog

Hi,

My SB2 freezes right after putting it to sleep. Screen turns dark, I see the cursor and it freezes.

  • Hardware model: Surface Book 2
  • Kernel version: 5.7.5
  • Distribution: Ubuntu 20.04 LTS

dmesg output: https://hastebin.com/ponevexaqu.coffeescript

Thanks for your help!

Activity

  1. qzed commented on Jun 30, 2020

    @qzed
    Member

    Looks like there are some crashes in the nouveau module. You might want to blacklist that if you're not using it. If you plan to use the dGPU, I recommend you use the proprietary nvidia module instead.

  2. khalleu commented on Jul 8, 2020

    @khalleu

    Chiming in (I'm quite new to this), I'm experiencing the same issue with both the latest and the LTS kernel on Arch. I'm using nvidia-dkms. When I attempt to wake my SB2 from suspension, I just see a black screen with a cursor.

    Is there any information you need?

    Thanks in advance!

  3. qzed commented on Jul 8, 2020

    @qzed
    Member

    Could you upload a log from when this is happening? If you have to force-shutdown, you can try journalctl -b -1 to get the log from the last boot (the -1 indicates the previous boot, can also be changed to -2 etc.). If you can reproduce this via some specific steps, can you share those?

  4. khalleu commented on Jul 9, 2020

    @khalleu

    Sure!

    I've reproduced the issue by closing my laptop and reopening it and I've pasted my logs here.

  5. qzed commented on Jul 9, 2020

    @qzed
    Member

    I've reproduced the issue by closing my laptop and reopening it

    So the dGPU has not been powered on before suspending?

    I've pasted my logs here.

    Those don't look complete. There should at least be a message about entering suspend in there. You can write the full logs to a file (e.g. output.log) by appending > output.log to the command. Also make sure that you're getting the correct one, i.e. the one from when the failure occured, with the -b -<number> flags.

  6. khalleu commented on Jul 9, 2020

    @khalleu

    My bad! You can find my logs here.

    The dGPU is powered on at startup, and the performance mode is set to normal.

    $ surface status
    Performance-Mode: Normal (1)
    dGPU-Power: on

  7. qzed commented on Jul 10, 2020

    @qzed
    Member

    Thanks! I think I've found the issue and fixed it in linux-surface/surface-aggregator-module@fbd22f9. You can test this by cloning that repo and following the instructions in https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing#buildtest-the-modules (you probably want to install the module with dkms for this).

    However, I should note that I do not recommend turning on the dGPU automatically (before your desktop environment, e.g. Gnome has been started). At least in my experience, the dGPU generates a significant amount of heat if the device has been suspended with the dGPU turned on. I'd rather recommend that you use something like optirun/primusrun and turn on the dGPU on demand, closing all dGPU using applications and turning it off before suspending the device. This is unfortunately an issue I haven't been able to track down yet and likely won't get to in the foreseeable future.

    Unfortunately it's also (at least with Gnome) not possible to turn off the dGPU before suspending, as Gnome (by default) for some reason accesses the dGPU, so if you try to turn it off before suspend, the device gets yanked from Gnome, which it does not handle gracefully. I've tried to do that in kernel, i.e. turn-off the dGPU after all user-space applications, including Gnome, have been suspended and turning it on again before user-space resumes, but that still causes issues as the nvidia driver doesn't handle the loss of the device gracefully either if there's some client still using the device, even if the client has been suspended.

    In short, I recommend you turn on the dGPU only on demand and turn it off before suspend. The other issues I mentioned are currently wontfix for me and likely require someone with a lot more knowledge about PCI (specifically hot-plug and suspend/resume) than I have.

  8. khalleu commented on Jul 11, 2020

    @khalleu

    Unfortunately, I can't seem to be able to install it:

    $ sudo dkpg autoinstall
    `Kernel preparation unnecessary for this kernel. Skipping...`
    Building module:
    cleaning build area...
    make -j8 KERNELRELEASE=4.19.131-1-surface-lts all KVERSION=4.19.131-1-surface-lts...(bad exit status: 2)
    Error! Bad return status for module build on kernel: 4.19.131-1-surface-lts (x86_64)
    Consult /var/lib/dkms/surface_sam/0.1/build/make.log for more information.

    Here's the make.log.

    However, this may be because I didn't set

    CONFIG_SERIAL_DEV_BUS=y
    CONFIG_SERIAL_DEV_CTRL_TTYPORT=y

    as required here. Where can I set these?

    Lastly, I'll give primusrun a try. I've been using prime, which doesn't work unless the dGPU is turned on before gdm starts. I've tried using bumblebee in the past, but I've experienced significant performance issues in doing so.

    Thanks in advance!!

  9. qzed commented on Jul 11, 2020

    @qzed
    Member

    Ah, installing fails because the module doesn't support v4.19 kernels (without a couple changes). Can you test this on a newer kernel?

    I'll update the 4.19 patches with those changes if that works.

  10. khalleu commented on Jul 12, 2020

    @khalleu

    It works in 5.7.7! Thank you so much.

    Keep us posted on the 4.19 patch! I've been using the LTS kernel because I frequently use both pen and touch support.

  11. qzed commented on Jul 13, 2020

    @qzed
    Member

    Neat! The upcoming releases contain the fix (v5.7.8 and v4.19.132).

  12. khalleu commented on Jul 14, 2020

    @khalleu

    Thank you! It works great now. ✌

    One last question though: As suggested, I'm trying primusrun. From what I understand, primusrun relies on bumblebee, which uses bbtoggle to turn off the dgpu when not in use.

    sudo systemctl bumblebeed.service status gives me this.

    Note that it says

    Jul 13 21:07:10 katiebook bumblebeed[350]: modprobe: ERROR: could not insert 'bbswitch': No such device.

    surface status tells me

    Performance-Mode: Normal (1)
    dGPU-Power: off.

    Is there something I'm doing wrong? Asking here because this may be kernel related. I'm using bbswitch-dkms.

    $ dkms status
    bbswitch, 0.8, 4.19.132-1-surface-lts, x86_64: installed
    nvidia, 450.57, 4.19.132-1-surface-lts, x86_64: installed

    Thanks again!

  13. qzed commented on Jul 14, 2020

    @qzed
    Member

    You'll have to manually turn on/off the dGPU as there isn't any integration for bumblebee at the moment. You should also set PMMethod=none in /etc/bumblebee/bumblebee.conf, so that it doesn't attempt to use bbswitch. Here are a bit more details: https://github.com/linux-surface/surface-aggregator-module/wiki/Discrete-GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions