PINE64
Suspend with NVME not working - Default Debian - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: General Discussion on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=112)
+--- Thread: Suspend with NVME not working - Default Debian (/showthread.php?tid=9048)



Suspend with NVME not working - Default Debian - appdev46 - 02-06-2020

Suspend stopped working after I installed an NVME drive.  It appears the PBP goes into suspend.   The screen goes black and the led turns red.  However, when pressing the power button the PBP will never wake up again.  I have to hold the power button 6 seconds to reset it and then boot from scratch.
 
The drive I installed was the Intel 660p SSDPEKNW512G8X1 

I am setting power limiting on boot.  I added "sudo nvme set-feature /dev/nvme0 -f 2 -v 2" in /etc/rc.local and have verified that it is setting the feature correctly on boot.

Any ideas how to troubleshoot?  Has anyone else gotten suspend to work with an NVME drive installed?


RE: Suspend with NVME not working - Default Debian - Jeremiah Cornelius - 02-06-2020

This is probably related to the same nvme issues I solved for Linux on the Macbook Pro, recently. The drive would "sleep" but then resume as read-only - with unpredictable effects!

The Macs don't support APST, and many nvme units also seem to be "idiosyncratic" about implementations. The fix is to "turn-off" the ability of the kernel to impose sleep states on hardware that does not conform.

After researching a bit about this, my solution was:
echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

This is now featured on the authoritative  Dunedan /mbp-2016-linux github: https://github.com/Dunedan/mbp-2016-linux

This needs to be done in a root shell, sudo user won't cut it. You can elevate by runing 'sudo su -' and have a root shell, without additional login process.
I'd seriously give this a shot, AFTER you determine with lspci the actual device number for your nvme.

If this solves your problem, I supplied scripts and a systemd service wrapper, so you may automate at boot:
https://github.com/cb22/macbook12-spi-driver/pull/30#issuecomment-540208177

Create this file:

Quote:/etc/systemd/system/fix_sleep.service

# systemd oneshot service to set sleep boolean on Apple Macbook Pro disks
# Original by Pier Lim. Posted at https://kerpanic.wordpress.com/2018/03/13/apple-keyboard-get-function-keys-working-properly-in-ubuntu/

   [Unit]
   Description=Job that disables sleep from stopping nvme hardware on MBP
   
   [Service]
   ExecStart=/sbin/fixsleep
   Type=oneshot
   RemainAfterExit=yes

   [Install]
   WantedBy=multi-user.target


And the actual script:

Quote:/sbin/fixsleep

#!/bin/bash
/bin/echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

If you try this out, I'd love to hear how it goes.


RE: Suspend with NVME not working - Default Debian - appdev46 - 02-06-2020

(02-06-2020, 08:06 PM)Jeremiah Cornelius Wrote: This is probably related to the same nvme issues I solved for Linux on the Macbook Pro, recently. The drive would "sleep" but then resume as read-only - with unpredictable effects!

The Macs don't support APST, and many nvme units also seem to be "idiosyncratic" about implementations. The fix is to "turn-off" the ability of the kernel to impose sleep states on hardware that does not conform.

After researching a bit about this, my solution was:
echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

This is now featured on the authoritative  Dunedan /mbp-2016-linux github: https://github.com/Dunedan/mbp-2016-linux

This needs to be done in a root shell, sudo user won't cut it. You can elevate by runing 'sudo su -' and have a root shell, without additional login process.
I'd seriously give this a shot, AFTER you determine with lspci the actual device number for your nvme.

If this solves your problem, I supplied scripts and a systemd service wrapper, so you may automate at boot:
https://github.com/cb22/macbook12-spi-driver/pull/30#issuecomment-540208177

Create this file:

Quote:/etc/systemd/system/fix_sleep.service

# systemd oneshot service to set sleep boolean on Apple Macbook Pro disks
# Original by Pier Lim. Posted at https://kerpanic.wordpress.com/2018/03/13/apple-keyboard-get-function-keys-working-properly-in-ubuntu/

   [Unit]
   Description=Job that disables sleep from stopping nvme hardware on MBP
   
   [Service]
   ExecStart=/sbin/fixsleep
   Type=oneshot
   RemainAfterExit=yes

   [Install]
   WantedBy=multi-user.target


And the actual script:

Quote:/sbin/fixsleep

#!/bin/bash
/bin/echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

If you try this out, I'd love to hear how it goes.

My output from lspci:


Code:
00:00.0 PCI bridge: Device 1d87:0100
01:00.0 Non-Volatile memory controller: Intel Corporation Device f1a8 (rev 03)

Do I have to modify that command with this information somehow?


RE: Suspend with NVME not working - Default Debian - appdev46 - 02-07-2020

I tried this and it didn't work. I did sudo su,then from there I ran the command and hit suspend and the same wake issue occurred.


RE: Suspend with NVME not working - Default Debian - johnny89 - 07-12-2020

(02-06-2020, 08:06 PM)Jeremiah Cornelius Wrote: This is probably related to the same nvme issues I solved for Linux on the Macbook Pro, recently. The drive would "sleep" but then resume as read-only - with unpredictable effects!

The Macs don't support APST, and many nvme units also seem to be "idiosyncratic" about implementations. The fix is to "turn-off" the ability of the kernel to impose sleep states on hardware that does not conform.

After researching a bit about this, my solution was:
echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

This is now featured on the authoritative  Dunedan /mbp-2016-linux github: https://github.com/Dunedan/mbp-2016-linux

This needs to be done in a root shell, sudo user won't cut it. You can elevate by runing 'sudo su -' and have a root shell, without additional login process.
I'd seriously give this a shot, AFTER you determine with lspci the actual device number for your nvme.

If this solves your problem, I supplied scripts and a systemd service wrapper, so you may automate at boot:
https://github.com/cb22/macbook12-spi-driver/pull/30#issuecomment-540208177

Create this file:

Quote:/etc/systemd/system/fix_sleep.service

# systemd oneshot service to set sleep boolean on Apple Macbook Pro disks
# Original by Pier Lim. Posted at https://kerpanic.wordpress.com/2018/03/13/apple-keyboard-get-function-keys-working-properly-in-ubuntu/

   [Unit]
   Description=Job that disables sleep from stopping nvme hardware on MBP
   
   [Service]
   ExecStart=/sbin/fixsleep
   Type=oneshot
   RemainAfterExit=yes

   [Install]
   WantedBy=multi-user.target


And the actual script:

Quote:/sbin/fixsleep

#!/bin/bash
/bin/echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

If you try this out, I'd love to hear how it goes.

****

Hi Jeremiah,

Your suggestion works on imac models that have unofficial nvme setup running Debian. Do you have knowledge as to implementing same mechanism in macos since the issue is ongoing there as well. setpci maybe? Any clues?

Thanks,


RE: Suspend with NVME not working - Default Debian - Jeremiah Cornelius - 07-14-2020

(07-12-2020, 01:47 AM)johnny89 Wrote:
(02-06-2020, 08:06 PM)Jeremiah Cornelius Wrote: This is probably related to the same nvme issues I solved for Linux on the Macbook Pro, recently. The drive would "sleep" but then resume as read-only - with unpredictable effects!

The Macs don't support APST, and many nvme units also seem to be "idiosyncratic" about implementations. The fix is to "turn-off" the ability of the kernel to impose sleep states on hardware that does not conform.

After researching a bit about this, my solution was:
echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

This is now featured on the authoritative  Dunedan /mbp-2016-linux github: https://github.com/Dunedan/mbp-2016-linux

This needs to be done in a root shell, sudo user won't cut it. You can elevate by runing 'sudo su -' and have a root shell, without additional login process.
I'd seriously give this a shot, AFTER you determine with lspci the actual device number for your nvme.

If this solves your problem, I supplied scripts and a systemd service wrapper, so you may automate at boot:
https://github.com/cb22/macbook12-spi-driver/pull/30#issuecomment-540208177

Create this file:

Quote:/etc/systemd/system/fix_sleep.service

# systemd oneshot service to set sleep boolean on Apple Macbook Pro disks
# Original by Pier Lim. Posted at https://kerpanic.wordpress.com/2018/03/13/apple-keyboard-get-function-keys-working-properly-in-ubuntu/

   [Unit]
   Description=Job that disables sleep from stopping nvme hardware on MBP
   
   [Service]
   ExecStart=/sbin/fixsleep
   Type=oneshot
   RemainAfterExit=yes

   [Install]
   WantedBy=multi-user.target


And the actual script:

Quote:/sbin/fixsleep

#!/bin/bash
/bin/echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed

If you try this out, I'd love to hear how it goes.

****

Hi Jeremiah,

Your suggestion works on imac models that have unofficial nvme setup running Debian. Do you have knowledge as to implementing same mechanism in macos since the issue is ongoing there as well. setpci maybe?  Any clues?

Thanks,
I'm afraid I'm way more familiar with being able to tinker with kernel internals of Linux, than MacOS.