MacOS 12.4 Ubuntu 22.04 guest extreme CPU use

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
crh
Posts: 10
Joined: 2. Apr 2014, 23:13

MacOS 12.4 Ubuntu 22.04 guest extreme CPU use

Post by crh »

I am using a 2019 Core i9 16" Macbook Pro with 32GB of RAM and Monterey (12.4). Using an Ubuntu 22.04 guest new install with 4 cores/8GB/48GB assigned is a) sluggish/unresponsive when trying to change Ubuntu screen settings (200% so it becomes readable) and b) uses up to 600% CPU on the host. The guest load average is at about 0.3, the host load average is above 6. This condition persists for several minutes and reoccurs when changes to the display setting are made (even something as simple as changing the resolution. Memory usage is sitting at 6GB during this time.

I upgraded the VirtualBox install from 6.1.32 to 6.1.34 today. Ubuntu has the newest updates and Guest additions installed successfully.

The log for the VM is attached. Taken during the high load condition (approximately 4 minutes in).

One interesting side effect I see is that the screen capture (command-shift-4) does not work during the high load condition.

Note: VirtualBox ran without problems last time I used it, but that was before the Monterey update. My previous Ubuntu install, which shows the same problems under the new system, ran without any problems under the previous (MacOS 12.3.x, VBox 6.1.32) configuration.
VBox.log
Log taken during high load condition.
(117.49 KiB) Downloaded 4 times
multiOS
Volunteer
Posts: 800
Joined: 14. Sep 2019, 16:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WIN11,10, 7, Linux (various)
Location: United Kingdom

Re: MacOS 12.4 Ubuntu 22.04 guest extreme CPU use

Post by multiOS »

Unfortunately Logs taken from a running VM lack a lot of diagnostic information. Please try again by shutting down the VM normally when you experience the reported problem. You will need to 'zip' the log produced to keep below the upload limit.

One thing you could try as a general test, if you haven't already, is to switch from the Wayland default to 'X' session before logging in to Ubuntu to check if that makes any difference to performance.
crh
Posts: 10
Joined: 2. Apr 2014, 23:13

Re: MacOS 12.4 Ubuntu 22.04 guest extreme CPU use

Post by crh »

I had to do an ACPI shutdown because the VM did not respond to anything for several minutes. The log appears to have a lot of debug info though, so I hope it may be useful.

Steps to reproduce:
* In Ubuntu, open display settings, then choose 200% scale (otherwise the text is not readable in the VM)
* Confirm to keep the size
* Afterwards resize the window a tiny bit
* The desktop will revert to 100% scale
* Host CPU goes up to 600%
* Desktop is entirely unresponsive.

Occurrence rate in my tests: 100%.

With Xorg the phenomen does not appear the same way. Xorg is still a lot more sluggish than it was under the previous setup. Wayland is also sluggish. Window tearing, stuttering, window not following the mouse cursor at a steady rate. Under Xorg the host CPU does not appear stressed but things are still a lot slower than they were.
Attachments
VBox.log.gz
Log after shutdown of the VM
(45.03 KiB) Downloaded 3 times
crh
Posts: 10
Joined: 2. Apr 2014, 23:13

Re: MacOS 12.4 Ubuntu 22.04 guest extreme CPU use

Post by crh »

For reference, here is the log after a sequence with the XOrg and the same steps (which did not lead to the high CPU condition or unresponsiveness.
Attachments
VBox.log.gz
(45.13 KiB) Downloaded 3 times
multiOS
Volunteer
Posts: 800
Joined: 14. Sep 2019, 16:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WIN11,10, 7, Linux (various)
Location: United Kingdom

Re: MacOS 12.4 Ubuntu 22.04 guest extreme CPU use

Post by multiOS »

Thanks for the new Logs and supporting comments.

It appears that part of the issue you've seen are linked to the fact, that from the release of Ubuntu 22.04, Canonical changed the default display protocol from X11 to Wayland; and Wayland appears to be less suited to working with Virtual Graphics Adapters, as used by VirtualBox. Resetting the login to use X11 is probably the best option. There are also comments about this issue (not limited to ubuntu) to be found involving the combination of Gnome Desktop and Wayland. e.g. https://askubuntu.com/questions/1402124 ... th-wayland.

The logs don't appear (to me) to point to any other obvious issues or problems, but it would be worthwhile to test performance with fewer resources being allocated to the Ubuntu VM as over-provisioning of VMs can have a negative impact on performance, as unused resources still have to be managed. It may seem counter-intuitive but, unless the VM is regularly used for running 'heavyweight' applications, or intensive data management processes I would suggest scaling back to 2CPUs + 2 or 4Gb RAM and only consider increasing from that if you experience problems. All of the Linux (and Windows) based VMs I've regularly used have performed well with a modest allocation of 2CPU's, 2GB RAM, + 128MB VRAM, but your use may, of course, be completely different.
Post Reply