Linux on the X220

Discussion in 'Lenovo' started by ksvjdsvagff, May 3, 2011.

Thread Status:
Not open for further replies.
  1. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    Thanks for explaining in detail what you meant, I understand now where you're coming from. Here's the problem though: the same version number across two different distributions does not indicate the same functionality. Distributors tend to apply custom patches to fix their favorite bugs. Red Hat in particular, and by extension Fedora, has a large body of developers that customize their packages. Fedora kernel typically has hundreds of patches on top of the mainline kernel version, so its behavior can be quite different to other distros running nominally the same kernel version.

    Also, a final update regarding my search for the source of the idle power consumption regression in the 3.0 kernel. I found a workaround that brings the power back down to under 8W: add i915.i915_enable_rc6=1 to the kernel command line in the bootloader. 1 used to be the default in the recent 2.6 kernels, but in the final 3.0 kernel the default was changed to 0. A quick Google search finds that the change is deliberate and that the developers were aware of its negative consequences to power usage. They changed the default anyway because some systems would apparently crash on boot otherwise. This is considered a temporary regression until the underlying cause of the crash on those systems is resolved through less drastic means. I just wish that this had been documented somewhere prominently so that I wouldn't have spent a week researching the issue.

    If you think you might be suffering from this power consumption problem, a quick:

    run as root should help to identify it. If you get a 1, you should be fine.
     
  2. GomJabbar

    GomJabbar Notebook Consultant

    Reputations:
    208
    Messages:
    290
    Likes Received:
    4
    Trophy Points:
    31
    Last edited by a moderator: May 8, 2015
  3. john46

    john46 Notebook Guru

    Reputations:
    18
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    15
    In a default ubuntu 11.04 install (not using unity, using gnome classic and mutter instead - mutter is like compiz) powertop reports while on idle with nothing open, about 13-14W :(
    If using metacity instead of mutter (so no 3d), then it drops to 12-13. Still pretty bad. And that's with the screen dimmed to about half and wifi/bluetooth off.

    Don't know how to drop it more.

    Btw is there a way to monitor consumption in linux other than powertop? (because powertop gives acpi estimates, but I think the battery itself reports its real consumption somehow)

    Oh, its a T420s

    The funny thing is that wakeups are low - I can make them be 10 while on idle when I close everything in powertop, so I guess the consumption is not caused by the cpu or something waking up the cpu.
     
  4. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    The only thing that amazes me about this link is that the guy was getting two hours before 3.0 and didn't bother to fix it. Even the four hour he's getting now sound a little low for Acer 1810TZ, which IIRC is a CULV-based notebook.
     
    Last edited by a moderator: May 8, 2015
  5. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    Have you read my post two messages above your post? What does

    Code:
    cat /sys/module/i915/parameters/i915_enable_rc6
    give you?

    As far as I know, ACPI estimates come from the battery itself, so there is no other way.

    T420s has an option of a discrete GPU, doesn't it? Do you have one? Is it powered on by any chance (you might want to try disabling it in the BIOS).

    Agreed. On my X220 an identical-looking problem was caused by i915_enable_rc6 being 0, which disables power management in the Sandy Bridge GPU, and was fixed by appending i915.i915_enable_rc6=1 to the kernel command line.
     
  6. john46

    john46 Notebook Guru

    Reputations:
    18
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    15
    Hey mil2

    Yes I read it. rc6 0 in my kernel, but i tried with 1, didn't see any difference (at least in powertop). I'll have to test a bit more.

    I have integrated gpu, not the discrete one, and i5 2520
     
  7. john46

    john46 Notebook Guru

    Reputations:
    18
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    15
    Ok I've done some more exhaustive tests.

    Configuration:

    - USB auto-suspend enabled (through powertop)
    - SATA link power management enabled (through powertop)
    - Runtime Device Power Management enabled (through powertop)
    - Wireless and bluetooth disabled
    - I use thinkfan for fan control and it disables the fan completely under 50 Celsius, so the fan was not running.
    - The disk is not running since there is no activity (parked)
    - The screen is dimmed to the level that gnome-screensaver dims it (not very usable under normal conditions, I'd say it's probably 3)

    With the above configuration, I managed to have powertop say that I'm 100% at C4 state and 100% at the lowest P-state (800Mhz) and wakeups under 8, so no cpu activity at all.

    The consumption under these conditions is 9.1W

    I repeated the tests many times, after reboots etc, and I did not notice any difference whatsover using i915_enable_rc6 ! I get the same readings no matter what that parameter is.

    Other interesting facts:
    -> The 320GB Hitachi 7200rpm disk if spinning raises the consumption about 0.8W. Time to get an SSD I guess.
    -> A 'workable' dim setting (maybe 6 or 7) adds about 0.7 - 0.8W also.
    -> I couldn't get an estimate of how much consumption the fan causes, but I guess it wouldn't be much for a 1000-2000RPM spin (maybe 0.3W)
     
  8. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    This is a little higher than I would want it to be, but not much higher. Perhaps the larger screen on t420s makes the difference. FYI, I just booted my x220 off a Ubuntu 11.04 live USB key and it idled at 8.1W. By comparison, my Gentoo Linux build idled at about 7.2-7.5W (with wifi on).

    You are definitely not having the i915_enable_rc6 problem that I had. I couldn't bring power consumption under 12W when I had that problem. Also, you don't have any external devices plugged into your laptop while testing, do you? E.g., an external display can make as much as 2W of difference.

    I'm going to disappoint you: SSD doesn't really help all that much with power. I have Intel 320 in my x220 and I see the same 0.8W difference between standby and active/idle. Only in an SSD you can't really tell by listening, you need to run hdparm -C to query the drive state. Frankly, so far I've found the whole SSD experience rather underwhelming. Sure, the laptop boots faster, but how often does one boot?

    If you feel like experimenting with it a little more, I would suggest booting a few different distros off USB keys to see where they stand on power consumption. It sure helped me check if my own build was where it should be. I can tell you that on my x220 Fedora 15 seemed to have a slight (0.5W?) edge over Ubuntu 11.04.
     
  9. GomJabbar

    GomJabbar Notebook Consultant

    Reputations:
    208
    Messages:
    290
    Likes Received:
    4
    Trophy Points:
    31
    I am curious what you are using to get the wattage currently used.

    On a second note, I just read this about a regression in the 2.6.38 kernel regarding power consumption on laptops.

    [Phoronix] The Leading Cause Of The Recent Linux Kernel Power Problems

    EDIT: I figured out the wattage thing. Had to unplug the AC adapter for powertop to display wattage. Also found you can use the following command to get mA used:
    grep rate /proc/acpi/battery/BAT0/state
     
  10. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    Yes, this was discussed earlier in this thread. In my experience, this particular issue is way overblown. I tested three different Thinkpads for that problem and *none* of them (x220 included) exhibited it (or, rather, they all disabled pcie_aspm by default, but forcefully reenabling it resulted in no further power savings).

    Exactly. The power supply must be unplugged. Actually, I have a question to other Thinkpad users about power usage. When you let powertop run long enough (I'd say about five minutes), it starts displaying a long-term average power draw in addition to the current draw. On my x220 these two are way from each other, i.e., current draw is in the 7.5-8W range, whereas the long-term average shows 15W! On older Thinkpads there was also a discrepancy between these estimates, but it was never by a factor of two!

    I'm guessing that the current draw is calculated in powertop as "present rate*present voltage", whereas the long-term average is from the sampling of "remaining capacity*present voltage" over a period of time (and should, thus, be more accurate).

    I wrote a script that calculates these values outside of powertop:

    Code:
    #!/bin/sh
    
    BAT=/sys/class/power_supply/BAT0
    INTERVAL=30
    
    time_start=`date +%s`
    if [ -f /sys/class/power_supply/BAT0/energy_now ]; then
            energy_start=$((`cat /sys/class/power_supply/BAT0/energy_now`/1000))
    else
            energy_start=$(((`cat /sys/class/power_supply/BAT0/charge_now`/1000)*(`cat /sys/class/power_supply/BAT0/voltage_now`/1000)/1000))
    fi
    
    time_last=$time_start
    energy_last=$energy_start
    
    echo "Power consumption:"
    
    while true; do
            sleep $INTERVAL
    
            if [ -f /sys/class/power_supply/BAT0/power_now ]; then
                    power_now=$((`cat /sys/class/power_supply/BAT0/power_now`/1000))
                    energy_now=$((`cat /sys/class/power_supply/BAT0/energy_now`/1000))
            else
                    voltage_now=$((`cat /sys/class/power_supply/BAT0/voltage_now`/1000))
                    current_now=$((`cat /sys/class/power_supply/BAT0/current_now`/1000))
                    power_now=$((voltage_now*current_now/1000))
                    energy_now=$(((`cat /sys/class/power_supply/BAT0/charge_now`/1000)*voltage_now/1000))
            fi
            time_now=`date +%s`
    
            power_last=$(((energy_last-energy_now)*3600/(time_now-time_last)))
            power_start=$(((energy_start-energy_now)*3600/(time_now-time_start)))
    
            echo $power_now $power_last $power_start | awk '{printf "Now: %.3f, since last: %.3f, since start: %.3f\n", $1/1000, $2/1000, $3/1000}'
    
            energy_last=$energy_now
            time_last=$time_now
    done
    You can run it as an ordinary user; it just reads some files from /sys. Every 30 seconds it displays current power consumption, average over the last 30 seconds (configurable via INTERVAL), and average since the script was started (it helps to let it run for a few minutes to get a good average). Are you seeing the same discrepancy as I am?
     
Loading...
Thread Status:
Not open for further replies.

Share This Page