PINE64
NVMe Tuning - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Pinebook Pro Hardware and Accessories (https://forum.pine64.org/forumdisplay.php?fid=116)
+--- Thread: NVMe Tuning (/showthread.php?tid=8737)

Pages: 1 2


NVMe Tuning - gandlers - 01-09-2020

I have tried to follow the Wiki section to set the power profile of the NVMe SSD.

        sudo nvme /dev/nvme0 id-ctrl /dev/nvme0 

returns:

        ps    0 : mp:3.30W operational enlat:0 exlat:0 rrt:0 rrl:0
                  rwt:0 rwl:0 idle_power:- active_power:-
        ps    1 : mp:2.70W operational enlat:0 exlat:0 rrt:1 rrl:1
                  rwt:1 rwl:1 idle_power:- active_power:-
        ps    2 : mp:2.30W operational enlat:0 exlat:0 rrt:2 rrl:2
                  rwt:2 rwl:2 idle_power:- active_power:-
        ps    3 : mp:0.0500W non-operational enlat:10000 exlat:45000 rrt:4 rrl:4
                  rwt:4 rwl:4 idle_power:- active_power:-
        ps    4 : mp:0.0050W non-operational enlat:10000 exlat:50000 rrt:4 rrl:4
                  rwt:4 rwl:4 idle_power:- active_power:-

Not really sure hot to decypher the output, but I'm assuming that ps 2 is the profile I want as its the lowest power with the drive operational.

I have tried setting this profile using 
        sudo nvme /set-feature /dev/nvme0 -f 2 -v 2

This seems to work until a reboot when it defaults back to profile 0.

Is there a command missing to save it to the NVMe?

Also after googling to try and find how to make NVMe setting persistant, I found some references to enabling Autonomous Power State Transistion rather than editing the power management. 
Which is the correct one to use APST (feature 0x0c) or Power Managment (feature 2) and how to make these setting persistent?


RE: NVMe Tuning - Arwen - 01-10-2020

(01-09-2020, 03:22 PM)gandlers Wrote: I have tried to follow the Wiki section to set the power profile of the NVMe SSD.
...
This seems to work until a reboot when it defaults back to profile 0.

Is there a command missing to save it to the NVMe?
...

Yes, there does appear to be a command missing to make it persistant across reboots & power cycles.
I think this is what we are looking for;
Code:
-s, --save
   Save the attribute so that it persists through all power states and resets.

So the command in both the example and your case is probably;
Code:
$ sudo nvme set-feature /dev/nvme0 -f 2 -v 2 -s
Whence someone has tested that, I'll update the Wiki and remove the note about the non-persistant nature I just added.

(01-09-2020, 03:22 PM)gandlers Wrote: ...
Also after googling to try and find how to make NVMe setting persistant, I found some references to enabling Autonomous Power State Transistion rather than editing the power management.
Which is the correct one to use APST (feature 0x0c) or Power Managment (feature 2) and how to make these setting persistent?
I don't know anything about APST / Autonomous Power State Transistion.


RE: NVMe Tuning - gandlers - 01-10-2020

(01-10-2020, 08:49 AM)Arwen Wrote:
Code:
$ sudo nvme set-feature /dev/nvme0 -f 2 -v 2 -s

Whence someone has tested that, I'll update the Wiki and remove the note about the non-persistant nature I just added.

Arwen,

That's the secret ingredient, the -s switch was indeed required to save it.
Rebooting no longer sets it back to 0.

Many thanks  Big Grin


RE: NVMe Tuning - Arwen - 01-10-2020

Great. You are welcome. Wiki updated.


RE: NVMe Tuning - gandlers - 01-10-2020

May I ask where you found the info regarding the missing switch?

I tried "man nvme", "sudo nvme --help" and obviously googled it but never found info regarding the switches.
I can't find info on the -H switch for example, but that appears to be a "make human readable" switch
Information about the feature-ids also seem to be a closely guarded secret. I would have expected there to be a list of NMVe FID's but google let me down on that one too!


RE: NVMe Tuning - Redbeard - 01-10-2020

This might be a different source than what Arwen found, but I found a page that explains the -s option here:  https://manpages.ubuntu.com/manpages/bionic/en/man1/nvme-set-feature.1.html  

I found this after reading your post this morning, and was going to reply suggesting -s, but when I tried it on my own desktop it didn't work so I didn't reply.  Luckily Arwin did.

I wonder why I'm getting an error but you are not.  When I run:


Quote:sudo nvme set-feature /dev/nvme0 -f 2 -v 2 -s

After I type my password it comes back:


Quote:NVMe Status:FEATURE_NOT_SAVEABLE(10d)

I don't have my PBP yet, this was on my 9 year old X86 desktop running Mint.  This isn't really a problem on my desktop though.


RE: NVMe Tuning - Arwen - 01-10-2020

(01-10-2020, 10:39 AM)gandlers Wrote: May I ask where you found the info regarding the missing switch?

I tried "man nvme", "sudo nvme --help" and obviously googled it but never found info regarding the switches.
I can't find info on the -H switch for example, but that appears to be a "make human readable" switch
Information about the feature-ids also seem to be a closely guarded secret. I would have expected there to be a list of NMVe FID's but google let me down on that one too!

In the NVMe package I have on my Linux desktop, the "man nvme" simply shows what other manual pages are available. So I found "man nvme-set-feature" which has the "-s" option.

I did not find any cross reference of what does what, but did not look too hard. I may have added the Wiki entry, but the actual commands are from someone else here in the forums.

(01-10-2020, 02:33 PM)Redbeard Wrote: This might be a different source than what Arwen found, but I found a page that explains the -s option here:  https://manpages.ubuntu.com/manpages/bionic/en/man1/nvme-set-feature.1.html  

I found this after reading your post this morning, and was going to reply suggesting -s, but when I tried it on my own desktop it didn't work so I didn't reply.  Luckily Arwen did.

I wonder why I'm getting an error but you are not.  When I run:
Quote:sudo nvme set-feature /dev/nvme0 -f 2 -v 2 -s


After I type my password it comes back:
Quote:NVMe Status:FEATURE_NOT_SAVEABLE(10d)


I don't have my PBP yet, this was on my 9 year old X86 desktop running Mint.  This isn't really a problem on my desktop though.

First, do you have a NVMe on your 9 year old X86 desktop?
Second, did you run the command, "sudo nvme id-ctrl /dev/nvme0", to get the power settings of your NVMe?

My desktop has 2 NVMe SSD drives, and only 1 has the ability to change it's power settings. The other does not. Thus, it would likely fail like yours.


RE: NVMe Tuning - gandlers - 01-11-2020

Cheers for the info guys.

Ah, there are other man pages (as highlighted in bold).

Now I know how that works I have the -s switch right here infront of me in my terminal window,


RE: NVMe Tuning - Arwen - 01-11-2020

@gandlers, Live and learn.

Another useful Unix command to find manual pages, though I can't be certain it is on all Linux distros, is "apropos".
For example, I tried this just now;
Code:
> apropos sky        
skytentacles (6)     - 3D tentacles from the sky!
Which ended up being a X-Windows screen saver.


RE: NVMe Tuning - Redbeard - 01-11-2020

@Arwin


Quote:First, do you have a NVMe on your 9 year old X86 desktop?

Yes.  I have an Intel 660p Series M.2 2280 1TB PCIe NVMe mounted in an adapter in a free PCIe slot.

Quote:Second, did you run the command, "sudo nvme id-ctrl /dev/nvme0", to get the power settings of your NVMe?

My desktop has 2 NVMe SSD drives, and only 1 has the ability to change it's power settings. The other does not. Thus, it would likely fail like yours.

Yes.  When I run "sudo nvme id-ctrl /dev/nvme0" it comes back with the following power settings:


Quote:ps    0 : mp:4.00W operational enlat:0 exlat:0 rrt:0 rrl:0
          rwt:0 rwl:0 idle_power:- active_power:-
ps    1 : mp:3.00W operational enlat:0 exlat:0 rrt:1 rrl:1
          rwt:1 rwl:1 idle_power:- active_power:-
ps    2 : mp:2.20W operational enlat:0 exlat:0 rrt:2 rrl:2
          rwt:2 rwl:2 idle_power:- active_power:-
ps    3 : mp:0.0300W non-operational enlat:5000 exlat:5000 rrt:3 rrl:3
          rwt:3 rwl:3 idle_power:- active_power:-
ps    4 : mp:0.0040W non-operational enlat:5000 exlat:9000 rrt:4 rrl:4
          rwt:4 rwl:4 idle_power:- active_power:-

What is strange is I can set the power value, so long as I don't use the -s option.  I've replaced my user name and my path at the terminal with "#############?" below: 
Quote:#############? sudo nvme set-feature /dev/nvme0 -f 2 -v 2
set-feature:02 (Power Management), value:0x000002
#############? sudo nvme get-feature /dev/nvme0 -f 2
get-feature:0x2 (Power Management), Current value:0x000002
#############? sudo nvme set-feature /dev/nvme0 -f 2 -v 2 -s
NVMe Status:FEATURE_NOT_SAVEABLE(10d)

As I noted above, this isn't really an issue for me.  But it did throw me off a bit.