gnome-shell (via Mesa/LLVMpipe in a virtual machine) uses all CPU cores just to update the screen (on Wayland only)

Bug #1850874 reported by TomaszChmielewski
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-shell (Ubuntu)
Won't Fix
Medium
Unassigned
mesa (Ubuntu)
Won't Fix
Medium
Unassigned
mutter (Ubuntu)
Won't Fix
Medium
Unassigned

Bug Description

This started to happen with Ubuntu 19.10.

When an animated gif is displayed in a browser, gnome-shell begins using 100% CPU on all cores.

To reproduce:

1) open Firefox, or Chromium

2) load an URL where an animated gif is displayed - you can also use this direct link to https://i.stack.imgur.com/h6viz.gif

3) gnome-shell will start using 100% CPU on all cores (as long as Firefox/Chromium window is in the foreground)
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu8.1
Architecture: amd64
DisplayManager: gdm3
DistroRelease: Ubuntu 19.10
GsettingsChanges:

InstallationDate: Installed on 2019-05-12 (172 days ago)
InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Release amd64 (20190416)
Package: gnome-shell 3.34.1-1ubuntu1
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 5.3.0-19.20-generic 5.3.1
RelatedPackageVersions: mutter-common 3.34.1-1ubuntu1
Tags: eoan
Uname: Linux 5.3.0-19-generic x86_64
UpgradeStatus: Upgraded to eoan on 2019-10-16 (15 days ago)
UserGroups:

_MarkForUpload: True

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm, gnome-shell is mostly single threaded so it shouldn't be able to use "all cores". It should saturate only one core at most.

Please provide a screenshot of 'top' running in a Terminal window, showing that gnome-shell (or anything) is using the CPU.

tags: added: eoan performance
Changed in gnome-shell (Ubuntu):
status: New → Incomplete
Changed in mutter (Ubuntu):
status: New → Incomplete
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote :
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote :

In "ps -eLf":

tomasz 1410 1265 1410 1 10 Oct31 ? 00:33:23 /usr/bin/gnome-shell
tomasz 1410 1265 1421 0 10 Oct31 ? 00:00:00 /usr/bin/gnome-shell
tomasz 1410 1265 1423 0 10 Oct31 ? 00:00:02 /usr/bin/gnome-shell
tomasz 1410 1265 1424 0 10 Oct31 ? 00:00:00 /usr/bin/gnome-shell
tomasz 1410 1265 1425 7 10 Oct31 ? 02:33:40 /usr/bin/gnome-shell
tomasz 1410 1265 1426 7 10 Oct31 ? 02:32:22 /usr/bin/gnome-shell
tomasz 1410 1265 1427 7 10 Oct31 ? 02:32:50 /usr/bin/gnome-shell
tomasz 1410 1265 1434 0 10 Oct31 ? 00:00:02 /usr/bin/gnome-shell
tomasz 1410 1265 1435 0 10 Oct31 ? 00:00:02 /usr/bin/gnome-shell
tomasz 1410 1265 1436 0 10 Oct31 ? 00:00:02 /usr/bin/gnome-shell

So it's definitely using multiple threads.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Wow, yes. That is unusual. Multiple threads exist in gnome-shell but they're pretty well hidden from the main code, mostly handling asynchronous IO etc...

Next we need to see more information about the machine. Please run this command to send it automatically:

  apport-collect 1850874

no longer affects: mutter (Ubuntu)
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote : Dependencies.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote : ProcEnviron.txt

apport information

Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote : ShellJournal.txt

apport information

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: gnome-shell 100% CPU usage on all cores when animated gif is displayed

Thanks. The above attachment suggests to me that this is a virtual machine or something unusual, because:

[ 34.403367] tomasz gnome-shell[1410]: Failed to initialize accelerated iGPU/dGPU framebuffer sharing: Do not want to use software renderer (llvmpipe (LLVM 9.0, 256 bits)), falling back to CPU copy path
[ 34.918603] tomasz gnome-shell[1410]: glamor: 'wl_drm' not supported
[ 34.918603] tomasz gnome-shell[1410]: Missing Wayland requirements for glamor GBM backend
[ 34.918603] tomasz gnome-shell[1410]: Failed to initialize glamor, falling back to sw

So that's where all the CPU is going... It's Mesa trying to use all the CPU cores to emulate a GPU in software. Probably.

Next, please:

1. Run: lspci -k > lspcik.txt
   and attach the file 'lspcik.txt'

2. Run: glxinfo > glxinfo.txt
   and attach the file 'glxinfo.txt'

3. Tell us if you have any gnome-shell extensions installed.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

4. Run: dmesg > dmesg.txt
   and attach the file 'dmesg.txt'

Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote :

Yes, it is a virtual machine (and hence 3 CPUs!) - though it didn't show these symptoms with Ubuntu 19.04 (noticed by laptop fans going on as soon as I visit a page with animated gifs, i.e. showing build status and such).

There are no gnome extensions installed.

Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote :
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm not sure what changed to make 19.10 heavier than 19.04, but I can explain what you are seeing.

What you are seeing is an OpenGL-based application (Firefox or Chromium) that is being forced to update its entire window constantly. Since it is OpenGL-based, gnome-shell does not have the opportunity to identify just the small area of the screen that is changing, but has to update the entire application window at full frame rate. To do that in software without a GPU is expected to use a lot of CPU and multiple threads, sorry.

summary: - gnome-shell 100% CPU usage on all cores when animated gif is displayed
+ gnome-shell (via Mesa/LLVMpipe in a virtual machine) uses all CPU cores
+ just to update the screen
Changed in gnome-shell (Ubuntu):
importance: Undecided → Low
status: Incomplete → Triaged
Changed in mesa (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote : Re: gnome-shell (via Mesa/LLVMpipe in a virtual machine) uses all CPU cores just to update the screen

There is one more change I did after upgrading from 19.04 to 19.10.

This is a KVM VM - and for some reason, the GUI (X) sometimes freezes after the VM is paused/saved/resumed, while SSH still works (this was also before 19.10 and behaviour did not improve in 19.10).

I've changed to Wayland to see if it this kind of freezing happens there as well (so far, it doesn't).

High CPU usage on all cores happens with Wayland only. I've just checked, it doesn't happen with regular X; CPU usage is normal/low there.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I think the Gnome Shell developers have been working on how that code (efficient screen updates for VMs) works in Wayland sessions. But I don't know the details. Let's hope mutter 3.36 performs better in that area.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Comment #16 is confusing because it sounds like you're now talking about multiple unrelated issues. It is also confusing because comment #16 suggests this bug occurs in Wayland only but comment #13 looks like it's from Xorg.

Is this bug affecting Wayland sessions only?

Changed in gnome-shell (Ubuntu):
status: Triaged → Incomplete
Changed in mesa (Ubuntu):
status: Triaged → Incomplete
Changed in mutter (Ubuntu):
status: New → Incomplete
Changed in mesa (Ubuntu):
importance: Low → Undecided
Changed in gnome-shell (Ubuntu):
importance: Low → Undecided
Revision history for this message
TomaszChmielewski (mangoo-wpkg) wrote :

This bug only is present on Wayland.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thanks. I've now added this bug to the performance tracking list: https://trello.com/c/pe5mRmx7

summary: gnome-shell (via Mesa/LLVMpipe in a virtual machine) uses all CPU cores
- just to update the screen
+ just to update the screen (on Wayland only)
tags: added: wayland wayland-session
Changed in gnome-shell (Ubuntu):
importance: Undecided → Medium
Changed in mesa (Ubuntu):
importance: Undecided → Medium
Changed in mutter (Ubuntu):
importance: Undecided → Medium
Changed in gnome-shell (Ubuntu):
status: Incomplete → New
Changed in mesa (Ubuntu):
status: Incomplete → New
Changed in mutter (Ubuntu):
status: Incomplete → New
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for reporting this bug to Ubuntu.
Ubuntu 19.10 (eoan) reached end-of-life on July 17, 2020.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

We appreciate that this bug may be old and you might not be interested in discussing it any more. But if you are then please upgrade to the latest Ubuntu version and re-test. If you then find the bug is still present in the newer Ubuntu version, please add a comment here telling us which new version it is in and change the bug status to Confirmed.

Changed in gnome-shell (Ubuntu):
status: New → Won't Fix
Changed in mesa (Ubuntu):
status: New → Won't Fix
Changed in mutter (Ubuntu):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.