The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.
← Previous page

    Linux on the X220

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

  1. OtherSongs

    OtherSongs Notebook Evangelist

    Reputations:
    113
    Messages:
    640
    Likes Received:
    1
    Trophy Points:
    31
    I can believe "12 hrs of battery without ANY tweaks on the x230 in Ubuntu 12.04 with the 9--cell"

    Battery life hugely depends on screen brightness setting.

    I've got a X220 w/6-cell and am very pleased. Battery life of ~7 hours with somewhat dim brightness/contrast setting w/Win7.
     
  2. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    OtherSongs: Are you running linux?
     
  3. OtherSongs

    OtherSongs Notebook Evangelist

    Reputations:
    113
    Messages:
    640
    Likes Received:
    1
    Trophy Points:
    31
    Not yet on either my slightly older X220, or my very new T530 laptops.

    But I expect to try a dual Win7/Linux boot with both laptops.

    1st priority has been and continues to be, getting set up with boot SSD on both laptops.

    X220 works great with boot mSATA SSD only, and no HDD (pulled it out on X220 thereby saving ~6oz (drive + metal sled + plastic rails)); and leaving HDD bay open for occasional clone of boot SSD to temp HDD backup).

    Next few days I'll do a 2 SSD setup on my T530, boot drive in the main bay and secondary SSD in the DVD bay.

    Still undecided as to which flavor(s) of Linux I'll try with a dual boot Win/Linux setup with one or both of my laptops. Odds are that I'll 1st try dual boot (Win7/Linux) with my T530.

    When Crucial's new M500 512GB mSATA drives come out in a few months, I'll move to that on my X220 and then play around with a dual Win7/Linux boot setup on my X220 as I'll then have enough drive space on it to do that.
     
  4. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I located the problem with expresscard hotplugging (after 8 kernel builds!), and I'm working on a patch.
     
  5. 600X

    600X Endless bus ride

    Reputations:
    677
    Messages:
    813
    Likes Received:
    108
    Trophy Points:
    56
    12h on a 9c without any optimizations is NOT possible on 12.04. I tried it myself. However, 9h are possible if you install TLP. With my broken 6c, I get around 5h on Ubuntu with TLP installed.

    BTW, the M500 won't fit into the X220, the X220 has an mSATA Slot.
     
  6. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Here's a quick and dirty patch for expresscard hotplugging... this is against 3.7.7:

    Code:
    diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
    index ebb3e5f..b427aad 100644
    --- a/drivers/pci/pcie/portdrv_pci.c
    +++ b/drivers/pci/pcie/portdrv_pci.c
    @@ -225,7 +225,7 @@ static int __devinit pcie_portdrv_probe(struct pci_dev *dev,
     	 * it by default.
     	 */
     	dev->d3cold_allowed = false;
    -	if (!pci_match_id(port_runtime_pm_black_list, dev))
    +	if (pci_match_id(port_runtime_pm_black_list, dev))
     		pm_runtime_put_noidle(&dev->dev);
     
     	return 0;
    
    Also here's my 3.7.7 config: config-3.7.7.txt
     
  7. OtherSongs

    OtherSongs Notebook Evangelist

    Reputations:
    113
    Messages:
    640
    Likes Received:
    1
    Trophy Points:
    31
    Crucial's new M500 512GB mSATA SSD drive is what I said. See my above quote.

    And with regard to the 2.5" Crucial M500 SSD drive, it's hard for me to believe that it won't have a 7mm thick option. Odds are that one can just ditch the HDD?
     
  8. 600X

    600X Endless bus ride

    Reputations:
    677
    Messages:
    813
    Likes Received:
    108
    Trophy Points:
    56
    OK sorry, must have misread.
     
  9. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    In the just released 3.8 kernel there's a bug in the e1000e driver that prevents the card from waking up after the ethernet cable is plugged in for the first time after being unplugged:
    Linux-Kernel Archive: [REGRESSION 3.8-r1] broken pci irq/pm state for e1000e device
    SourceForge.net: Intel Ethernet Drivers and Utilities:

    It comes back after a suspend/resume. If you want to run 3.8, plan on using my expresscard hotplugging patch (posted earlier) and fixing this ethernet problem by reverting commit 42eca2302146fed51335b95128e949ee6f54478f

    Here's my 3.8 config: http://www.mediafire.com/file/n53m73fdhumn3t8/config-3.8.0.txt
     
  10. vlitzer

    vlitzer Newbie

    Reputations:
    0
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    5
    Thanks man.
    Can I use that config for instance while following this instructions?
    Lindqvist -- a blog about Linux and Science. Mostly.: 342. Compiling Kernel 3.8 on Debian Testing/Wheezy
    Im planning to do it on a crunchbang installation.

    thanks in advance

    EDIT: or maybe its better to use a 3.7 for avoiding the 3.8 bug?
     
  11. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Yeah I would run 3.7 unless you are familiar with building and patching the kernel and really need 3.8 for some reason. If you want me to make a patch for the e1000e driver, let me know.
     
  12. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    I've been seeing better power consumption lately, perhaps after a kernel upgrade to 3.8.4. My machine can now idle at 6.8W, according to PowerTop. That's with i7, 8 GB RAM, WiFi on, BT off, screen brightness 9, and an SSD. I did notice that the SSD must be idle to get that low; as with spinning drives, there is an almost 1W difference between an SSD in "active/idle" vs "standby" mode (hdparm -C). That's with Intel 320, BTW.
     
  13. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Can you post a screenshot of powertop's device stats?

    --

    As my X220 is getting older and I want to keep it alive longer, I'm starting to use some more aggressive fan settings. The tradeoff is more power consumption and noise. Here's my updated thinkfan.conf:
    Code:
    sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input
    (0,     0,      55)
    (1,     55,     61)
    (2,     59,     65)
    (3,     63,     69)
    (4,     67,     75)
    (5,     73,     85)
    (7,     81,     89)
    ("level disengaged",     84,     32767)
    
    The last line makes the fan run at its maximum mechanical speed. See: How to control fan speed - ThinkWiki
     
  14. OtherSongs

    OtherSongs Notebook Evangelist

    Reputations:
    113
    Messages:
    640
    Likes Received:
    1
    Trophy Points:
    31
    Odds are that all your X220 needs is 1) re-paste the cpu and/or 2) blow dust out of the heat sink fins.

    BTW, what made you choose Debian over the many other free Linux distros?

    I had problems with current Debian on desktop PC, as Debian's default install failed to install dual boot (using GRUB2) with WinXP.

    Whereas Ubuntu 12.10 properly installed dual boot on that desktop.

    My near term goal with both my laptops (see sig) is to dual boot Win7 and Linux with 2 SSD on each machine; just waiting a few more weeks to order a 480GB Crucial M500 mSATA as my new X220 boot drive. :)

    Of course, I'll move the X220's current 256GB Crucial M4 mSATA drive to my T530 (as a secondary drive on the T530, with a 2.5" M4 as boot on the T530).
     
  15. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I am trying to keep the laptop cooler so that its components last longer; this is proactive not reactive. ;)

    Debian has been my OS of choice for so many years now that I am pretty much dyed in the wool.
     
  16. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    Here you go:

    powertop2.png powertop1.png

    I've never tweaked fan settings on x220. The BIOS defaults seem to work fine for me.
     
  17. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Your fan isn't registering any power usage. What's up with that? Do you have the thinkpad_acpi module loaded? If I set my fan to level 1 as yours is in the screenshot:
    Code:
      1.68 W     1987 rpm     Laptop fan
    The thinkfan.conf I posted above is aiming to not see 90C for more than a second or two when I'm slamming the CPU. It's not because of any existing problem, per se.
     
  18. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    Powertop lacks the ability to make the per-device numbers accurate, as it can only measure the overall power consumption of the system. So it observes the changes in power consumption and attempts to correlate them with the also observed changes in the status of individual devices. The problem is that it can only query a subset of devices (e.g., connecting an external display draws power, but I don't think it's reflected anywhere on the device list). Also, some devices are correlated, e.g., CPU and fan, but not in a straightforward way: there is a hysteresis there, the correlation depends on external factors such as air temperature and humidity, etc.

    Erm, sorry for the little lecture, I'm a scientist and I'm typing this while at work :). What I meant to say is that the per-device data can't be accurate and in fact tends to be extremely inaccurate from what I've noticed (e.g., I've seen claims that idle eth0 uses 3W or something ridiculous like that), so I suggest not to pay any attention to it. My fan does in fact spin and I'm sure that it consumes some power :).
     
  19. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I'm trying to figure out where your extra ~1.5W went (you know, so that I can maybe lose it too)! :p

    The battery rate doesn't lie, I'm not doubting your overall power consumption. But I've been running 3.8 and now 3.9-rc with nowhere near 1W less draw.
     
  20. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
  21. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    I finally built 3.9.0 using your config. I had to switch a few things (ext4, sata) from modules to built-in to boot on my box (I don't use an initrd), but that was it.

    With so built kernel, powertop would show idle at 6.8W (with SSD in standby, WiFi on, BT off, brightness 9/15). So if you are unable to go that low, then I don't think that the kernel config is your problem.
     
  22. nathanvy

    nathanvy Notebook Enthusiast

    Reputations:
    0
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    5
    6.8 Watts!

    Can't wait for 3.9 to hit the Fedora repositories.

    Could you perhaps share the general gist of what's changed in your custom kernel config?
     
  23. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    I don't think there's any secret kernel option to get to 6.8W. While I use a fairly minimal kernel configuration, ALLurGroceries' more extensive config, which he made available here (see above), showed the same consumption rate on my system. And keep in mind that 6.8W is the idle rate; it does go up when I actually do something useful on the machine.

    Also, I would make sure that the BIOS is at least at version 1.29. I don't know if it changes the consumption rate, but it does fix the rate reporting bug when switching between battery and mains. I'm running BIOS 1.35, BTW.
     
  24. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    There's no secret sauce -- you don't even need special boot options anymore for pcie aspm, i915 rc6, etc.

    My kernel config started from Debian Lenny as a stripped down version for the ASUS N10J, and I've modified the same config since 2008ish for each new laptop I've owned. You can get the kernel sources for your distribution and diff their config against mine to see the exact differences. Although it originated as Debian's kernel config with stripped down options, there is nothing distro-specific about it; I run a vanilla (kernel.org) kernel on all of my machines.

    On my own X220 with 1.35 I can't break ~7W since I use a slightly more power hungry atheros wifi card, and I have an mSATA + HDD setup.
     
  25. nathanvy

    nathanvy Notebook Enthusiast

    Reputations:
    0
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    5
    Sadly I have to disagree with this. Under 3.9.8, if I don't use pcie aspm and the other i915 powersaving options then with screen brightness at minimum, bluetooth off, wifi on and nothing running but gnome, I see ~9.5 watts.

    Using the boot parameters still gives me much better power savings.
     
  26. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    I'm getting 6.8 watts without any special boot options. Kernel 3.9.7.
     
  27. nathanvy

    nathanvy Notebook Enthusiast

    Reputations:
    0
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    5
    Interesting.

    Is there a guide for compiling a vanilla kernel, and explaining what all those config options do? I'm an intermediate linux user at best. Right now I'm just running whatever kernel gets shipped via the Fedora package repos but they presumably do their own kernel mods. I would assume that that's where the power consumption difference lies.
     
  28. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    This looks like where you should start for fedora: Building a custom kernel - FedoraProject

    Some tips here: KernelBuild - Linux Kernel Newbies

    If you press the H key on any item in menuconfig or nconfig you will get some help text with a brief description. Often it will reference a .txt file in Documentation/ of the linux source tree for more complex things. You can also look for info on kernelnewbies or lkml by searching for the config symbol (CONFIG_WHATEVER). lwn.net also has very in-depth articles on kernel features, and h-online and kernelnewbies have "what's new in kernel x.y.z" that give a nice summary.

    Also, I'm running 'laptop mode tools' which does some other tricks, and I've tuned it a bit but I'm not sure about others in this thread. For PCIe ASPM there are a number of ways of setting it, you can set it as a kernel config option, and laptop mode tools also can manage it, and you can of course use the kernel command line at boot in your grub config.
     
  29. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    Interesting discussion on state-of-the-art in power management on Sandy Bridge CPUs:

    https://plus.google.com/117091380454742934025/posts/2vEekAsG2QT

    Essentially, with 3.9/3.10 kernels, you need to make sure that you use intel_pstate scaling driver:

    Code:
    $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
    intel_pstate
    BTW, I played with the new CONFIG_NO_HZ_FULL option in the 3.10 kernel and so far as power savings on laptops go, it's basically not worth it. When it's on, the boot CPU actually wakes up more frequently, preventing the package from entering the lower (c7) power state much of the time. powertop shows a regression of about 0.3W compared to the good old CONFIG_NO_HZ[_IDLE].
     
  30. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Yeah, nohz full seems to make the cpu eat more power in the very limited testing I've done, temps are much higher with it enabled. There are a number of other problems with 3.10 on the X220 that I haven't had time to investigate so I'm still on 3.9.x for now.
     
  31. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    A colleague of mine complained that X became unstable for him with 3.10, but I haven't encountered any problems so far.

    3.10 did fix at least one problem for me: I have an HDD in the media bay of the docking station (ultrabase) and at least with 3.8 and 3.9 kernels, the kernel would not see the new SATA device on docking, requiring a suspend/resume cycle to recognize it. It worked fine with the first 3.x kernels, then they broke it around 3.5, fixed it again, broke it again, but now it works again (I wonder for how long...).

    For nohz full to be at least slightly sane in 3.10, CONFIG_NO_HZ ("Old Idle dyntics config") must be disabled. See the top post at:

    https://bbs.archlinux.org/viewtopic.php?id=163524&p=2

    This will prevent the fan from kicking in all the time, but the CPU will still spend much of the time in c6 instead of c7.
     
  32. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I've had the problem with the docking station not seeing a HDD hotplug, the workaround I used was to rescan the SCSI bus that it was attached to:
    Code:
    echo "0 0 0" | sudo tee /sys/class/scsi_host/hostX/scan
    where X is the number of the scsi host for the HDD

    To find this programmatically you can use something super-ugly like this (if anyone knows a better way please share):
    Code:
    grep -n HDDMODEL /proc/scsi/sg/device_strs | cut -d ':' -f 1 | tr -d '\n' | xargs expr -1 +
    where HDDMODEL is the model number of the hard drive (you can find it by running cat /proc/scsi/sg/device_strs or hdparm -i /dev/sdX)
     
  33. nathanvy

    nathanvy Notebook Enthusiast

    Reputations:
    0
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    5
    Well according to my kernel 3.9.9 config, there is no CONFIG_NO_HZ_FULL option, but it does have CONFIG_NO_HZ=y in there and powertop says the cores are spending between 94% and 98% in C7.

    So I'd gather that that's not where my power is going.

    I've also already got the pstate scaling driver in use.
     
  34. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    CONFIG_NO_HZ_FULL is new in 3.10.0. Your C7 statistic looks good; your CPU should already be saving as much power as can reasonably be expected.

    Well, the biggest power hog apart from the CPU is... the screen. On x220 with the IPS ("premium") panel, the relation between the brightness setting and the power draw is highly non-linear. I measured the difference between brightness 0 (darkest, but still on) and 9 (my favorite setting) to be only 0.6W; however, the difference between 9 and 15 (maximum) is 3.5W! Maybe that's where your power goes?

    BTW, I saw the screen corruption problem with the 3.10.0 kernel that I mentioned earlier. It often occurs after a suspend/resume cycle: the screen is completely garbled and the only remedy is to restart the X server. Here's the relevant kernel bugzilla entry:

    https://bugzilla.kernel.org/show_bug.cgi?id=60530
     
  35. nathanvy

    nathanvy Notebook Enthusiast

    Reputations:
    0
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    5
    I doubt it. Like I said earlier, I had this same system running on Fedora 18 and 3.7-series kernels. No hardware changes, and whenever I do a battery drain test I always test it the same way: nothing running but powertop, wifi on, bluetooth off, screen brightness set to minimum.

    Since no hardware changes have been made and since I always test under the same system load/conditions there must be a regression somewhere in the kernel.
     
  36. noxxle99

    noxxle99 Notebook Deity

    Reputations:
    34
    Messages:
    922
    Likes Received:
    1
    Trophy Points:
    31
    I'd like to disable turbo in Ubuntu. Can anyone help me?

    In windows, I can do this easily by setting the max processor speed to 99%.
     
  37. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
  38. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I started running 3.10, since 3.9.x has been discontinued. I'm not using NO_HZ_FULL. Here's my kernel config: config-3.10.txt

    acpiphp (used for expresscard hotplugging on the X220) has turned into a built-in, and that is reflected in my config:
     
  39. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Forgot to upload my 3.11 config. Here's 3.12 also.

    Since 3.10, I switched the preemption model to voluntary/desktop, since low-latency preemption was giving me some video stuttering I hadn't noticed before and also had some odd effects when doing multithreaded builds.
     
  40. mil2

    mil2 Notebook Consultant

    Reputations:
    382
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    31
    I'm running 3.12 as well. One thing that changed compared to 3.11 are the names of ThinkPad-specific ACPI events. E.g., the sleep button (Fn-F4) used to generate "ibm/hotkey HKEY 00000080 00001004", but now it's a more standard "button/sleep SBTN". More significantly, the WiFi on/off switch on the side no longer generates ACPI events at all, so I had to adjust some custom wifi scripts to use udev instead, which was a bit of a pain...
     
← Previous page