compiz+unity3d generates > 50 wakeups a second on idle system

Reported by Colin King on 2012-01-16
134
This bug affects 23 people
Affects Status Importance Assigned to Milestone
Compiz Core
High
Daniel van Vugt
The Ubuntu Power Consumption Project
High
Daniel van Vugt
Unity
High
Daniel van Vugt
compiz (Ubuntu)
High
Daniel van Vugt
unity (Ubuntu)
High
Daniel van Vugt

Bug Description

When my machine is idle, compiz is generating > 50 wakeups a second. The main culprit seems to be waiting for a video sync which happens at ~50Hz. Attaching gdb I can see this occurs in:

PrivateGLScreen::waitForVideoSync() in /usr/lib/compiz/libopengl.so

Not sure if this is a requirement or not, but it seems rather sub-optimal to be waiting on the video sync at 50Hz while the system is effectively idle. Is this a bug or a feature?

Using Precise + Unity 3D with today's latest updates (16th Jan 2012) on x86_64.

Related branches

lp:~vanvugt/compiz-core/fix-880707.2
Merged into lp:compiz-core/0.9.5 at revision 2915
Sam Spilsbury: Approve on 2012-01-18
Compiz Maintainers: Pending requested 2011-11-26
Tim Penhey: Pending requested 2011-11-26
lp:~vanvugt/unity/fix-917210-trunk
Merged into lp:unity at revision 2146
Marco Trevisan (Treviño): Approve on 2012-03-21
Tim Penhey: Pending requested 2012-03-14
Colin King (colin-king) on 2012-01-16
description: updated
Martin Pitt (pitti) wrote :

I see the same, confirming.

Changed in unity:
status: New → Confirmed
Changed in ubuntu-power-consumption:
status: New → Triaged
importance: Undecided → High
Daniel van Vugt (vanvugt) wrote :

Coincidentally, I committed the fix for this a few hours before the bug was logged :)

Changed in ubuntu-power-consumption:
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in unity:
assignee: nobody → Daniel van Vugt (vanvugt)
affects: unity → compiz-core
Changed in compiz-core:
assignee: Daniel van Vugt (vanvugt) → nobody
assignee: nobody → Daniel van Vugt (vanvugt)
status: Confirmed → Fix Committed
Changed in ubuntu-power-consumption:
status: Triaged → Fix Committed
Changed in compiz-core:
importance: Undecided → High
Daniel van Vugt (vanvugt) wrote :

Oh wait, it was logged 3 days ago... Anyway, the fix was committed today.

Daniel van Vugt (vanvugt) wrote :

I think you will also see lots of wakeups from the mousepolling plugin in compiz. AFAIK, that plugin doesn't contribute anything useful though. At least no any more. But it appears we can't disable mousepolling yet because some plugins depend on it still. I wonder if they really need to...... Sam?

Daniel van Vugt (vanvugt) wrote :

Workaround: Set the default mouse polling interval to maximum (500 ms?)

Daniel van Vugt (vanvugt) wrote :

Colin: What tool(s) are you using to measure wakeups?

Changed in compiz (Ubuntu):
status: New → Confirmed
assignee: nobody → Daniel van Vugt (vanvugt)
Colin King (colin-king) wrote :

Daniel, I'm able to measure wakeup events using a tool I wrote called eventstat in my PPA https://launchpad.net/~colin-king/+archive/powermanagement - alternatively use powertop.

Colin

Colin King (colin-king) wrote :

@Daniel, incidentally, how does one set the default mouse polling interval to 500ms?

Martin Pitt (pitti) wrote :

Many thanks, Daniel!

Omer Akram (om26er) wrote :

@Colin you can do that in ccsm, find for 'mouse polling' plugin there.

Daniel van Vugt (vanvugt) wrote :

The default setting for the mouse polling plugin is 40ms (25Hz). Although, now I've finally looked at the code I realize mousepoll does nothing by default and only polls while other plugins need it. So it's not relevant to an idle system it seems.

no longer affects: compiz-mousepoll-plugin
Daniel van Vugt (vanvugt) wrote :

Hmm, sometimes even with the fix compiz wakes up around 50 Hz, all the while it's only needing to redraw the screen around 4-5 Hz. So there is another remaining source of unwanted wakeups not related to redrawing the screen.

Disabling the unityshell plugin solved the problem. It seems there is a 50Hz timer of some sort in Unity too, that is running when perhaps it doesn't need to be...

Daniel van Vugt (vanvugt) wrote :

A quick code review makes me suspicious of Launcher.cpp:
    _autoscroll_handle = g_timeout_add(20, &Launcher::OnScrollTimeout, this);
And its related code doesn't seem to have a reliable code path that guarantees the timer gets cancelled.

Changed in unity:
status: New → In Progress
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in unity (Ubuntu):
status: New → In Progress
Changed in unity (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in ubuntu-power-consumption:
status: Fix Committed → In Progress
Changed in compiz-core:
milestone: none → 0.9.7
Omer Akram (om26er) on 2012-01-27
Changed in unity:
milestone: none → 5.2.0
importance: Undecided → High
Changed in unity (Ubuntu):
importance: Undecided → High
Changed in compiz (Ubuntu):
importance: Undecided → High
Daniel van Vugt (vanvugt) wrote :

The fixes for this bug are now available for testing in:
ppa:vanvugt/compiz
ppa:vanvugt/unity

You will need BOTH.

Omer Akram (om26er) on 2012-01-30
Changed in compiz (Ubuntu):
status: Confirmed → Fix Committed
Daniel van Vugt (vanvugt) wrote :

More accurately, it won't be fix committed in "compiz (Ubuntu)" until precise gets compiz 0.9.7.*

Colin King (colin-king) wrote :

Thanks Daniel, great work! Any idea when this will land in Precise?

Daniel van Vugt (vanvugt) wrote :

I believe the compiz fix will land in alpha-2 or maybe beta-1.

The unity fix still needs review and approval. So no idea how long that will take.

Omer Akram (om26er) wrote :

Its expected to land next week i.e. after alpha-2 and new Unity is targeted for this thursday.

Colin King (colin-king) wrote :

Most excellent! Thanks!

Didier Roche (didrocks) on 2012-02-03
Changed in unity:
milestone: 5.2.0 → 5.4.0
Daniel van Vugt (vanvugt) wrote :

Fix released in:
compiz (1:0.9.7.0~bzr2995-0ubuntu1) precise; urgency=low

Changed in compiz (Ubuntu):
status: Fix Committed → Fix Released
Didier Roche (didrocks) on 2012-02-14
Changed in unity:
milestone: 5.4.0 → 5.6.0
Colin King (colin-king) wrote :

@Didier, is this bug going to get fixed on the 5.6.0 release? It is the #1 top wakeup event generating process in the system by a long way.

Daniel van Vugt (vanvugt) wrote :

Colin, the Unity team is still reviewing the fix. Even yesterday there was some discussion.

Changed in compiz-core:
status: Fix Committed → Fix Released
Didier Roche (didrocks) on 2012-03-12
Changed in unity:
milestone: 5.6.0 → 5.8.0
Colin King (colin-king) wrote :

Hi Didier, I see this keeps on getting pushed back in unity from 5.2.0 through to 5.8.0. Will this land in Precise before the we hit final release?

Daniel van Vugt (vanvugt) wrote :

I am updating the fix with a test case and re-testing it against the latest Unity today.

Daniel van Vugt (vanvugt) wrote :

Sigh. It looks like some new regression is in Unity 5 compared to Unity 4. The fix for the autoscroll timer still works, but it doesn't get the number of wakeups per second much lower than 40. But that's a different issue...

James Clemence (jvc26) wrote :

@Daniel: Just confirming that - today, latest precise updates, still getting a wakeups/second ~57 on powertop, despite raising the mouse polling frequency to 500 (though that did make a difference - thanks!)

On 14/03/12 07:36, Daniel van Vugt wrote:
> Sigh. It looks like some new regression is in Unity 5 compared to Unity
> 4. The fix for the autoscroll timer still works, but it doesn't get the
> number of wakeups per second much lower than 40. But that's a different
> issue...
>
I *really* appreciate all your effort to squish this issue. Thanks!

fringd (fringd) wrote :

keep up the good fight, an hour of battery life is worth fighting for.

fringd (fringd) wrote :

the code you wrote looks nice! a tickless unity is what we need!

can i test it out somehow?

Timo Jyrinki (timo-jyrinki) wrote :

Daniel: unity staging (from yesterday) + unity with your patch included dropped the compiz wakeups on my sandybridge laptop from 50-60 to 10-15. Can you or someone else repeat this success? Not perfect of course, but way better than a drop to just 40.

I built it locally, but it should be soon available at my ppa:timo-jyrinki/ppa - that needs also ppa:unity-team/staging

Changed in ubuntu-power-consumption:
status: In Progress → Fix Committed
Changed in unity (Ubuntu):
status: In Progress → Fix Committed
Changed in unity:
status: In Progress → Fix Committed
Alan Pope ㋛ (popey) wrote :

Just tested Timo's package and my powertop compiz wakeups went from 50-60 down to 4-6.

Alan Pope ㋛ (popey) wrote :

Oddly coming out of screensaver (blank) I was getting ~40 wakeups a second which settled down to 7.

Timo Jyrinki (timo-jyrinki) wrote :

I can confirm Alan's finding, a locked screen (blank screensaver) seemingly has compiz generating ca. 40 wakeups per second for the duration of blank screen. Unlocking gets the compiz wakeups again down (also for me I do see numbers under 10 now).

Probably worth opening a new bug report.

Colin King (colin-king) wrote :

Tested Timo's package and my eventstat tool is showing ~2-5 events/sec on an idle machine - this is a most excellent result - a huge improvement! Thanks! :-)

Note: With a webbrowser running with some stupid flash animation it averages ~20 events/sec and glxgears its ~60 wakeups/sec, but that's to be expected isn't it?

Timo Jyrinki (timo-jyrinki) wrote :

Bug #961202 is now a report of that, which became visible with this bug's fix.

Daniel van Vugt (vanvugt) wrote :

Thanks Timo, all. Yes it sounds like my comment #25 is bug 961202.

fringd (fringd) wrote :

for me compiz dropped from 70 to about 20.... awesome!

Didier Roche (didrocks) on 2012-03-23
Changed in unity:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :
Download full text (5.4 KiB)

This bug was fixed in the package unity - 5.8.0-0ubuntu1

---------------
unity (5.8.0-0ubuntu1) precise-proposed; urgency=low

  * New upstream release.
    - New "push mouse offscreen" feature really difficult to get (LP: #923749)
    - unity-2d-panel crashed with SIGSEGV in
      unity::indicator::DBusIndicators::Impl::RequestSyncAll() (LP: #864737)
    - Pressing "Alt+Enter" causes compiz to crash in CompOption::value() from
      unity::UnityScreen::showLauncherKeyTerminate (LP: #960957)
    - SEGSIGV after unplugging external monitor (LP: #962693)
    - Background colorization should use a different heuristic (LP: #865239)
    - compiz+unity3d generates > 50 wakeups a second on idle system
      (LP: #917210)
    - [FFe, UIFe] HUD - The HUD does not respect launcher autohide or icon
      size settings (LP: #921506)
    - clicking on folders in the file lens does not open nautilus
      (LP: #921665)
    - No text inside multirange filters (LP: #927710)
    - can't alt-tab restore minimized uis which have an instance on another
      workspace (LP: #933397)
    - Ubuntu Software Center Unity launcher integration is not working
      (LP: #932280)
    - The line separator between the launcher and the dash is cleared when
      selecting a category (LP: #941082)
    - unity-panel-service crashed with SIGSEGV in g_hash_table_foreach()
      (LP: #937119)
    - Alt-F10 locks up Unity (LP: #948522)
    - multimonitor, launcher: Provide an option to display either a single
      launcher or a launcher on each display in a multi-monitor environment
      (LP: #950136)
    - multimonitor: Please give me a way to turn off sticky monitor edges
      (LP: #946104)
    - Unity 5.6: key bindings (such as Super) don't work on empty workspace or
      on slow/loaded systems (LP: #953089)
    - Alt+arrows keyboard shortcuts don't invoke Back and Forward navigation
      (LP: #953783)
    - HUD is sending 2 menu signals instead of 1 (LP: #956878)
    - 6th item of HUD not fully visible (LP: #957229)
    - HUD: seems to trigger operations more than once (LP: #960503)
    - Launcher gets always desaturated when using HUD on secondary monitor
      (LP: #961169)
    - [5.8 pre staging] launcher is displayed on the left screen, not the
      primary one (LP: #961281)
    - launcher icons do not re-saturate after dash is closed (LP: #961844)
    - Launcher shows arrows for applications on all workspaces (LP: #961977)
    - Dash - Implement overlay scrollbars in Dash (LP: #608124)
    - [UIFe] Dash - No message displayed when no results are returned in the
      Dash (LP: #711199)
    - Dash - "See more..." line should be base-aligned with section header
      (LP: #748101)
    - Dash - Missing category separator line in dash (LP: #850984)
    - Dash and Launcher - As soon as a user starts dragging a file from the
      Dash, there is a 'flicker' before the Launcher icons that are valid drop
      receptacles re-saturate (LP: #863230)
    - Dash - When multiple results have equal string match relevancy ranking,
      those with equal ranking should be then sorted by frequency of use.
      (LP: #871900)
    - Keyboard shortcut - F10 shortcut is used to show m...

Read more...

Changed in unity (Ubuntu):
status: Fix Committed → Fix Released
thom (tsk) wrote :

Still an issue I think...

Architecture: amd64 (Turion dual core mobile)
Video: AMD mobile HD3200 (open driver)
Driver: Source: xserver-xorg-video-ati
Version: 1:6.14.99~git20111219.aacbd629-0ubuntu2
Unity: Version: 5.8.0-0ubuntu2

with unity 3d I have an extra 60 processor wake-ups per second while doing absolutely nothing (stable, like a framerate) due to interrupt 18 (radeon HD3200 open driver) on top of the more or less 60 regular wake-ups

with unity 2d I don't have these int18 wakeups at all, only the regular ones.

did the patch only work for sandy-bridge stuff ?

also, possibly related, the PS2-mouse/touchpad hits an incredible max of over 500 wakeups/sec (which, of course, is a bit over the top with a video framerate of 60 ) could and/or should this be capped at exactly the framerate (or half of it) ?

thom (tsk) wrote :

oh btw, I forgot to mention why I considered it rather important to post this here:

with unity 2d, my notebook draws 21.5 Watts with an estimated batterylife of 3.00 hours
with unity 3d, my notebook draws 45 Watts with an estimated batterylife of 1.15 hours

I am having this issue, and I am up-to-date with all upgrades in the 12.04 beta. I have a HP Pavilion dv7 laptop with i7 quad core processor, AMD/fglrx video driver. Under unity 3d, when I lock the screen and it goes blank, the cpu and fan spin up. After unlocking and bringing the screen back up, the fan spins down. It looks like compiz or X is the process cranking up the CPU (given that I am looking at top and powertop just after logging back in, it is a bit like trying to figure out if the refrigerator light actually goes off when you close the door, but I think compiz is the culprit). In any case, this happens consistently under unity3d, but not under unity 2d.

Daniel van Vugt (vanvugt) wrote :

thom: The issue with mouse events vastly outnumbering the video framerate is something we're aware of and are experimenting with a few different solutions. But it's not related to this bug directly.
  Regarding your 60 wakeups per second, could you please run "ccsm" and in "Mouse position polling" raise the polling interval to its maximum value? Does that help?

Richard: You are describing bug 969860. Please subscribe to that one.

thom (tsk) wrote :

Daniel: thanks for taking the time for this.
mouse position polling interval on max (500) -> still rock steady 60 wakeups on radeon (int18) continuously, still close to 500 wakeups when moving mouse (int12)

Daniel van Vugt (vanvugt) wrote :

thom: Please try out the Benchmark plugin in compiz-plugins-extra. And let us know what frame rate Benchmark reports when your desktop is idle.

Note - Benchmark only works properly in Ubuntu 12.04, not earlier releases.

thom (tsk) wrote :

Daniel:
Compiz Benchmark -> about 0,12 to 0,49 Frames/sec when idle....sometimes peaking to 1,6 Frames/sec
it is about a steady 1.0 to 2.0 Frames/sec when running something like top, jupiter-stats or powertop.

---for reference---
about 4 Frames/sec when idle in launcher unity
about 10 Frames/sec when using launcher unity
about 25 Frames/sec when typing in dash unity
-------------------------

Daniel van Vugt (vanvugt) wrote :

thom, thanks. That confirms it's not trying to render anything at a high framerate and the wakeups are caused by something else.

I don't think it's appropriate to keep discussing your problem in this bug which is fix-released. Please log a new bug and try to attach "perf" output of the compiz process while it's idle but still waking up lots. The "perf" command is in the package called "linux-tools-common" and further information is here: https://perf.wiki.kernel.org/

Changed in ubuntu-power-consumption:
status: Fix Committed → Fix Released
Eric Miao (eric.y.miao) wrote :

Is it possible that this can be fixed for Oneiric as well?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers