100% cpu with every scroll in LibreOffice

Thank you very much for the explanation.

I have tested LibreOffice again on Fedora 35 AppVM and I found out it depends on the display settings. It is just very slow over a 4k monitor. I don’t know if this problem can be solved easily, but all other applications run smoothly on 4k.

1 Like

I’ll get rid of my 4k monitor. Thanks…

After uninstalling the libreoffice-gtk3 package libreoffice runs faster, without lags, but the font in the app gui interface is very very small. This applies to vm based on debian 11 and fedora 36. My monitor has a resolution of 1920x1080.

How did you deal with this?

In libreoffice there is currently no way to change the font size in menus etc.

1 Like

Here is the real fix. Put this in /etc/profile.d/libreoffice_kf5.sh in your template qube:

export SAL_USE_VCLPLUGIN=kf5

Then install the following package in your template qube:

dnf install -y libreoffice-kf5

Stop your template qube and your application qube. Start your application qube and open up LibreOffice. It should run almost as fast as it used to.

Writeup is also here:

Does this now work reliably even when starting from within Nautilus (see 100% cpu with every scroll in LibreOffice - #29 by equbes)?

I also see that discussion in Make qubes-session inherit the systemd user session variables. by Rudd-O · Pull Request #151 · QubesOS/qubes-gui-agent-linux · GitHub resulted in you blogging about /etc/environment.d. How is this different from what you just recommended @Rudd-O?

Works great if you start libreoffice first. Starting from nautilus results in super-slow performance.

[I know I’m resurrecting an old post :slightly_smiling_face:]

It’s interesting that only a few people complained about that issue as it really prevents working with LO with the GTK3 VCL plugin. Or maybe everybody found this post and is using the ‘gen’ or ‘kf5’ workaround?

Anyway - comment added to a similar LO bug report:

https://bugs.documentfoundation.org/show_bug.cgi?id=152657

Necrophile.

It’s also possible that the few complainers represented the few people
affected by this issue.
Very often I see people complaining that “Qubes is broken” or “This
doesn’t work”. A moments thought would tell them that theirs is not a
general issue, and is likely specific to their hardware of software
configuration.
Of course, there are bugs that affect everyone, and some of them may
have been lurking unnoticed for a long time. Such is life.

I never presume to speak for the Qubes team. When I comment in the Forum or in the mailing lists I speak for myself.
2 Likes

Necrophile

let’s say I’m avoiding duplication :slightly_smiling_face:

It’s also possible that the few complainers represented the few people
affected by this issue

Well, I remember having that issue after upgrading to 4.1 (or was it 4.0? - time is flying). That was with a Thinkpad T450s then. I recently bought a desktop PC: totally different hardware, clean 4.1.2 install, same issue, same workaround. Coincidence? Given that the LO bug seems to be related to GPU (lack of?) acceleration, I’d have expected all Qubes OS users to be affected - yet there aren’t many complaints.
It’s very well possible that only a subset of users open “larger/heavier” spreadsheets where the problem is really noticeable - but it’s also possible that only a few people are hit by this bug, in which case it would be helpful to understand what causes it and find a solution, not a workaround. The goal here is that new Qubes OS users don’t simply complain that “Qubes is broken”.

So - do you use LO, and if so do you have that issue? (as said it takes a pretty large/heavy spreadsheet to notice the problem).

1 Like

I do use LO occasionally and have never encountered this.
I have asked among users I know who do substantial work with
spreadsheets, and they don’t recognise the problem.
I suspect this is another case where more detail from the reporters
would be helpful in determining the causes - I haven’t checked the thread
to see if that information was provided.
I should say that one persons work round is another person’s solution.

I never presume to speak for the Qubes team. When I comment in the Forum or in the mailing lists I speak for myself.

As discussed in other places in this forum, we are using Qubes as our main OS at work (currently about 10 people).

With a slowly but steadily growing team we recently started to have our first Qubes user with little tech experience. She is working mainly on accounting tasks. As these rely on LO spreadsheets, we stumbled upon this issue after a while.

The thing is: Qubes is that different from the accustomed “regular computer” user experience for her that she didn’t bring up this issue on her own. Instead, it became apparent only when others were sitting with her at her desk, realising that LO was “very slow” or even “unusable” (depending on one’s own expectations/experiences/tolerance).

I think lots of hiccups or smaller issues can be hidden underneath this layer of “I know Qubes is different and I don’t expect it to behave as I am used to”. Nevertheless, they are bugs that can be tackled to improve the Qubes user experience.

In this particular case, the problem became visible after changing from a Qubes 4.0 installation to Qubes 4.1 (no upgrade, but a clean reinstall with restored AppVMs if I am not mistaken), both on an older, (but by no means ancient or computationally weak) ThinkPad T450.

The “quick fix” for us was to upgrade her hardware to a T470 with a quad core CPU. Currently, this works much smoother but I guess the underlying issue still exists. We are understaffed in IT Support personnel and have not yet found the time to debug this further. She reports that the new hardware is “much better”.

It seems that short tests with LO spreadsheets on other systems indicate similar behaviour across all devices: the Qubes 4.1 installations are much slower and show the same 100% Xorg CPU usage effect. All devices are ThinkPads, but across multiple generations (T450, T470, T490).

I don’t know if this is a point in favor of this being a more widespread issue because of our homogeneous hardware, but then again ThinkPads are quite common among Linux (and Qubes) users.

2 Likes

I’ve seen the same issue on my T430 when the GTK3 flavor with R4.1 is used. Switching to Generic of KF5 (KDE) flavor fixes the issue. I can also confirm that this issue only exists on R4.1. I’ve used debian-11-minimal in both scenario (R4.0 / R4.1)

I’m still using R4.0 after downgrading a few months ago in the context of freezes and crashes. The experience of R4.0 on my T430 is so much better that I feel a strong inertia to try to go back up to R4.1 although I know I have to eventually.

Yet another reason for switching to KDE, and explanation for why I
have no reports.

I never presume to speak for the Qubes team. When I comment in the Forum or in the mailing lists I speak for myself.
1 Like

@phl - thanks for your description of the problem.

Well, “throw more resources” is usually the easy fix :slightly_smiling_face:
I also thought LO’s sluggishness would be mitigated by my higher-spec hardware but LO with the default gtk ui is still unusable.

I assume you’re still using up-to-date templates with the latest version of LO? If so that would be interesting to find out what the differences are between identical/similar versions of LO and R4.0 vs R4.1.
Care to share your LO version, template OS, and the output of glxinfo -B (both in dom0 and your appvm)?

I understand, but I’d expect that users comfortable enough to switch to KDE would probably have found the KF5 workaround; and switching to KDE just because of LO seems a bit too much (to be fair to GTK I don’t have any other issues).

Also, on my setup KF5 is much better but not without glitches; the screenshot below shows the truncated text bar, making it impossible to type complicated formulas without “enlarging” the bar with the button on the right (not displayed on the pic), which uses quite a lot of vertical screen estate.

bar

(probably because of some dpi stuff - but then I’ll have to debug KDE and dpi/scaling :neutral_face:)

1 Like

I was being facetious, although my second point stands.

Version: 7.0.4.2
Debian package version: 1:7.0.4-4+deb11u6

Debian 11 “bullseye” (minimal)

[user@dom0 ~]$ glxinfo -B
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
     Vendor: Intel Open Source Technology Center (0x8086)
     Device: Mesa DRI Intel(R) Ivybridge Mobile  (0x166)
     Version: 17.0.5
     Accelerated: yes
     Video memory: 1536MB
     Unified memory: yes
     Preferred profile: core (0x1)
     Max core profile version: 3.3
     Max compat profile version: 3.0
     Max GLES1 profile version: 1.1
     Max GLES[23] profile version: 3.0
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile
OpenGL core profile version string: 3.3 (Core Profile) Mesa 17.0.5
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.0 Mesa 17.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 17.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
user@offline:~$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
     Vendor: Mesa/X.org (0xffffffff)
     Device: llvmpipe (LLVM 11.0.1, 256 bits) (0xffffffff)
     Version: 20.3.5
     Accelerated: no
     Video memory: 953MB
     Unified memory: no
     Preferred profile: core (0x1)
     Max core profile version: 4.5
     Max compat profile version: 3.1
     Max GLES1 profile version: 1.1
     Max GLES[23] profile version: 3.2
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 11.0.1, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 20.3.5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.1 Mesa 20.3.5
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.3.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

HTH

You don’t need to switch to KDE just to use the KDE flavor of LO.

Just make sure libreoffice-gnome and libreoffice-gtk3 are NOT installed and libreoffice-kf5 is installed. It will pull in all necessary dependencies.

You can additionally define SAL_USE_VCLPLUGIN=kf5

(the package names above work on Debian, I trust you can find the Fedora equivalent on your own)

@Sven - thanks.

I did more tests with various Mesa and LO versions. Mesa doesn’t seem to be the culprit: with the gtk3 VCL plugin, LO v7.0.4.2 doesn’t lag on R4.1 on debian-11 and debian-12; but v7.3.7.2 is unusable on f36 (and f37, and debian-12 with the debian’s LO debs, and debian-12 with LO debs, etc.).

→ will need to bisect LO versions to see which one introduced the issue.

[edit: the bug was introduced in 7.1.0.0.alpha1 ; 7.0.6.2, the previous version, is OK.]

[edit2 / 2023-05-15: bug filed: 155326 – Calc with gtk3 VCL is unusable with large spreadsheets: huge lag, high CPU usage, etc.]

[edit3 / 2023-06-07: found the commit that introduced the issue - comment]

tests

The main differences between R4.0 and R4.1 are Mesa versions: 17x vs 20x on dom0, while debian stable is on 20.x and fedora 37 on 23.x.

On my T450s with R4.1 I have accelerated graphics, but on my 13th gen hw R4.1 isn’t recent enough so no acceleration yet (=llvmpipe). Mind you, I just found this out and hadn’t even noticed any lag.
That would rule out acceleration in dom0 as a contributing factor to LO’s high CPU usage with VCL=gtk3.

Comparing templates:

on debian-11 minimal template, apt install libreoffice-calc mesa-utils.

→ LO uses the x11 VCL by default (same as SAL_USE_VCLPLUGIN=gen) so it’s blazing fast.

then, apt install libreoffice-gtk3=1:7.0.4-4+deb11u6.

→ LO was a bit slower than x11/gen but still much, much faster than LO on my f37 template: scrolling stopped immediately after releasing arrow keys, while on f37 scrolling went on for at least a few seconds.

OK - so debian-11 with LO 7.0.4.2 works on R4.1 whatever the VCL plugin.

Same test as above with a debian-12 ITL testing template (shipping with mesa: 22.x): LO is unusable, like in f36/f37 templates.

But LO version in debian-11 is 7.0.4.2; in f37 it’s 7.4.6.2; in debian-12 it’s 7.4.5.1.

Could it be that LO official releases (/debs) work while distro-packaged ones dont?

→ install libreoffice 7.0.4.2 from LO’s archive debs on debian-12: no lag.
→ install libreoffice 7.4.5.1. from LO’s archive debs on debian-12: lag.

So, it’s not an issue with distribution packages; LO seems to have introduced the bug somewhere between those versions.

4 Likes

For the record the LO commit that introduced the 100% CPU usage is identified (see bug link above), but despite the work/time I’ve spent debugging this the LO dev who asked me to bibisect/find the issue is MIA and/or not interested, with no reply since the end of June. I’ll ping him a last time before creating a Qubes issue asking the fedora template maintainer to consider including the qt5 fix (BTW one of the last qt5 updates fixed the graphical glitch I had with the truncated formula bar, so it’s now a 100% perfect replacement to gtk). As mentioned elsewhere, a lot more qubes users are likely to encounter the slow LO bug after the debian template is upgraded to 12 (as debian 11 has a pre-bug version of LO).

3 Likes

Okay I’m a bit lost here. Is there any known way to set the environment variable so that it also works when starting LO through Nautilus?

I would assume this is how most users use LO: by opening existing files they want to edit.

Thanks @taradiddles for your time on investigating this issue. Let’s hope we will soon see a fix upstream (although there still is no response in the bugreport since July as far as I saw :/).