Forgot your password?
typodupeerror
Bug Power Red Hat Software Linux

Linux Kernel Power Bug Is Fixed 145

Posted by Soulskill
from the another-one-bites-the-dust dept.
An anonymous reader writes "The Linux kernel power bug that caused high power usage for many Intel Linux systems has finally been addressed. Matthew Garrett of Red Hat has devised a solution for the ASPM Linux power problem by mimicking Microsoft Windows' power behavior in the Linux kernel. A patch is on LKML for this solution to finally restore the battery life under Linux."
This discussion has been archived. No new comments can be posted.

Linux Kernel Power Bug Is Fixed

Comments Filter:
  • Nice to hear this. Now to look for the ubuntu update.

    • by klashn (1323433)
      I am also looking forward to this, though now my battery probably has 200 cycles on it, and I'd probably get better battery life by replacing the battery instead :-)
    • Re: (Score:2, Insightful)

      by CmdrPony (2505686)
      It's funny they had to fix it by copying the method from Windows though.
      • by HouseOfMisterE (659953) on Friday November 11, 2011 @05:27PM (#38029410)

        The didn't copy it, they "mimicked" it!

      • Re:Good News (Score:5, Insightful)

        by Anonymous Coward on Friday November 11, 2011 @05:28PM (#38029420)

        It's funny they had to fix it by copying the method from Windows though.

        Nothing funny here, if your hardware is optimized by the hardware manufacturer for windows, getting better performance from that hardware by mimicking windows behavior seems logical, if not controversial.

        • Re:Good News (Score:5, Insightful)

          by Nerdfest (867930) on Friday November 11, 2011 @05:44PM (#38029596)
          ... especially since the hardware manufacturers frequently deviate from the specifications in the standards to support Microsoft operating systems.
        • Re:Good News (Score:5, Insightful)

          by NotBorg (829820) on Friday November 11, 2011 @06:43PM (#38030268)
          What's the controversy? The [defective] hardware only works one way. It's just doing it the only one way that it works. You can't fault someone for going down the only path available.
          • Re:Good News (Score:5, Informative)

            by fuzzyfuzzyfungus (1223518) on Friday November 11, 2011 @07:26PM (#38030678) Journal
            More specifically, the power management mechanism in question(PCIe ASPM) requires, broadly speaking, two different components:

            1. You need to detect boards that are capable of it, so that you don't try to shut down idle links in a system where that could cause crashes, losing touch with peripherals, or other havoc.

            2. You need the actual logic for detecting idle PCIe links, and the appropriate driver support and so on for instructing the PCIe controller(s) to change link power states.

            Part two is the bulk of the matter, and it already worked for some time now, if your board declared ASPM support or if you used ASPM force. Part one is comparatively simple; but the approach that Linux previously used was hobbled by the fact that boards frequently don't declare ASPM support even when they have it; but enough boards don't that just defaulting to force would be risky. To deal with this, the latest patch adds the heuristics that Windows uses to detect ASPM, since the method that is supposed to work frequently doesn't, but vendors aren't going to ship gear that doesn't support Windows...
            • by hairyfeet (841228)

              Uhh you SEEM to know what you are talking about but unless i'm mistaken there is a flaw in your logic. you just said that the patch add the heuristics that Windows uses to detect ASPM which if they are having to use heuristics to detect the thing how EXACTLY is the OEM "helping" Windows? By making their crap crappy so heuristics works?

              It sounds more like the race to the bottom has caused some low end ODMs to cut corners where they shouldn't have been cut. I've found that contrary to popular belief this

              • by Anonymous Coward

                you just said that the patch add the heuristics that Windows uses to detect ASPM

                He did, and he is wrong. What Matthew Garrett did was go through the Windows drivers as provided by the manufacturer, to see whether they {dis,en}abled ASPM.

              • Re: (Score:2, Informative)

                by Alex Belits (437) *

                The patch imitates a nonstandard behavior -- if it sees BIOS claiming that ASPM is disabled, it leaves devices in whatever state BIOS left it instead of following what BIOS claims about device. This is certainly a bug in BIOS, and possibly a bug in Windows that happened to cancel the BIOS bug. However very likely that incompetent hardware or BIOS vendors (I am pretty sure, it's a certain company known as "the largest BIOS vendor") first produced wrong BIOS behavior, and Microsoft seized the opportunity to e

          • by icebike (68054)

            What's the controversy? The [defective] hardware only works one way. It's just doing it the only one way that it works. You can't fault someone for going down the only path available.

            I suspect Microsoft will do exactly that: Fault them with Lawyers, especially since they pretty much admitted they copied what Microsoft did.

      • Re: (Score:1, Flamebait)

        I am thankful it was not 'copied' from Apple. Apple would've sued the whole linux/Linux/GNU/FOSS in South Korea, Germany, Japan and of course the US and would have asked to ban the import of, er, things.

        • Re:Good News (Score:4, Informative)

          by UnknowingFool (672806) on Friday November 11, 2011 @05:43PM (#38029582)
          Yes it's not like Apple contributes to open source code [wikipedia.org] at [wikipedia.org] all [wikipedia.org].
          • Re:Good News (Score:5, Insightful)

            by Anonymous Coward on Friday November 11, 2011 @06:51PM (#38030346)

            Yes, because contributing a few open source project gives you the right to employ VERY proprietary methods and approaches to the vast majority of what you do. Filling baseless patent suits is perfectly acceptable so long as you have at least one open source project.

          • by suy (1908306)
            • WebKit: a fork of KHTML that has to be LGPL because they are forced to.
            • CUPS: an open source product that they bought. It was free in the first place.

            Yes, they contribute, but not as much as you seem to imply. Apple is a company based in a very proprietary model, and that's hard to dispute.

            • WebKit is made up of KHTML code (which is now very little) and the parts that Apple added. Under the GPL, Apple is not required to release code that is not a derivative of the original code. But they open sourced everything they did. They were under no obligations to do this.

              As for CUPS, they could have not done anything at all. Instead they bought it and kept it going. They were under no obligations to do either.

              Yes, they contribute, but not as much as you seem to imply. Apple is a company based in a very proprietary model, and that's hard to dispute.

              I would consider adding the majority of WebKit code as a lot. The problem is in your logi

              • by suy (1908306)

                As I understand it, WebKit is a derivative of KHTML, there is no way to gradually change the license. Now in WebKit there might be little from the original KHTML code, but of course the present KHTML is also very different from the one that Apple forked. Note that WebKit is now an open source project that receives contributions from many companies that are direct Apple rivals. If Apple was the starter of the WebKit name, was because they clearly failed to join an already stablished community of developers.

                • As I understand it, WebKit is a derivative of KHTML, there is no way to gradually change the license. Now in WebKit there might be little from the original KHTML code, but of course the present KHTML is also very different from the one that Apple forked.

                  Part of WebKit is derived from KHTML. Parts of WebKit have no origin from KHTML and were developed by Apple namely everything except JavaScriptCore and WebCore. The GPL and the LGPL does not specify that you must code all unrelated to the original under the GPL. Apple released all other parts under BSD which is not copyleft but more permissive.

                  Note that WebKit is now an open source project that receives contributions from many companies that are direct Apple rivals. If Apple was the starter of the WebKit name, was because they clearly failed to join an already stablished community of developers. It's not like is difficult to gain an account to access the KDE repositories (I have one, and just contributed very minor things) or the mailing lists.

                  Huh? Apple forked WebKit from KHTML and massively developed it to the point that other companies contribute to it. And you cite Apple for contributing too much t

                  • by suy (1908306)

                    Huh? Apple forked WebKit from KHTML and massively developed it to the point that other companies contribute to it. And you cite Apple for contributing too much to their own project? Do you also blame Mozilla for doing too much for FireFox?

                    What? Sorry, I don't understand what you mean, or what relation has with what you quoted.

                    And again my point is they are under no obligation to do any of this. They could have open sourced everything they have done and stopped development. A point you have never addressed.

                    I didn't address that because I never denied nor confirmed this. From the beggining I was only writing about the size of the contributions.

                    Again, you are replying to things I wasn't writing about. My point is mainly this: Apple contributed to WebKit, of course, but many people mistakenly see it as a project created solely by Apple, and developed only by Apple.

                    • In all your posts, you again and again bring up 2 points: Apple contributes because they have to due to the GPL. And Apple doesn't contribute that much. Your first point is rather disingenuous as Apple doesn't have to contribute to open source at all. As for the amount of code Apple contributes to WebKit [webkit.org], WebKit says "Apple employees have contributed the majority of work on WebKit since it became an independent project.". You seem to be confusing number of contributors with amount of contribution. Ap
                    • by suy (1908306)

                      Your first point is rather disingenuous as Apple doesn't have to contribute to open source at all.

                      Wrong. If they release a product based on LGPL code, they have to release said LGPL code.

                      Apple is one of many individuals and 30 companies that contribute, but they contribute the bulk of work.

                      And wrong again [ofilabs.com].

            • Apple also only contributes to projects under licenses that bless proprietary forks. While there is nothing wrong with this, there is something wrong if such contributions amount to an attack on established copyleft projects. For example, webkit vs Gecko. LLVM vs GCC. Google does this too, intentionally wielding Apache license projects to weaken GPL projects. Worth meditating on the probability that "don't be evil" really means "unless it suits us". However. There is still a huge amount of value in contribu

      • Congrats to Garrett; he has some balls admitting to such "collaboration". I really hope I can get more than an hour out of my SSD-only laptop. Granted its going on 3 years old, but the battery is less than 2!
        • Re:Good News (Score:4, Insightful)

          by Martin Blank (154261) on Friday November 11, 2011 @07:15PM (#38030578) Journal

          Garrett was also in large part responsible for fixing a running problem [lwn.net] with booting on UEFI systems, particularly notebooks. (That wasn't the only patch that needed to be written, but it did provide the foundation. It's also one of the funniest developer commentaries for a patch I've ever seen.) I've seen his name attached to Linux development for a while, but it's only recently that I've come to understand just how much of the deep internal architecture he understands and has helped to fix.

      • Re:Good News (Score:5, Insightful)

        by billcopc (196330) <vrillco@yahoo.com> on Friday November 11, 2011 @05:37PM (#38029520) Homepage

        I don't find it funny, just common sense. It sounds like ASPM is very poorly documented, so if Windows is doing a decent job of implementing the functionality, then reverse-engineering, or at least guessing at how Windows does it, seems like a valid approach.

        • Re:Good News (Score:5, Insightful)

          by amiga3D (567632) on Friday November 11, 2011 @05:51PM (#38029678)

          I think it's more a case of the manufacturers supporting windows than the other way around. Of course Linux doesn't get that level of support because of the lower user base. Apple solves the problem by making their own hardware.

          • by Anonymous Coward
            It's actually about the Windows logo sticker on the side of your laptop. To get that, the IHV (hardware vendor) has to pass a suite of tests which are defined entirely by Microsoft. Since you (the IHV) really want to get that Winlogo sticker, you pretty much have to do it the way Windows wants it by definition. Of course, IHVs can and do push back on test requirements, but the tests are basically black boxes and it's far easier to just make the tests pass than to complain and make Microsoft change something
          • by Calos (2281322)

            Really? When did Apple start making graphics cards, expansions cards, motherboards, etc.? As far as I'm aware they don't make any of the affected components, nor do they design or make the logic responsible for negotiating power.

            • by SeaFox (739806)

              Apple doesn't design the motherboards in their computers?

            • by amiga3D (567632)

              How much you want to bet that Apple gets ALL the specs for that hardware? They don't get the bullshit that linux developers have to tolerate. They've got the money to spend and the hardware vendors kiss their ass and build it to their (Apple's) specs not the other way around. Sure they don't actually manufacture it but you can bet they ain't buying it off the shelf.

        • Re:Good News (Score:5, Informative)

          by DarwinSurvivor (1752106) on Friday November 11, 2011 @10:28PM (#38032000)
          It's not poorly documented. It is poorly implemented by most hardware manufacturers. The OS is supposed to be able to query the system and ask if it supports the power saving features, but most hardware just ignores it (making it appear as though it doesn't). From what I understand, Microsoft no longer asks if it supports it, it simply asks "what are you" and then looks it up in an internal database to see if it's compatible. It's a *VERY* ugly hack, but unfortunately it appears to be the only way to fix it because hardware manufacturers are lazy.
          • by eriks (31863)

            That's fascinating. It would be cooler if the protocols were rigorously followed, but things being as they are, that's still kind of neat. All kinds of fancy algorithms and 30+ years of moore's law, and fundamental aspects of modern computing technology still depend on simple lookup tables.

            • by billcopc (196330)

              Fancy algorithms and moore's law mean nothing to Chinese factory workers and the cut-rate designers that keep them busy.

      • Re:Good News (Score:5, Informative)

        by greg1104 (461138) <gsmith@gregsmith.com> on Friday November 11, 2011 @05:51PM (#38029676) Homepage

        That's a wrong impression given by a poorly written article summary. If you read the patch submission, the only involvement of Windows here was using a presentation about their OS as a way to clarify the minimal documentation about this area. Nothing was copied from Windows.

        • by amiga3D (567632)

          Don't confuse the issue by using facts.

        • by chrb (1083577)

          If the firmware has given us control of PCIe capabilities then it's valid for an operating system to configure ASPM more aggressively than the firmware did. A small number of devices object to this and exhibit various failure modes. Windows provides a mechanism to disable ASPM in the driver, indicated by the Needs=PciASPMOptOut statement in the .inf file. Trawling through Windows drivers has indicated the following set of hardware that disables ASPM in Windows but doesn't currently disable it in Linux. It makes sense for us to mimic Windows in this situation. (V2: send the version that actually builds)

          Matthew Garrett [lkml.org], these patches did get noticed by Phoronix [phoronix.com].

      • by Tomato42 (2416694)
        There's nothing funny about brain-dead hardware. ASPM - 2011 era Winmodems.
      • Re:Good News (Score:5, Informative)

        by fuzzyfuzzyfungus (1223518) on Friday November 11, 2011 @06:23PM (#38030036) Journal

        It's funny they had to fix it by copying the method from Windows though.

        Unfortunately (as is too often the case) the "bug" was an interaction between the linux kernel and the absolutely fucked state of the BIOS in general, and ACPI in particular.

        Because not all boards support PCIe Active State Power Management(a part of the PCIe spec that provides for powering down an unused link to save power), and bad things can happen if you try to use it on a board that doesn't, a board that does support it is supposed to advertise that fact. In practice, a large swath of boards where it works just fine were failing to declare that. The Linux Kernel obligingly didn't try to use it(unless ASPM=force was used). Since what is supposed to happen apparently usually doesn't, they've had to examine the mechanism used by Windows systems to infer whether or no ASPM is good to go, reasoning that vendors are unlikely to ship BIOSes where the Windows default behavior causes horrible things to happen.

        ACPI is a bit of a problem child...

      • It's funny they had to fix it by copying the method from Windows though.

        A number of motherboard manufacturers decided not to "advertise" that they supported ASPM and somehow MS knows of this before anyone else. I agree with the approach linux took: mimic Windows behavior to help locate the bug.

      • It's funny they had to fix it by copying the method from Windows though.

        The issue is that essential documentation is kept secret from the public, shared by vendors only with Microsoft, most probably due to licensing/pricing pressure from Microsoft. Smells like yet another antitrust time bomb to me.

  • overblown (Score:2, Insightful)

    by markhahn (122033)

    this "issue" seemed to be mostly a traffic-getting vehicle for phoronix.

    • Re:overblown (Score:5, Informative)

      by greg1104 (461138) <gsmith@gregsmith.com> on Friday November 11, 2011 @05:55PM (#38029730) Homepage

      Reporting was a bit sensationalist, but the problem was both real and significant. I don't doubt the 14 to 36% regression they're reporting on exists, and is about that large.

    • by Sancho (17056) *

      Whether it's this or something else, I got much worse battery life with Linux on my laptop than with Windows.

    • by Anonymous Coward

      What's wrong with Phoronix?

    • Re:overblown (Score:4, Interesting)

      by QuantumRiff (120817) on Friday November 11, 2011 @06:50PM (#38030326)

      yes.. My 8 hours of battery life in windows and 5 hours in Linux running PowerTop to disable as much as possible is just sensationalism..

    • Re:overblown (Score:5, Interesting)

      by inglorion_on_the_net (1965514) on Friday November 11, 2011 @11:29PM (#38032330) Homepage

      Yes. It sickes me that Slashdot has followed Phoronix's lead in calling this a Linux bug. It isn't. The bug is in hardware not reporting that it is ASPM (Active State Power Management) capable.

      As I understand it, the history of this thing is like:
        1. Linux implements ASPM
        2. This causes some hardware to fail, because it isn't ASPM capable
        3. Linux is fixed to detect if the hardware reports ASPM capability, and doesn't use ASPM if the hardware says it doesn't support that
        4. Michael Larabel of Phoronix notices that Linux power consumption has risen on some hardware, calls it a bug in Linux
        5. Folks investigate, figure out that some hardware reports no ASPM capability, even though it is ASPM capable, and implement a kernel parameter to force Linux to use ASPM, even if the hardware says it doesn't support it
        6. Michael Larabel keeps talking about the Linux power regression writes post after post about how it still hasn't been fixed
        7. Someone figures out how Windows detects ASPM support on hardware that doesn't report it, and implements the same heuristic in Linux
        8. Now, Slashdot claims the Linux bug has been fixed, even though it wasn't a bug in Linux, and Linux has had a workaround for almost as long as we've known about the issue

      Seriously, guys. Bad reporting. This is _not_ what I come to Slashdot for. There are hundreds of sites that will give me half truths, common misconceptions, and the occasional nugget of truth. Strive to be better than those.

      • by Lisias (447563)

        please mod parent up.

        I utterly regrets have spent all of mine.

      • As I understand it, the history of this thing is like:

        Let me reword that how users understand it:

          1. Windows laptop's battery lasts 3 hours.

          2. Install Linux, laptop's battery lasts 2 hours.

        Users do not care who is at fault, nor are they even interested.

        • As I understand it, the history of this thing is like:

          Let me reword that how users understand it:

          1. Windows laptop's battery lasts 3 hours.

          2. Install Linux, laptop's battery lasts 2 hours.

          Users do not care who is at fault, nor are they even interested.

          True, but /. is not where the users go. So the headline should be corrected, and the summary changed to explain that a kernel patch will emulate Window's handling of a BIOS bug to improve power usage on laptops.

      • You can argue of semantic word games all day, but for a lot of users a "problem" was fixed. It might not have been a "bug" "in" Linux, but the end result was that battery life under Linux suffered, and that has now been fixed.
      • +1
  • by The Evil Brain (2031868) on Friday November 11, 2011 @05:50PM (#38029652)
    ...my battery's almost dead.
  • by WaffleMonster (969671) on Friday November 11, 2011 @06:07PM (#38029862)

    The onboard intel nic on my intel motherboard randomly disappears with ASPM enabled due I think to a hardware issue.

    For me it is pcie_aspm=off or all hell breaks loose.

    • As I understand it, that kind of problem is exactly what motivated the kernel change that Phoronix called a regression. All hell would break loose on some systems if ASPM was enabled, so the kernel developers disabled it by default. That change led to increased stability at the cost of decreased energy efficiency. If the regression is fixed, it should mean systems like yours can use ASPM safely now.
    • There is a blacklist for individual devices, including some Intel NICs. If yours isn't on the list, maybe it should be.

      • by Anonymous Coward

        It probably is. He is likely to be using something very old and unpatched, Intel has blacklisted L0's on their buggy chips for a while, and even the fix for L1's is not that new and is available on the latest stable kernels.

    • by chrb (1083577) on Friday November 11, 2011 @08:10PM (#38031050)
      Possibly already fixed: "Some drivers (e.g. the e1000 network driver) have already switched off the ASPM where the PCI-E v1.1 feature is known to not work" Phoronix [phoronix.com] If not, report it and that driver will get ASPM blacklisted.
  • Don't feed the troll (Score:5, Informative)

    by mcover (1653873) on Friday November 11, 2011 @06:17PM (#38029946)

    This is making Linux look bad without reason. Before the whole "Linux Power Regression" coming up and being advertised as a problem by Phoronix, I did enjoy reading the occasional article (Benchmarks, etc.) by Phoronix, but after this whole thing I have lost complete respect for Phoronix.

    It's not a Linux bug but BIOS misbehaving. Linux is simply playing it safe.

    Summary: http://www.fewt.com/2011/09/about-kernel-30-power-regression-myth.html [fewt.com] (been posted before in older threads)

    • And if it weren't for Phoronix "advertising the problem" it most likely still would be sitting there, not getting attention. So you've lost complete respect for them, because they highlighted a problem in Linux, that needed to be fixed, and it got fixed?
  • caused high power usage for many Intel Linux systems

    it really is a simple fix. ;)

  • by steevven1 (1045978) on Friday November 11, 2011 @07:51PM (#38030872) Homepage
    Doesn't look like this will fix the much larger power issue with the Sandy Bridge processors, which is related to the graphics driver :-/ https://bugs.launchpad.net/ubuntu/+source/linux/+bug/818830 [launchpad.net]
    • by sakti (16411)

      That is due to i915_enable_rc6 defaulting to off. In 3.2 they should be changing it to default to on again as they've fixed the lockup bugs that it was causing. See the developers blog for more; http://dodonov.net/blog/ [dodonov.net]

  • Which kernel version from kernel.org contains the patch? 3.2-rc1? Or none yet? Please don't answer unless you're quite sure.
    • by Anonymous Coward

      None yet. It's not in Linus' tree yet.

  • The usual fix/workaround doesn't work on my Thinkpad T60. Even though I execute "pcie_aspm=force", I get this:

    [ 0.000000] PCIe ASPM is forcedly enabled

    but then...

    [ 0.164778] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it ...
    [ 1.269089] e1000e 0000:02:00.0: Disabling ASPM L0s L1

    So I'm left to wonder, does the system actually support PCIe ASPM and the kernel just doesn't know it's there or is there entirely something else at fault?

  • Great (Score:2, Funny)

    by RazorSharp (1418697)

    by mimicking Microsoft Windows' power behavior in the Linux kernel

    Microsoft's lawyers probably love that description.

  • I see the sensationalist and wrong headline; the blurb is folded in.

    I click expand and, lo behold, it's an anonymous submission that links to Phoronix. Yet. Again.

    I guess none of the mods will read this anyway, but why can't we let this cesspool die by ignoring it into oblivion?

  • You mean copy / paste? M$ will be looking for you...

  • by undecim (1237470)

    Red Hat has devised a solution for the ASPM Linux power problem by mimicking Microsoft Windows' power behavior in the Linux kernel.

    I'm sure Microsoft will ignore this.

After an instrument has been assembled, extra components will be found on the bench.

Working...