Laptop Power Management?


New Member

Reaction score: 5
Messages: 19

I have seen (and posted to) this thread. I have read and followed this post. I have seen and tried to apply Vermaden's advice.
My hardware is Huawei Matebook13 WRT-WX9 2019 model, 8G LPDDR3, 512G Samsung MZVLB512HAJQ PCIe SSD, integrated Intel graphics plus Nvidia Geforce MX150. The BIOS version is 1.03; I have downloaded the latest available v. 1,17 but the tools for updating are all Windows™, and the first thing I did with this machine was totally hose the W10Home install. On the F2 "BIOS" setup menu there are no options for acpi, video cards, or any specific USB devices.
$ uname -bimsv
FreeBSD FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021  amd64 GENERIC 155cca3fc70bfdc02f8a49ba411fadf3d9f72e51

and I'm using xfce with lightdm. I have noatime as an option on all SSD volumes mounted by /etc/fstab . I'm not sure that my problem is lack of cpu throttling:
$ sysctl dev.cpu.{0,1,2,3}.cx_usage
dev.cpu.0.cx_usage: 5.72% 62.72% 31.54% last 2603us
dev.cpu.1.cx_usage: 1.96% 18.62% 79.41% last 8374us
dev.cpu.2.cx_usage: 0.81% 39.02% 60.16% last 17796us
dev.cpu.3.cx_usage: 1.67% 26.18% 72.14% last 2311us

$ sudo powermon
                  Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
                        (Arch: Kaby Lake, Limit: 12W)

   1.32W [=======>                                                           ]

Package:           Uncore:             x86 Cores:          GPU:
Current: 1.32W     Current: 0.93W      Current: 0.02W      Current: 0.37W
Total: 41.74J      Total: 29.24J       Total: 0.80J        Total: 11.71J

$ top
last pid: 58230;  load averages:  0.37,  0.22,  0.09; b up 0+00:08:48  06:36:18
77 processes:  1 running, 76 sleeping
CPU:  0.1% user,  0.0% nice,  0.1% system,  0.0% interrupt, 99.8% idle
Mem: 318M Active, 156M Inact, 615M Wired, 332M Buf, 6544M Free

16596 user          3  20    0   219M    94M select   2   0:15   0.74% Xorg
52856 user          4  20    0    63M    32M select   4   0:03   0.59% wrapper-
17245 user          4  20    0    82M    44M select   7   0:02   0.28% xfce4-te
58230 user          1  20    0    14M  3820K CPU7     7   0:00   0.12% top
29551 user          8  20    0   211M    82M select   0   0:02   0.11% xfwm4
54413 user          1  20    0    47M    28M select   5   0:00   0.01% python3.
91785 root          1  20    0    13M  2256K select   3   0:00   0.01% powerd
29725 user          4  20    0    68M    33M select   1   0:00   0.00% xfsettin
28911 user          1  20    0    24M  4072K select   2   0:00   0.00% gpg-agen
30856 user          4  20    0    85M    44M select   2   0:03   0.00% xfce4-pa
52594 user          4  20    0   115M    68M select   2   0:02   0.00% wrapper-
31349 user          4  20    0   232M   139M select   4   0:01   0.00% xfdeskto
46350 user          4  20    0   123M    27M select   3   0:01   0.00% xfce4-vo

I pulled out charger plug, then 2'30" later plugged it back in.

$ tail /var/log/messages
Apr 26 09:18:33 bessie power_profile[42195]: changed to 'economy'
Apr 26 09:18:33 bessie kernel: acpi_tz0: _CRT value is absurd, ignored (-273.1C)
Apr 26 09:20:07 bessie power_profile[53747]: changed to 'performance' 
Apr 26 09:20:07 bessie kernel: acpi_tz0: _CRT value is absurd, ignored (-273.1C)

which might indicate some tinkering is needed with the -i and -r values for powerd

$ acpiconf -i 0 | grep rate
Present rate:        827 mA (9355 mW)  ### on battery

$ acpiconf -i 0 | grep rate
Present rate:        55 mA (634 mW)  ### on charge

Now if that is load out of the battery, I would have expected to see on charge a load in to the battery, i.e. a negative number.

[EDIT] Sorry, I just tried a higher powered charger and it's definitely increasing the battery indicator but I get
Present rate: 1080 mA (12542 mW)
so it's not like the old fashioned ammeter, it doesn't tell which direction the current goes :(

Advice is: Load your vendor's acpi(4) modules:
Since my platform is a) new, and b) not mainstream, I would not have expected any specific acpi module, but the system seems to expect some generic acpi calls. I'm having trouble understanding where and what these might be.

$ ls /boot/kernel | grep acpi

man acpi() includes this gem:
Note that the acpi driver is automatically loaded by the loader(8)...
What is "the" acpi driver? I suspect something might be missing on my system:

$ cat /boot/defaults/loader.conf | grep -B1 -A1 -i acpi

###  ACPI settings  ##########################################
acpi_dsdt_load="NO"        # DSDT Overriding
acpi_dsdt_type="acpi_dsdt"    # Don't change this
                # Override DSDT in BIOS by this file ### this file does not exist
acpi_video_load="NO"        # Load the ACPI video extension driver

$ dmesg | grep -i acpi
acpi_ec1: <Embedded Controller: GPE 0x50, ECDT> port 0x62,0x66 on acpi0
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1808-0x180b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 28.0 on pci0
pci1: <ACPI PCI bus> on pcib1
pcib2: <ACPI PCI-PCI bridge> at device 29.0 on pci0
pci2: <ACPI PCI bus> on pcib2
acpi_button0: <Power Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
acpi_tz0: _CRT value is absurd, ignored (-273.1C)
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
acpi_syscontainer0: <System Container> on acpi0
acpi_acad0: <AC Adapter> on acpi0
acpi_lid0: <Control Method Lid Switch> on acpi0
battery0: <ACPI Control Method Battery> on acpi0
acpi_tz0: _CRT value is absurd, ignored (-273.1C)
iicbus0: <Philips I2C bus (ACPI-hinted)> on ig4iic0
iicbus1: <Philips I2C bus (ACPI-hinted)> on ig4iic1
acpi_wmi0: <ACPI-WMI mapping> on acpi0
acpi_wmi0: cannot find EC device
acpi_wmi1: <ACPI-WMI mapping> on acpi0
acpi_wmi1: cannot find EC device
acpi_wmi1: Embedded MOF found
ACPI: \134_SB.WFDE.WQCC: 1 arguments were passed to a non-method ACPI object (Buffer) (20201113/nsarguments-361)
acpi_wmi2: <ACPI-WMI mapping> on acpi0
acpi_wmi2: cannot find EC device
acpi_wmi2: Embedded MOF found
ACPI: \134_SB.WFTE.WQCC: 1 arguments were passed to a non-method ACPI object (Buffer) (20201113/nsarguments-361)
acpi_wmi3: <ACPI-WMI mapping> on acpi0
acpi_wmi3: cannot find EC device
acpi_wmi3: Embedded MOF found
ACPI: \134_SB.AMW0.WQBA: 1 arguments were passed to a non-method ACPI object (Buffer) (20201113/nsarguments-361)
acpi_dock0: <ACPI Docking Station> on acpi0
acpi_wmi4: <ACPI-WMI mapping> on acpi0
acpi_wmi4: cannot find EC device
acpi_tz0: _CRT value is absurd, ignored (-273.1C)

I have suspected all along that my secondary nvidia gpu might be powered on. I have added this line to /boot/loader.conf :

I installed acpi_call and loaded it: when I attempt to disable the nvidia gpu with
there is a fail on all lines, but this may be just that the bus|device is not properly specified.

I have added these two lines to /etc/rc.local
/usr/sbin/usbconfig -u 0 -a 2 power_off ## camera
/usr/sbin/usbconfig -u 0 -a 3 power_save ## wlan
This turns the camera off, cheese says No device found. But it also kills wifi stone dead, as without power the driver can't be loaded...

At the risk of provoking the wrath of the Moderator I can compare performance with my current daily drive, Debian 10.7, also xfce with lightdm, dual booted on this same h/w. Playing a 50 minute 640x360 h264 movie at fullscreen with smplayer, on Debian the battery drops from 80% to 69%; on Freebsd same movie, same player, battery drops from 80% to 58%, twice the consumption. Both systems use S3 suspend on lid switch, and both systems sleep equally soundly, 0.3%/hour battery usage. On Freebsd the keys for display brightness work better than Debian, it goes down dimmer and still readable.

How can I tell if the nvidia gpu is really powered off?
What else can be consuming power?


New Member

Reaction score: 5
Messages: 19

In the absence of replies I've done some more digging:

$ sudo pciconf -l -cc  -v | grep -B1 -A18 NVIDIA
vgapci1@pci0:1:0:0:    class=0x030200 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1d10 subvendor=0x19e5 subdevice=0x3e09
    vendor     = 'NVIDIA Corporation'
    device     = 'GP108M [GeForce MX150]'
    class      = display
    subclass   = 3D
    cap 01[60] = powerspec 3  supports D0 D3  current D0  <<<<<<<<<<<<<<<<<<<<< ???!!!
    cap 05[68] = MSI supports 1 message, 64 bit
    cap 10[78] = PCI-Express 2 endpoint max data 256(256) RO NS
                 max read 512
                 link x4(x4) speed 8.0(8.0) ASPM disabled(L0s/L1) ClockPM enabled
    ecap 0002[100] = VC 1 max VC0
    ecap 0018[250] = LTR 1
    ecap 001e[258] = L1 PM Substates 1
    ecap 0004[128] = Power Budgeting 1
    ecap 0001[420] = AER 2 0 fatal 0 non-fatal 0 corrected
    ecap 000b[600] = Vendor [1] ID 0001 Rev 1 Length 36
                 0b 00 01 90 01 00 41 02 02 00 41 01 01 18 00 00
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                 00 00 00 00
    ecap 0019[900] = PCIe Sec 1 lane errors 0

$ sudo sysctl hw.pci.do_power_nodriver=3
hw.pci.do_power_nodriver: 3 -> 3

But the Nvidia card remains ON. pciconf reports several device turned OFF. I did not believe that installing the nvidia driver would allow me to switch it off: Nvidia are only interested in having me use their gpu and not any other that might be on my hardware.
pkg install nvidia-driver installs version 460.67 for me, and disrupts xfce on my intel gpu to the point it is unusable. The install also gives me docs at /usr/local/share/doc/NVIDIA_GLX-1.0/ which include the following:

Power Management

All notebook NVIDIA GPUs support power management, both S3 (also known as "Standby" or "Suspend to RAM") and S4 (also known as "Hibernate", "Suspend to Disk" or "SWSUSP").

Known Notebook Issues
ACPI is not currently supported on FreeBSD As a result, ACPI hotkey events are not supported.

Appendix A
... Some designs incorporating supported GPUs may not be
compatible with the NVIDIA FreeBSD driver: in particular, notebook and
all-in-one desktop designs with switchable (hybrid) or Optimus graphics will
not work if means to disable the integrated graphics in hardware are not

Note nothing about power management D0 or D3; ACPI not supported On FreeBSD?? I can accept (sort of) the claim thatOptimus gpus will not work if the Intel cannot be switched off. I don't mind having one or the other, but right now I don't have an external monitor, and I'd just like to use the internal gpu+monitor without nvidia sucking my battery dry.


Son of Beastie

Reaction score: 2,083
Messages: 2,644

This is all I have.
powerd_flags="-a hiadaptive -b adaptive"



Well-Known Member

Reaction score: 192
Messages: 485

I think vga(4), a generic video card driver, is attached. So the sysctl hw.pci.do_power_nodriver does not apply.

What is "the" acpi driver?
acpi(4) is part of the kernel file, so probably you can see it in the output of kldstat -v | grep acpi.