Tiny Core Linux

General TC => General TC Talk => Topic started by: nick65go on May 22, 2020, 06:53:19 PM

Title: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 22, 2020, 06:53:19 PM
in Tc11_x64, using just just minimum FLWM (windows manager) and Firefox 76.0.1 (64 bits).my battery is 2 years old; in Firefox just reading TEXT (like this forum) in maxim 2-3 tabs opened.

1. with wireless-network, battery depleted (from 100% until 3%) in 66 minutes. What? I did not believed. So I repeated the test again. I measured the capacity very 3 minutes (open aterm, give command, close aterm). The curve was LINEAR consumption. (in 70 minutes battery was 1% and linux stopped).
2. with wire-network (cable) battery depleted (from 100% until 7%) in 75 minutes. Still not good for me. So I break my bet to abandon win10; and I rebooted to test in win10
3. in WIN10, with wire-network (cable) battery depleted (from 100% until 10%) in 150 minutes! win10 has shut-down in 156 minutes (maybe at 5-7%). in win10 I just login and start firefox.

Summary: battery time in win10 versus tinycore was 2 times better in win10. It is craziness. Two bugs could be:
- radeon driver did NOT properly dynamically change the APU clock (evem if I told it dpm=1, aspm=1 etc); I have a AMD A6-6310 APU with AMD Radeon R4 Graphics
- firefox has a bug, even at low usage (reading html files).
Title: Re: battery depleted too fast with just firefox + flwm
Post by: curaga on May 23, 2020, 12:19:26 AM
There are a number of things that default to "performance" in Linux, but which Windows changes to "battery save" when on battery. Screen brightness, gpu and cpu clocks... Powertop and other such tools can help you.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 23, 2020, 10:05:43 AM
powertop is not in tcz repositories. It should be nice to have; or I will grab it from other distro.
With the brightness I solved, by direct input into  /sys/class/backlight/radeon_bl0/brightness;
I have an APU=cpu+gpu.I will play with /sys/module/radeon/parameter
Code: [Select]
@box:/sys/module/radeon/parameters$ cat dpm
1
tc@box:/sys/module/radeon/parameters$ cat aspm
1
tc@box:/sys/module/radeon/parameters$ cat dynclks
1
tc@box:/sys/module/radeon/parameters$ cat cik_support
1
tc@box:/sys/module/radeon/parameters$ cat si_support
1

do you have some hints about lower clock frequency places in /sys?like this:
Code: [Select]
tc@box:/sys/module/pcie_aspm/parameters$ cat policy
[default] performance powersave powersupersave
Code: [Select]
root@box:/sys/module/pcie_aspm/parameters# echo powersupersave > policy
root@box:/sys/module/pcie_aspm/parameters# cat policy
default performance powersave [powersupersave]
Title: Re: battery depleted too fast with just firefox + flwm
Post by: jazzbiker on May 23, 2020, 10:34:26 AM
Hi, nick65go!

Since TC 4.x there are cpufreqd.tcz and cpufrequtils.tcz. I didn't used them, but seems that they are working directly with /sys/devices/system/cpu/cpuX/* files. Setting frequency min, max, governor. If You want to maximize battery life seems its time to use this tools.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: Juanito on May 23, 2020, 10:42:28 AM
The cli tool is cpupower as I recall..
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 23, 2020, 01:38:03 PM
Hi Juanito!
I think the default cpu configuration in Tiny-core is quite good. Without installing any cpu*.tcz I have:
Code: [Select]
tc@box:/sys/devices/system/cpu/cpufreq/policy0$ cat scaling_driver
acpi-cpufreq
tc@box:/sys/devices/system/cpu/cpufreq/policy0$ cat scaling_governor
ondemand
tc@box:/sys/devices/system/cpu/cpufreq/policy0$ cat scaling_available_frequencies
1800000 1600000 1400000 1200000 1000000
tc@box:$ sudo cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq
1200000
I do not think I could optimize anything for CPU.

Plus the cpupower.tcz is a little misleading (it says "Intel", but I have AMD), giving me extra frequency which my "bios" can not have:
Code: [Select]
tc@box:~$ cat /sys/devices/system/cpu/cpufreq/policy0/bios_limit
1800000
Code: [Select]
tc@box:~$ sudo cpupower info
System does not support Intel's performance bias setting
analyzing CPU 0:
Code: [Select]
tc@box:~$ sudo cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 4.0 us
  hardware limits: 1000 MHz - 1.80 GHz
  available frequency steps:  1.80 GHz, 1.60 GHz, 1.40 GHz, 1.20 GHz, 1000 MHz
  available cpufreq governors: conservative powersave userspace ondemand performance schedutil
  current policy: frequency should be within 1000 MHz and 1.80 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency: 1000 MHz (asserted by call to hardware)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 3
    Total States: 8
    Pstate-Pb0: 2400MHz (boost state)
    Pstate-Pb1: 2200MHz (boost state)
    Pstate-Pb2: 2000MHz (boost state)
    Pstate-P0:  1800MHz
    Pstate-P1:  1600MHz
    Pstate-P2:  1400MHz
    Pstate-P3:  1200MHz
    Pstate-P4:  1000MHz
tc@box:~$


Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 23, 2020, 01:55:18 PM
so I am still focused on my GPU. After reading again on phoronix about ASPM, I got:
Code: [Select]
root@box:/home/tc# dmesg | grep -i aspm
Kernel command line: BOOT_IMAGE=/boot/tc11/vmlinuz64 tce=sda10/tce11-64 laptop radeon.dpm=1 radeon.aspm=1 radeon.dynclks=1 pcie_aspm=force
acpi PNP0A03:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
Maybe I am lucky with ASPM now. (pcie_aspm=force).
I just discovered one of my mistake: the /etc/modprobe.d/radeon.conf is useless. because radeon kernel driver is loaded from onboot.lst (together with its firmware), before mydata.tgz has any chance to be read. Now I have the radeon options in grub2 command line. Start re-testing.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 23, 2020, 05:26:17 PM
so until now, all the previous tricks applied,
1. TC11-X64, with wire-network (cable) battery depleted (from 100% until 7%) in 106 minutes.
2. TC11_x64, with wire-network (cable) battery depleted (from 100% until 3%) in 127 minutes.
3. win10_x64, with wire-network (cable) battery depleted (from 100% until 10%) in 150 minutes.

Linux/Win10  ratio = [70%..80%]. I do not think I can get much closer. It could be because Firefox is a dinosaur (bloat) not optimized for linux as well as it is for windows. Shame.Or I need to try another kernel driver: amdgpu instead of radeon. My "AMD A6-6310 APU", and Xorg says is GCN 2.x

Code: [Select]
lspci | grep -VGA
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Mullins [Radeon R4/R5 Graphics]
Or I need another kernel to expose (and let me change) the GPU clocks, voltage etc.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: aus9 on May 23, 2020, 06:37:04 PM
Quote
Or I need to try another kernel driver: amdgpu

could be worth a shot. If you use Apps provides search for codename mullins I get 9 hits for
firmware-amdgpu.

However, you appear to have a Sea Island codename and there is claim, certain kernel settings may need be set. So you might have to re-compile the kernel?

Quote
Enable Southern Islands (SI) and Sea Islands (CIK) support

The linux package enables AMDGPU support for cards of the Southern Islands (SI) and Sea Islands (CIK). When building or compiling a kernel, CONFIG_DRM_AMDGPU_SI=Y and/or CONFIG_DRM_AMDGPU_CIK=Y should be be set in the config.

more reading etc here
https://wiki.archlinux.org/index.php/AMDGPU
Title: Re: battery depleted too fast with just firefox + flwm
Post by: jazzbiker on May 23, 2020, 10:47:13 PM
Hi, nick65go!

If You use default ondemand governor still all available frequencies may be used by processor in case "unoptimized" FF will try to jerk extraneously.
If You will set
Code: [Select]
cpupower frequency-set -g powersave
then the CPU frequency will be holded at minimum value with no options, and FF will not have any possibility to shift the frequency and consumption up.

As the CPU eats more than GPU its appetite must be minimized prior to sophisticated GPU tuning, i think.

Please, try the powersave governor, Your results are very intereting, i expect for many forum readers.
Aren't You the "master" of Your Linux ? ;)
Title: Re: battery depleted too fast with just firefox + flwm
Post by: Juanito on May 24, 2020, 01:04:08 AM
powertop added to x86 and x86_64 repos
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 24, 2020, 08:10:07 AM
@Juanito: thank you, I will try it.
@jazzbiker:
1 . "As the CPU eats more than GPU its appetite must be minimized prior to sophisticated GPU tuning, i think." Interesting, I did not think about it, because APU=cpu+gpu. I will try the "cpupower frequency-set -g powersave".
2. "Aren't You the "master" of Your Linux ?" -> No, I am the jack of all trades, master of nothing ;)
I hope my laptop (it is 5 years old) will not crash on me soon, I mean HDD, UEFI etc.The choise of grub2 parameter "pcie_aspm=force" fail me (this time). Because I run HP-UEFI diagnostic, and all were OK, but then I rebooted and in tinycore I had no sound, neither wifi devices. Maybe they were put in too deep sleep by my "pcie_aspm=force".A little upset that I distroied my laptop, I rebooted in win10. Et voila! The bloated win10 sees and uses the wifi and sound card. Sigh, I am lucky.I lost a battle, but not the war.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 24, 2020, 10:53:18 AM
@all: I made a mistake, sorry. Sound and wifi work, even with grub2 parameter "pcie_aspm=force".The mistake was that I killed the udevd too early (from/home/tc/.X.d/*) and only then I tried to load ALSA or WIFI. Which of course add kernel modules which need to be detected etc.now testing with
Code: [Select]
tc@box:~$ sudo cpupower frequency-set -g powersave
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Code: [Select]
tc@box:~$ sudo cpupower frequency-info
analyzing CPU 0:
  available frequency steps:  1.80 GHz, 1.60 GHz, 1.40 GHz, 1.20 GHz, 1000 MHz
  available cpufreq governors: powersave userspace conservative ondemand performance schedutil
  current policy: frequency should be within 1000 MHz and 1.80 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: 1000 MHz (asserted by call to hardware)
and playing with powertop.tcz
Title: Re: battery depleted too fast with just firefox + flwm
Post by: jazzbiker on May 24, 2020, 11:16:10 AM
Hi, nick65go!

By the way, results of the governor job can be checked in
Code: [Select]
cat /sys/devices/system/cpufreq/policyX/stats/time_in_state

Good luck!
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 24, 2020, 02:14:59 PM
Thanks to powertop, I manage to identify and sort the things that deplete the battery. Few settings were already correctly setup, but most not. So I identified the main pieces:
Code: [Select]
tc@box:~$ lspci -nn
00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1566]
00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Mullins [Radeon R4/R5 Graphics] [1002:9851]
00:01.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Kabini HDMI/DP Audio [1002:9840]
00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:156b]
00:02.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 16h Processor Functions 5:1 [1022:1439]
00:02.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 16h Processor Functions 5:1 [1022:1439]
00:02.5 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 16h Processor Functions 5:1 [1022:1439]
00:08.0 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Device [1022:1537]
00:10.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller [1022:7814] (rev 11)
00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7804] (rev 39)
00:12.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller [1022:7808] (rev 39)
00:13.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller [1022:7808] (rev 39)
00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:780b] (rev 42)
00:14.2 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller [1022:780d] (rev 02)
00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:780e] (rev 11)
00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1580]
00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1581]
00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1582]
00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1583]
00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1584]
00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1585]
01:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723]
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller [10ec:8136] (rev 07)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader [10ec:5229] (rev 01)

and their tree connections:
Code: [Select]
tc@box:~$ lspci -tvv
-[0000:00]-+-00.0  Advanced Micro Devices, Inc. [AMD] Device 1566
           +-01.0  Advanced Micro Devices, Inc. [AMD/ATI] Mullins [Radeon R4/R5 Graphics]
           +-01.1  Advanced Micro Devices, Inc. [AMD/ATI] Kabini HDMI/DP Audio
           +-02.0  Advanced Micro Devices, Inc. [AMD] Device 156b
           +-02.2-[01]----00.0  Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter
           +-02.3-[02]----00.0  Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
           +-02.5-[03]----00.0  Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader
           +-08.0  Advanced Micro Devices, Inc. [AMD] Device 1537
           +-10.0  Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller
           +-11.0  Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode]
           +-12.0  Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller
           +-13.0  Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller
           +-14.0  Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller
           +-14.2  Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller
           +-14.3  Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge
           +-18.0  Advanced Micro Devices, Inc. [AMD] Device 1580
           +-18.1  Advanced Micro Devices, Inc. [AMD] Device 1581
           +-18.2  Advanced Micro Devices, Inc. [AMD] Device 1582
           +-18.3  Advanced Micro Devices, Inc. [AMD] Device 1583
           +-18.4  Advanced Micro Devices, Inc. [AMD] Device 1584
           \-18.5  Advanced Micro Devices, Inc. [AMD] Device 1585
tc@box:~$
and then used powertop to see/swich the bad/good settings. For my peace of mind, I sorted the powertop actions to be done by connections:
Code: [Select]
# 000:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1566]
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'

#00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Mullins [Radeon R4/R5 Graphics] [1002:9851]
echo 'auto' > '/sys/bus/pci/devices/0000:00:01.0/power/control'

#00:01.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Kabini HDMI/DP Audio [1002:9840]
echo "HDMI/DP Audio is OK"

#00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:156b] <- APU
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control'

#00:08.0 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Device [1022:1537]
echo 'auto' > '/sys/bus/pci/devices/0000:00:08.0/power/control'

#00:10.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller [1022:7814]
echo 'auto' > '/sys/bus/pci/devices/0000:00:10.0/power/control'

#00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7804]
echo 'auto' > '/sys/bus/pci/devices/0000:00:11.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:11.0/ata1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:11.0/ata2/power/control'
echo 'auto' > '/sys/block/sda/device/power/control'
echo 'med_power_with_dipm' > '/sys/class/scsi_host/host0/link_power_management_policy'
echo 'med_power_with_dipm' > '/sys/class/scsi_host/host1/link_power_management_policy'

#00:12.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller [1022:7808]
echo 'auto' > '/sys/bus/pci/devices/0000:00:12.0/power/control'

#00:13.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller [1022:7808]
echo 'auto' > '/sys/bus/pci/devices/0000:00:13.0/power/control'

#00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:780b]
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.0/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-0/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-1/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-2/device/power/control'

#00:14.2 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller [1022:780d]
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.2/power/control'
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';

#00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:780e]
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.3/power/control'

#00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Device [1022:1580] /1581/1582/1583/1584/1585
echo 'auto' > '/sys/bus/pci/devices/0000:00:18.0/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:18.1/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:18.2/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:18.3/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:18.4/power/control'
echo 'auto' > '/sys/bus/pci/devices/0000:00:18.5/power/control'

#01:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723]
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'

#02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller [10ec:8136]
echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control'

#03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader [10ec:5229]
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control'

#Runtime PM for I2C Adapter i2c-6 (Radeon i2c bit bus 0x90) / 91/92/93/94/95/96/97
echo 'auto' > '/sys/bus/i2c/devices/i2c-3/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-4/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-5/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-6/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-7/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-8/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-9/device/power/control'
echo 'auto' > '/sys/bus/i2c/devices/i2c-10/device/power/control'

# VM writeback timeout;
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'

#Autosuspend for USB device HP Webcam [Generic]
echo 'auto' > '/sys/bus/usb/devices/2-1.2/power/control'

#Autosuspend for USB device Bluetooth Radio  [Realtek ]
echo 'auto' > '/sys/bus/usb/devices/1-1.3/power/control'

#Autosuspend for USB device PS/2+USB Mouse [3-2]
## echo 'auto' > '/sys/bus/usb/devices/3-2/power/control'

when the battery will be full charged 100% I will start testing.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 24, 2020, 02:31:11 PM
By the way, results of the governor job can be checked in
Code: [Select]
cat /sys/devices/system/cpufreq/policyX/stats/time_in_state
Thanks. I think you use another tinycore kernel version, because for me the path is
Code: [Select]
tc@box:~$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
1800000 11498
1600000 4323
1400000 10918
1200000 63785
1000000 1078128
tc@box:~$
anyway is near 94% in lower frequency.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 24, 2020, 03:04:24 PM
wow, just started powertop again, after fixed guvernator to powersave:
Code: [Select]
The battery reports a discharge rate of 8.95 W
The power consumed was 171 J
The estimated remaining time is 2 hours, 19 minutes
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 24, 2020, 05:39:51 PM
Test finished. With wire(cable) network, using the lower CPU frequency (1GHz) forced by governor = powersave, with only firefox running (with 1-3 tabs) and reading just text (httml docs), and all tricks suggested by powertop (to sleep not used devices): battery depleted in 2h 24' (144 minutes from 100% until 4%).
it is similar with win10 (156 minutes from 100% until 7%). it seams that on laptop win10 is better by default to manage the power consumption.

PS: I do not try to think about how fast laptop will shut-down if is on wireless, with sound watching a movie.
Title: Re: battery depleted too fast with just firefox + flwm
Post by: jazzbiker on May 24, 2020, 11:44:45 PM
By the way, results of the governor job can be checked in
Code: [Select]
cat /sys/devices/system/cpufreq/policyX/stats/time_in_state
Thanks. I think you use another tinycore kernel version, because for me the path is
Code: [Select]
tc@box:~$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
1800000 11498
1600000 4323
1400000 10918
1200000 63785
1000000 1078128
tc@box:~$
anyway is near 94% in lower frequency.

Hi, nick65go!

Sorry, it was a typo. My bad, I was browsing /sys with mc and didn't checked the command, just typed it here. You caught the idea, nevertheless it is wrong to propose untested commands, this can cause unexpected consequencies. Sorry.

And yeah! testdrive was exciting! My congratulations! You've prolonged the battery life more than twice!
Thanks a lot for spending Your time and battery (no one lives forever, and batteries too ), I hope this was interesting and usefull for many readers, and will make our overheated world a little bit cooler.

Cheers :)
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 25, 2020, 11:43:12 AM
@jazzbiker: Thank you for your kind words! :)
Now that I know what commands to issue, I try to write a script for my laptop, to be executed from /home/tc/.X.d/If someone else what to publish a more generic script, I will gladly test it.Basically it is about to run the script with a parameter ("auto" for battery, or "on" for power cable), something like
Code: [Select]
echo $1 >  /sys/bus/pci/device/*/power/controlwhere * could eventual be restricted to some mask like 0000:??:??.? or 0000:##:##.#

and add (maybe redundant, but worth to have it):
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'echo 'auto' > '/sys/block/sd?/device/power/control'
echo 'med_power_with_dipm' > '/sys/class/scsi_host/host?/link_power_management_policy'
echo 'auto' > '/sys/bus/i2c/devices/i2c-?/device/power/control'
echo 'auto' > '/sys/bus/usb/devices/?/power/control'
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 25, 2020, 11:54:58 AM
Here below is why my UEFI (badly written by HP,as usually!) is misleading linux, on my laptop.This info was from reading with
Code: [Select]
tc@box:~$ dmesgACPI BIOS Warning (bug): Optional FADT field Pm2ControlBlock has valid Length but zero Address: 0x0000000000000000/0x1 (20190816/tbfadt-615)
...
BIOS may not properly restore RDRAND after suspend, hiding RDRAND via CPUID. Use rdrand=force to reenable.
...
ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
...
acpi PNP0A03:00: _OSC: platform does not support [PME LTR] <- wrong, it does!
pci 0000:00:12.0: PME# does not work under D3, disabling it
pci 0000:00:13.0: PME# does not work under D3, disabling it
   00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 39)
   00:13.0 USB c ontroller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 39)

Trying to unpack rootfs image as initramfs..
AMD-Vi: AMD IOMMUv2 functionality not available on this system <--??

ata1.00: LPM support broken, forcing max_power
   ata1.00: ATA-9: ST1000LM024 HN-M101MBB, 2BA30001, max UDMA/133  <--Realy? should be SATA2!!
      scsi 0:0:0:0: Direct-Access     ATA      ST1000LM024 HN-M 0001 PQ: 0 ANSI: 5
      sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
      sd 0:0:0:0: [sda] 4096-byte physical blocks
   ata2.00: ATAPI: hp DVDRW  SU208GB, HH00, max UDMA/100
     scsi 1:0:0:0: CD-ROM  hp DVDRW  SU208GB   HH00 PQ: 0 ANSI: 5
     sr 1:0:0:0: [sr0] scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray

hp_wmi: query 0xd returned error 0x5

Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 25, 2020, 05:06:04 PM
and here is the generic script, according to powertop:
Code: [Select]
tc@box:~$ for i in `ls /sys/bus/pci/devices`; do cat /sys/bus/pci/devices/$i/power/control; done;
tc@box:~$ for i in `ls /sys/bus/pci/devices`; do echo "auto" | sudo tee /sys/bus/pci/devices/$i/power/control; done;

tc@box:~$ for i in `ls /sys/bus/i2c/devices`; do cat /sys/bus/i2c/devices/$i/device/power/control; done;
tc@box:~$ for i in `ls /sys/bus/i2c/devices`; do echo "auto" | sudo tee /sys/bus/i2c/devices/$i/device/power/control; done;

tc@box:~$ for i in `ls /sys/bus/usb/devices | grep usb`; do cat /sys/bus/usb/devices/$i/power/control; done;
tc@box:~$ for i in `ls /sys/bus/usb/devices | grep usb`; do echo "auto" | sudo tee /sys/bus/usb/devices/$i/power/control; done;
Title: Re: battery depleted too fast with just firefox + flwm
Post by: nick65go on May 25, 2020, 06:30:26 PM
I think now I have an optimized script. Maybe is useful for someone. you are welcome to improve it.
Code: [Select]
#!/bin/sh
# lower energy consumption

echo "auto" | sudo tee /sys/block/sda/device/power/control
echo 1500 | sudo tee /proc/sys/vm/dirty_writeback_centisecs

for g in `ls /sys/module/snd*/parameters/power_save`; do echo 1 | sudo tee $g; done;
for h in `ls /sys/bus/pci/devices/*/ata*/power/control`; do echo "auto" | sudo tee $h; done;
for i in `ls /sys/bus/pci/devices/*/power/control`; do echo "auto" | sudo tee $i; done;
for j in `ls /sys/bus/i2c/devices/*/device/power/control`; do echo "auto" | sudo tee $j; done;
for k in `ls /sys/bus/usb/devices/*//power/control`; do echo "auto" | sudo tee $k; done;
for m in `ls /sys/class/scsi_host/*/link_power_management_policy`; do echo "med_power_with_dipm" | sudo tee $m; done;