After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 791024 - Backport "poll() on KMS fd on EAGAIN" to stable
Backport "poll() on KMS fd on EAGAIN" to stable
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2017-11-30 13:27 UTC by Benjamin Berg
Modified: 2017-12-15 09:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
monitor-manager-kms: poll() on KMS fd on EAGAIN (1.90 KB, patch)
2017-11-30 13:27 UTC, Benjamin Berg
committed Details | Review
monitor-manager-kms: poll() on KMS fd on EAGAIN (1.90 KB, patch)
2017-12-11 10:45 UTC, Benjamin Berg
committed Details | Review
monitor-manager-kms: Fix recently introduced build issue (1.19 KB, patch)
2017-12-14 19:42 UTC, Benjamin Berg
committed Details | Review
monitor-manager-kms: Fix recently introduced build issue (1.19 KB, patch)
2017-12-15 09:17 UTC, Benjamin Berg
committed Details | Review

Description Benjamin Berg 2017-11-30 13:27:11 UTC
This issue eats a lot of CPU time causing busy waiting (CPU usage between
30-70%) when doing lightweight task like displaying a spinner or moving the
mouse.

I have not done further testing than compiling the patch, as mutter
currently fails to build from source on Fedora 27 (some issue with a
pipewire include).

We have verified though that the problem does not exist in Fedora rawhide
with mutter 3.27.x.
Comment 1 Benjamin Berg 2017-11-30 13:27:16 UTC
Created attachment 364669 [details] [review]
monitor-manager-kms: poll() on KMS fd on EAGAIN

When drmHandleEvent() returns an error and errno is set to EAGAIN,
instead of ending up in a busy loop, poll() the fd until there is
anything to read.

This is a simple backport of commit 406359bba1.
Comment 2 Jonas Ådahl 2017-12-11 08:57:39 UTC
Review of attachment 364669 [details] [review]:

lgtm
Comment 3 Benjamin Berg 2017-12-11 10:45:25 UTC
The following fix has been pushed:
6dd28bd monitor-manager-kms: poll() on KMS fd on EAGAIN
Comment 4 Benjamin Berg 2017-12-11 10:45:35 UTC
Created attachment 365352 [details] [review]
monitor-manager-kms: poll() on KMS fd on EAGAIN

When drmHandleEvent() returns an error and errno is set to EAGAIN,
instead of ending up in a busy loop, poll() the fd until there is
anything to read.

This is a simple backport of commit 406359bba1.
Comment 5 adee.edu 2017-12-14 18:06:52 UTC
This does not even build:

backends/native/meta-monitor-manager-kms.c: In function ‘meta_monitor_manager_kms_wait_for_flip’:
backends/native/meta-monitor-manager-kms.c:1796:36: error: ‘error’ undeclared (first use in this function); did you mean ‘perror’?
               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
                                    ^~~~~
                                    perror


And it's already in the stable branch.
Comment 6 Benjamin Berg 2017-12-14 19:42:50 UTC
Created attachment 365558 [details] [review]
monitor-manager-kms: Fix recently introduced build issue

The recent commit 6dd28bd2c7e0c "poll() on KMS fd on EAGAIN" backported
error handling code that does not apply to the gnome-3-26 branch.
Comment 7 Benjamin Berg 2017-12-14 19:44:50 UTC
Sorry, seems like I did not even compile test it in the end; not sure how that happened :-/
Comment 8 Florian Müllner 2017-12-14 22:50:28 UTC
Review of attachment 365558 [details] [review]:

LGTM
Comment 9 Benjamin Berg 2017-12-15 09:17:46 UTC
Pushed to stable branch.


The following fix has been pushed:
ae46004 monitor-manager-kms: Fix recently introduced build issue
Comment 10 Benjamin Berg 2017-12-15 09:17:56 UTC
Created attachment 365581 [details] [review]
monitor-manager-kms: Fix recently introduced build issue

The recent commit 6dd28bd2c7e0c "poll() on KMS fd on EAGAIN" backported
error handling code that does not apply to the gnome-3-26 branch.