LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Lenovo ThinkPad T480 and Slackware - experiences and CPU frequency problem (https://www.linuxquestions.org/questions/slackware-14/lenovo-thinkpad-t480-and-slackware-experiences-and-cpu-frequency-problem-4175657497/)

ajevremovic 07-16-2019 12:13 PM

Lenovo ThinkPad T480 and Slackware - experiences and CPU frequency problem
 
Hi guys,

few days ago I god my new t480, with these characteristics:
  • 14.0" FHD (1920 x 1080) 250 nits, IPS anti-glare
  • 32 GB (16 + 16) DDR4 2400MHz
  • Integrated Intel® UHD Graphics 620
  • 512 GB Solid State Drive, PCIe-NVMe OPAL2.0 M.2
  • 3 cell Li-Ion 24Wh + 6 cell Li-Ion 72Wh

So, the Slackware (current) installation (from USB stick) went fine, elilo installed automatically (I had to disable Secure boot in setup). The NVMe drive and memory are really fast - I got these values:

RAM drive:
Code:

bash-5.0$ dd if=/dev/zero of=zero bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.211028 s, 5.1 GB/s

NVMe drive:
Code:

bash-5.0$ dd if=/dev/zero of=zero2 bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.406796 s, 2.6 GB/s

All hardware is supported out of the box (except CPU, more information in next paragraph). The only thing I had to change was the dhcp-client in /etc/NetworkManager/conf.d/00-dhcp-client.conf, from dhcpcd to dhclient, because the connection was breaking efter two seconds on some access points.

I enabled "Thunderbolt BIOS Assist Mode" in the Setup, as it should improve battery life. (Some people bricked their laptops when changing this option, but my t480 was fine with that.)

The battery life looks good, but I have a problem/question about this - when booted from USB stick, CPU frequency is scaling. However, after the installation (when booted from the drive) the CPU frequency (got from 'cat /proc/cpuinfo') is always at (turbo) maximum - 4GHz. I also installed this tool: https://github.com/erpalma/throttled but I see no change with this behavior.

The thing is that the CPU temperature is fine, ~48 degrees, and the fan is not working until there is some real load. However, I'm not sure what is causing the CPU to work (?) on the maximum frequency all the time, and I don't know if this is decreasing battery life?

Do you have any experience/idea about this?

Best,
Aleksandar

Alien Bob 07-16-2019 12:52 PM

Read /etc/rc.d/rc.cpufreq , does it apply to your case?

smallpond 07-16-2019 01:04 PM

Code:

dd if=/dev/zero of=zero2 bs=1M count=1024
This only gives the time until the writes have completed (data still in RAM). If you want to measure writes all the way to disk do:

Code:

dd if=/dev/zero of=zero2 bs=1M count=1024 oflag=direct

ajevremovic 07-17-2019 09:19 AM

Quote:

Read /etc/rc.d/rc.cpufreq , does it apply to your case?
Hi Eric, I checked /etc/rc.d/rc.cpufreq, but this part:
Code:

# For CPUs using intel_pstate, always use the performance governor. This also
# provides power savings on Intel processors while avoiding the ramp-up lag
# present when using the powersave governor (which is the default if ondemand
# is requested on these machines):
if [ "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver 2> /dev/null)" = "intel_pstate" ]; then
  SCALING_GOVERNOR="performance"
fi

means that performance governor is always used.

I also installed TLP, and here is the output from tlp-stat: https://pastebin.com/512j9Ru9

Actually, the battery is draining a much faster than it should - it lasts ~6-7 hours, which is not even a 1/3 of what is expected/advertised.

By the way, there is an unexpected behavior - the system uses built-in battery first, and then external one. Which has no sense, because I can't hot-replace the external one without shutting down the system.

smallpond, thank you for the tip about the NVMe benchmarking. Now it is 1.3GB/s, which is also very nice:
Code:

bash-5.0$ dd if=/dev/zero of=zero2 bs=1M count=1024 oflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.820849 s, 1.3 GB/s


Labinnah 07-17-2019 09:37 AM

Quote:

Originally Posted by ajevremovic (Post 6015855)
means that performance governor is always used.

You should change to "ondemand".

Also try run "powertop" to see what process/hardware use most of power.

Timothy Miller 07-17-2019 09:40 AM

Quote:

Originally Posted by ajevremovic (Post 6015855)
Hi Eric, I checked /etc/rc.d/rc.cpufreq, but this part:
Code:

# For CPUs using intel_pstate, always use the performance governor. This also
# provides power savings on Intel processors while avoiding the ramp-up lag
# present when using the powersave governor (which is the default if ondemand
# is requested on these machines):
if [ "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver 2> /dev/null)" = "intel_pstate" ]; then
  SCALING_GOVERNOR="performance"
fi

means that performance governor is always used.

I also installed TLP, and here is the output from tlp-stat: https://pastebin.com/512j9Ru9

Actually, the battery is draining a much faster than it should - it lasts ~6-7 hours, which is not even a 1/3 of what is expected/advertised.

By the way, there is an unexpected behavior - the system uses built-in battery first, and then external one. Which has no sense, because I can't hot-replace the external one without shutting down the system.

smallpond, thank you for the tip about the NVMe benchmarking. Now it is 1.3GB/s, which is also very nice:
Code:

bash-5.0$ dd if=/dev/zero of=zero2 bs=1M count=1024 oflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.820849 s, 1.3 GB/s


Question for you. Does it ALWAYS default to having the onboard drain first? I have the A485 (basically the AMD powered version of your laptop), and if I boot it with the external battery removed then insert the external, it does EXACTLY as you describe. But if I leave it assembled and boot, then it drains correctly.

BTW - the reason I noticed this behaviour is because the A485 still seems to have a firmware issue where it drains both batteries when turned off, so I started removing the external battery if it was going to be stored off for more than a couple hours.

ajevremovic 07-17-2019 10:09 AM

Quote:

Originally Posted by Labinnah (Post 6015860)
You should change to "ondemand".

Also try run "powertop" to see what process/hardware use most of power.

I tried to change governor to "ondemand", but it is always automatically returned to "performance". And here is the output from "powertop": https://pastebin.com/k4z4Xtr6 (I'm not sure how to interpret the results?)

ajevremovic 07-17-2019 10:15 AM

Quote:

Originally Posted by Timothy Miller (Post 6015862)
Question for you. Does it ALWAYS default to having the onboard drain first? I have the A485 (basically the AMD powered version of your laptop), and if I boot it with the external battery removed then insert the external, it does EXACTLY as you describe. But if I leave it assembled and boot, then it drains correctly.

In this 2-3 days I'm using it it always drains the built-in battery first. I will check what will happen if I boot without the external battery.

Quote:

Originally Posted by Timothy Miller (Post 6015862)
BTW - the reason I noticed this behaviour is because the A485 still seems to have a firmware issue where it drains both batteries when turned off, so I started removing the external battery if it was going to be stored off for more than a couple hours.

Yes, the built-in battery was drained to 5%, then the system switched to the external battery. But then, I left it in sleep mode, and when the laptop was awaken, the built-in battery was 0%.

I see no logic with this behavior, but I guess that removing/inserting battery all the time, on a laptop that costs ~$2000 is not a good marketing for Lenovo.

Timothy Miller 07-17-2019 10:18 AM

Quote:

Originally Posted by ajevremovic (Post 6015875)
I see no logic with this behavior, but I guess that removing/inserting battery all the time, on a laptop that costs ~$2000 is not a good marketing for Lenovo.

NO, definitely not good marketing. And they seem to ignore their users. A bunch of us that bought the A485 have complained about it draining batteries when turned off, but so far Lenovo has utterly ignored us, not even acknowledging the issue still persists.

lamerix 07-17-2019 11:00 AM

Ops

Labinnah 07-17-2019 11:26 AM

Quote:

Originally Posted by ajevremovic (Post 6015874)
And here is the output from "powertop": https://pastebin.com/k4z4Xtr6 (I'm not sure how to interpret the results?)

On this screen you can see what for and for how long processor was wake up. You can navigate to other screens by pressing TAB. You can analyze on them what device or process wakeup processor most often an next you can try do something with that. Take closer look to "Tunables" screen - here you can change some kernel parameter to better power saveings. But you must be careful with that - some changes may have unexpected results.

On first screen you have current power usage so you can see how your changes affect it.


I can't help you more in this. I've use this program very very long time ago; - I have very rarely occasion to use laptop on battery power so I don't interested with this program lately.

ajevremovic 07-17-2019 11:49 AM

Quote:

Originally Posted by Labinnah (Post 6015897)
You can navigate to other screens by pressing TAB. You can analyze on them what device or process wakeup processor most often an next you can try do something with that. Take closer look to "Tunables" screen - here you can change some kernel parameter to better power saveings.

Thank you for pointing on this tool. However, it just confirmed that CPU is always working at near max (turbo) frequency:
Code:

PowerTOP v2.10    Overview  Idle stats  Frequency stats  Device stats  Tunables  WakeUp                           


            Package |            Core    |            CPU 0          CPU 4
                    |                    | Average  3.8 GHz    3.7 GHz
Idle                | Idle                | Idle
 400 MHz            |  400 MHz            |  400 MHz
4.00 GHz            | 4.00 GHz            | 4.00 GHz

                    |            Core    |            CPU 1          CPU 5
                    |                    | Average  3.8 GHz    3.8 GHz
                    | Idle                | Idle
                    |  400 MHz            |  400 MHz
                    | 4.00 GHz            | 4.00 GHz

                    |            Core    |            CPU 2          CPU 6
                    |                    | Average  3.8 GHz    3.8 GHz
                    | Idle                | Idle
                    |  400 MHz            |  400 MHz
                    | 4.00 GHz            | 4.00 GHz

                    |            Core    |            CPU 3          CPU 7
                    |                    | Average  3.8 GHz    3.7 GHz
                    | Idle                | Idle
                    | 4.00 GHz            | 4.00 GHz
                    |  400 MHz            |

and, on the Tunables screen everything looks fine:
Code:

>> Good          VM writeback timeout                                                                                 
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PCI Express Root Port #9
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PCI Express Root Port #1
  Good          Wireless Power Saving for interface wlan0
  Good          Enable Audio codec power management
  Good          Bluetooth device interface status
  Good          Autosuspend for USB device xHCI Host Controller [usb2]
  Good          Autosuspend for USB device Integrated Camera [Azurewave]
  Good          Autosuspend for USB device EMV Smartcard Reader [Generic]
  Good          Autosuspend for USB device xHCI Host Controller [usb1]
  Good          Autosuspend for unknown USB device 1-7 (8087:0a2b)
  Good          Autosuspend for USB device USB3.0-CRW [Generic]
  Good          Runtime PM for I2C Adapter i2c-2 (i915 gmbus dpb)
  Good          Runtime PM for I2C Adapter i2c-3 (i915 gmbus dpd)
  Good          Runtime PM for I2C Adapter i2c-0 (SMBus I801 adapter at efa0)
  Good          Autosuspend for unknown USB device 1-9 (06cb:009a)
  Good          Runtime PM for I2C Adapter i2c-1 (i915 gmbus dpc)
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PMC
  Good          Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point LPC Controller/eSPI Controller
  Good          Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP CSME HECI #1
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP HD Audio
  Good          Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PCI Express Root Port #11
  Good          Runtime PM for PCI Device Lite-On Technology Corporation Device 2300
  Good          Runtime PM for PCI Device Intel Corporation Wireless 8265 / 8275
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP Thermal subsystem
  Good          Runtime PM for PCI Device Intel Corporation Ethernet Connection (4) I219-V
  Good          Runtime PM for PCI Device Intel Corporation UHD Graphics 620
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP SMBus
  Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PCI Express Root Port #7


phenixia2003 07-17-2019 12:50 PM

Hello,

You can set SCALING_GOVERNOR to powersave in /etc/default/cpufreq, and, if you want to go further with intel pstate, you can try pstate-frequency.

--
SeB

ajevremovic 07-17-2019 01:12 PM

Quote:

Originally Posted by phenixia2003 (Post 6015929)
You can set SCALING_GOVERNOR to powersave in /etc/default/cpufreq, and, if you want to go further with intel pstate, you can try pstate-frequency

Dear phenixia2003, I wasn't able to change SCALING_GOVERNOR in any way, including /etc/default/cpufreq. HOWEVER, looks like pstate-frequency tool did the job! CPU frequency is now changing, from ~900MHz to ~2.4GHz. I'll investigate this further (the most confusing part to me is that CPU frequency scaling was fine when booted from USB?), and will publish the conclusions here. Thanks!

tramtrist 07-17-2019 04:49 PM

I'm watching this one pretty closely .. Thanks for taking it on ajevremovic.. I'll probably load that pstate-frequency program tonight as well and test it out...


All times are GMT -5. The time now is 02:43 PM.