cpuidle

I am looking at ways to reduce power. I have the on-demand cpufreq
governor. I am looking now at cpuidle.

The AM335x Linux Power Management User Guide [1] says that there are
two C-states however I can't find cpuidle on the BBB ([2]) running the
[3] kernel.

Also I cannot find a Debian package to show cpuidle (the cpupower util
is available on Fedora and Ubuntu but seemingly not in Debian).

Any suggestions? I wonder if the kernel I am using is not built with cpuidle?

Thanks.

[1] http://processors.wiki.ti.com/index.php/AM335x_Power_Management_User_guide
[2] /sys/devices/system/cpu
[3] Linux beaglebone 4.1.10-bone16 #1 Sun Oct 4 08:00:05 UTC 2015
armv7l GNU/Linux

I am looking at ways to reduce power. I have the on-demand cpufreq
governor. I am looking now at cpuidle.

The AM335x Linux Power Management User Guide [1] says that there are
two C-states however I can't find cpuidle on the BBB ([2]) running the
[3] kernel.

debian@beaglebone:~$ ls /sys/devices/system/cpu/*
/sys/devices/system/cpu/kernel_max /sys/devices/system/cpu/possible
/sys/devices/system/cpu/offline /sys/devices/system/cpu/present
/sys/devices/system/cpu/online /sys/devices/system/cpu/uevent

/sys/devices/system/cpu/cpu0:
cpufreq crash_notes_size online subsystem uevent
crash_notes of_node power topology

/sys/devices/system/cpu/cpufreq:
ondemand

/sys/devices/system/cpu/power:
async runtime_active_kids runtime_status
autosuspend_delay_ms runtime_active_time runtime_suspended_time
control runtime_enabled runtime_usage
debian@beaglebone:~$ uname -r
4.1.12-ti-r29

Also I cannot find a Debian package to show cpuidle (the cpupower util
is available on Fedora and Ubuntu but seemingly not in Debian).

Any suggestions? I wonder if the kernel I am using is not built with cpuidle?

sudo apt-get update
sudo apt-get install linux-image-4.1.12-ti-r29
sudo reboot

Regards,

Yeah good point. :wink:

root@beaglebone:~# uname -r ; ls -l /sys/devices/system/cpu/cpu0/cpuidle/state0/
4.1.13-ti-r29.4
total 0
-r--r--r-- 1 root root 4096 Nov 13 17:46 desc
-rw-r--r-- 1 root root 4096 Nov 13 17:46 disable
-r--r--r-- 1 root root 4096 Nov 13 17:46 latency
-r--r--r-- 1 root root 4096 Nov 13 17:46 name
-r--r--r-- 1 root root 4096 Nov 13 17:46 power
-r--r--r-- 1 root root 4096 Nov 13 17:46 residency
-r--r--r-- 1 root root 4096 Nov 13 17:46 time
-r--r--r-- 1 root root 4096 Nov 13 17:46 usage

https://github.com/RobertCNelson/ti-linux-kernel-dev/commit/7df6a18cbcd567712edd1e1a4a774742d510dbe3

Regards,

There doesn't seem to be..

https://packages.debian.org/search?suite=sid&arch=any&mode=exactfilename&searchon=contents&keywords=cpupower

Since it's based inside the kernel.org's kernel tree, do we want
version specifi:

cpupower-v4.1
cpupower-v4.2

Or just:

cpupower (always built on kernel.org HEAD)

package?

Regards,

[same message again, now to the mailing list]

I did
apt-get install linux-image-4.1.13-ti-r30

It installed fine. Apt suggested that I install a firmware package
(with 4.1.13-ti-r30 in the name). I did that - maybe I should not, it
was the first time I installed a firmware package on the BBB.

Anyway, now the BBB does not boot. I have been doing all my work using
a MicroSD card. The log is below. Basically the boot process does not
complete, and I see the asterisks at the last line moving right and
left and the time in seconds being incremented continuously on the
line "A start job is running for LSB:".

My previous kernel, that worked very well, was 4.1.10-bone16.

Any ideas?

Yeah good point. :wink:

root@beaglebone:~# uname -r ; ls -l /sys/devices/system/cpu/cpu0/cpuidle/state0/
4.1.13-ti-r29.4
total 0
-r--r--r-- 1 root root 4096 Nov 13 17:46 desc
-rw-r--r-- 1 root root 4096 Nov 13 17:46 disable
-r--r--r-- 1 root root 4096 Nov 13 17:46 latency
-r--r--r-- 1 root root 4096 Nov 13 17:46 name
-r--r--r-- 1 root root 4096 Nov 13 17:46 power
-r--r--r-- 1 root root 4096 Nov 13 17:46 residency
-r--r--r-- 1 root root 4096 Nov 13 17:46 time
-r--r--r-- 1 root root 4096 Nov 13 17:46 usage

config: cpu_idle · RobertCNelson/ti-linux-kernel-dev@7df6a18 · GitHub

[same message again, now to the mailing list]

I did
apt-get install linux-image-4.1.13-ti-r30

It installed fine. Apt suggested that I install a firmware package
(with 4.1.13-ti-r30 in the name). I did that - maybe I should not, it
was the first time I installed a firmware package on the BBB.

Anyway, now the BBB does not boot. I have been doing all my work using
a MicroSD card. The log is below. Basically the boot process does not
complete, and I see the asterisks at the last line moving right and
left and the time in seconds being incremented continuously on the
line "A start job is running for LSB:".

My previous kernel, that worked very well, was 4.1.10-bone16.

Any ideas?

What rootfs and distro?

cat /etc/dogtag

-------------------------------------------------------------

U-Boot SPL 2014.04-00015-gb4422bd (Apr 22 2014 - 13:24:29)
reading args
spl_load_image_fat_os: error reading image args, err - -1
reading u-boot.img
reading u-boot.img

U-Boot 2014.04-00015-gb4422bd (Apr 22 2014 - 13:24:29)

I2C: ready
DRAM: 512 MiB
NAND: 0 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - readenv() failed, using default environment

Net: <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot: 0
gpio: pin 53 (gpio 53) value is 1
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
SD/MMC found on device 0
1179 bytes read in 8 ms (143.6 KiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
1661 bytes read in 36 ms (44.9 KiB/s)
debug: [/boot/vmlinuz-4.1.13-ti-r30] ...
8260280 bytes read in 503 ms (15.7 MiB/s)
debug: [/boot/initrd.img-4.1.13-ti-r30] ...
4506906 bytes read in 304 ms (14.1 MiB/s)
debug: [/boot/dtbs/4.1.13-ti-r30/am335x-boneblack.dtb] ...
59295 bytes read in 71 ms (815.4 KiB/s)
debug: [console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p1
rootfstype=ext4 rootwait coherent_pool=1M quiet] ...
debug: [bootz 0x82000000 0x88080000:44c51a 0x88000000] ...
Kernel image @ 0x82000000 [ 0x000000 - 0x7e0ab8 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Using Device Tree in place at 88000000, end 8801179e

Starting kernel ...

[ 3.371127] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 3.744796] omap-sham 53100000.sham: initialization failed.
[ 3.767060] cpu cpu0: cpu0 clock notifier not ready, retry
[ 3.908242] bone_capemgr bone_capemgr: slot #0: No cape found
[ 3.968235] bone_capemgr bone_capemgr: slot #1: No cape found
[ 4.028233] bone_capemgr bone_capemgr: slot #2: No cape found
[ 4.088234] bone_capemgr bone_capemgr: slot #3: No cape found
Loading, please wait...
fsck from util-linux 2.25.2
rootfs: recovering journal
rootfs: clean, 37364/466560 files, 331056/1955328 blocks
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.
[ 13.815623] systemd[1]: Failed to start Load Kernel Modules.
[ OK ] Mounted POSIX Message Queue File System.
[ OK ] Started LSB: controls configuration of serial ports.
[ OK ] Started Remount Root and Kernel File Systems.
[ OK ] Started udev Coldplug all Devices.
         Starting Load/Save Random Seed...
         Mounting FUSE Control File System...
         Mounting Configuration File System...
         Starting Apply Kernel Variables...
         Starting Create Static Device Nodes in /dev...
[ OK ] Listening on Syslog Socket.
         Starting Journal Service...
[ OK ] Started Journal Service.
[ OK ] Mounted Configuration File System.
[ OK ] Mounted FUSE Control File System.
[ OK ] Started Load/Save Random Seed.
[ OK ] Started Apply Kernel Variables.
[ OK ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[ OK ] Reached target Local File Systems (Pre).
         Mounting /sys/kernel/debug...
[ OK ] Started udev Kernel Device Manager.
[ OK ] Mounted /sys/kernel/debug.
[ OK ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
[ OK ] Reached target Remote File Systems.
         Starting Trigger Flushing of Journal to Persistent Storage...
         Starting LSB: controls configuration of serial ports...
         Starting LSB: Raise network interfaces....
         Starting Copy rules generated while the root was ro...
[ OK ] Started Create Volatile Files and Directories.
[ OK ] Started Copy rules generated while the root was ro.
[ 15.036404] Unable to handle kernel paging request at virtual
address fee00005
[ 15.043713] pgd = ddba0000
[ 15.046439] [fee00005] *pgd=00000000
[ 15.050053] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[ 15.055400] Modules linked in:
[ 15.058489] CPU: 0 PID: 219 Comm: setserial Not tainted 4.1.13-ti-r30 #1
[ 15.065231] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 15.071362] task: ddba7480 ti: ddb9c000 task.ti: ddb9c000
[ 15.076810] PC is at io_serial_in+0x28/0x38
[ 15.081029] LR is at serial8250_do_startup+0xd0/0x668

odd, you lose serial here, might be a gcc bug depending on your distro

Jessie:

https://paste.debian.net/333026/

So let us know the base rootfs and distro and i'll try to replicate it

Regards,

This is from a previous email, as now it does not boot:

root@beaglebone:~# cat /etc/dogtag
BeagleBoard.org Debian Image 2015-09-13

I have not made any change to either of the two uEnv.txt files in the
MicroSD card nor in the eMMC on the BBB.

The MicroSD card is fine. In fact I removed it from the BBB and put it
in a card reader connected to my Linux PC and am looking at it at the
moment to see if I have an idea. This is what I have in /boot:

On my Linux PC with the mounted MicroSD card that was on the BBB :
# ls /run/media/antonio/rootfs/boot
config-4.1.10-bone16 dtbs
initrd.img-4.1.8-bone16 System.map-4.1.6-ti-r15
vmlinuz-4.1.10-bone16
config-4.1.13-ti-r30 initrd.img-4.1.10-bone16 SOC.sh
   System.map-4.1.8-bone16 vmlinuz-4.1.13-ti-r30
config-4.1.6-ti-r15 initrd.img-4.1.13-ti-r30
System.map-4.1.10-bone16 uboot
vmlinuz-4.1.6-ti-r15
config-4.1.8-bone16 initrd.img-4.1.6-ti-r15
System.map-4.1.13-ti-r30 uEnv.txt
vmlinuz-4.1.8-bone16

I don't have that version local, but i do have the week after:

debian@beaglebone:~$ cat /etc/dogtag
BeagleBoard.org Debian Image 2015-09-20

https://paste.debian.net/333066/

That leaves: u-boot?

yours:

U-Boot SPL 2014.04-00015-gb4422bd (Apr 22 2014 - 13:24:29)

What shipped with 2015-09-20: (based on the build date, 2015-09-13 had
the same version)

U-Boot SPL 2015.10-rc3-00001-gfb375b5 (Sep 10 2015 - 10:07:48)
bad magic

U-Boot 2015.10-rc3-00001-gfb375b5 (Sep 10 2015 - 10:07:48 -0500),
Build: jenkins-github_Bootloader-Builder-222

       Watchdog enabled
I2C: ready
DRAM: 512 MiB
Reset Source: Global warm SW reset has occurred.
Reset Source: Power-on reset has occurred.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Using default environment

Net: <ethaddr> not set. Validating first E-fuse MAC
cpsw
Hit any key to stop autoboot: 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
reading uEnv.txt
1179 bytes read in 5 ms (229.5 KiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
1661 bytes read in 39 ms (41 KiB/s)
debug: [/boot/vmlinuz-4.1.13-ti-r30] ...
8260280 bytes read in 497 ms (15.9 MiB/s)
debug: [/boot/initrd.img-4.1.13-ti-r30] ...
4414791 bytes read in 290 ms (14.5 MiB/s)
debug: [/boot/dtbs/4.1.13-ti-r30/am335x-boneblack.dtb] ...
59295 bytes read in 72 ms (803.7 KiB/s)
debug: [console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p2
rootfstype=ext4 rootwait fixrtc coherent_pool=1M quiet] ...
debug: [bootz 0x82000000 0x88080000:435d47 0x88000000] ...
Kernel image @ 0x82000000 [ 0x000000 - 0x7e0ab8 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Using Device Tree in place at 88000000, end 8801179e

So what happens when you force it to boot with the microSD, thus
forcing the 2015.10-rc3 u-boot?

Regards,

I am using now a newish rev. C BBB that I got a few weeks ago. I did
what you suggested and pressed the boot button on the BBB to force the
BBB to used the uboot in the MicroSD card instead of the uboot in the
eMMC. However I still got the same problem as before, i. e., it hangs
at the last line of the log with the asterisks moving and the time
being incremented.

I am also puzzled why your boot log looks so different from mine. For
example I get the message below and you don't, and I don't get any
timestamp starting at [ 0.000000]:

[FAILED] Failed to start Load Kernel Modules.

Boot log:
https://paste.debian.net/333095/

Any ideas? Maybe you have something in uEnv.txt that I don't? Mine is unchanged.

/rootfs/uEnv.txt
https://paste.debian.net/333104/

/rootfs/boot/uEnv.txt
https://paste.debian.net/333106/

[FAILED] Failed to start Load Kernel Modules.

A missed depmod ?

Hi Robert,

I found how to get the kernel timestamps starting at [ 0.000000]:
(by removing the "quiet" option in /rootfs/boot/uEnv.txt).

If I compare my boot log with yours there are a number of differences.
One is that the entries about PRU, starting with "pruss-rproc
4a300000.pruss: 8 PRU interrupts parsed" appear at 11.6 seconds in my
log and at 25.8 seconds in yours. Something is taking a lot of time in
your boot.

One of the last log entries in my log says "Timed out waiting for
device dev-ttyGS0.device." . Any idea about what that is, and why
don't you get that error?

In any case, I reverted to the bone10 kernel by changing the line
about uname_r in /rootfs/boot/uEnv.txt so my BBB boots again.

Under low loads this patch (or something else at 4.1.13-ti-r30), have caused a dramatic power decrease on the BBB.

Disabling state1 brings it back to the same board temperature, which makes it sound like that cpuidle was not working previously. (I was not sure it it was only the /sys interface that was not available).

I still couldn’t fully determine how this affect real time latencies, but hope to provide data soon.

Thanks

I might not made obvious that I’m talking about eletric power consumption (and temperature), so this is a good thing.

Thanks,
Nuno

Good to know, thanks.

I am trying to bring power down, and have been measuring the current
going into the BBB through the 5V socket with no USB cable connected.

In my first measurement kernel idle was 300 mA. Then I installed
cpufreputils and that brought the current down to 230 mA because -
unexpectedly - just installing the Debian package changed the CPU mode
to "on-demand". Today I managed to bring the current down a further 20
mA (to about 210 mA) by disabling HDMI in boot/uEnv.txt.

I am curious now to see how much power cpuidle will save - once I have
a kernel with it.

Good to know, thanks.

I am trying to bring power down, and have been measuring the current
going into the BBB through the 5V socket with no USB cable connected.

In my first measurement kernel idle was 300 mA. Then I installed
cpufreputils and that brought the current down to 230 mA because -
unexpectedly - just installing the Debian package changed the CPU mode
to "on-demand". Today I managed to bring the current down a further 20
mA (to about 210 mA) by disabling HDMI in boot/uEnv.txt.

We enable 'performance' by default... The thought, boot as fast as we
can, by the time the rootfs loads (and cpufrequtils) we've gotten
mostly up, so safe to switch to on-demand..

Regards,

Thanks for explanation.

How much was the power decrease that you got?

I didn't measure it, but I noticed the board XTAL temperature
decreased by about 5ºC. I didn't have the board physically with me to
measure the current since then.

Hi Robert,

Are you planning to release any kernel of the "-bone" series with
cpuidle enabled or will that option be enabled only on "-ti-" kernels?