OSDN Git Service

drm/vmwgfx: Be a lot more flexible with MOB limits
authorZack Rusin <zackr@vmware.com>
Fri, 23 Jul 2021 16:51:52 +0000 (12:51 -0400)
committerZack Rusin <zackr@vmware.com>
Wed, 28 Jul 2021 18:53:25 +0000 (14:53 -0400)
commitcfdc3458db8a1620b1e307e3cb07480a161146ab
treebcc852a13ee65846245df1183c0a46b4d051a770
parent2b273544f5800a38673883fc591ce4d83a2bedb3
drm/vmwgfx: Be a lot more flexible with MOB limits

The code was trying to keep a strict limit on the amount of mob
memory that was used in the guest by making it match the host
settings. There's technically no reason to do that (guests can
certainly use more than the host can have resident in renderers
at the same time).

In particular this is problematic because our userspace is not
great at handling OOM conditions and running out of MOB space
results in GL apps crashing, e.g. gnome-shell likes to allocate
huge surfaces (~61MB for the desktop on 2560x1600 with two workspaces)
and running out of memory there means that the gnome-shell crashes
on startup taking us back to the login and resulting in a system
where one can not login in graphically anymore.

Instead of letting the userspace crash we can extend available
MOB space, we just don't want to use all of the RAM for graphics,
so we're going to limit it to half of RAM.

With the addition of some extra logging this should make the
"guest has been configured with not enough graphics memory"
errors a lot easier to diagnose in cases where the automatic
expansion of MOB space fails.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Martin Krastev <krastevm@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210723165153.113198-3-zackr@vmware.com
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c