[Freezing/Lagging] Deepin 20.5 虚拟机环境下休眠后大量占用系统资源
Tofloor
poster avatar
AYO
deepin
2022-04-07 23:38
Author

如下图所示,长时间不使用Deepin会进入休眠状态,此时会大量占用CPU资源且无法唤醒,只能通过虚拟机强制关机重启。

CPU:i7-11390H

Windows系统版本:Windows 11专业版21H2,22000.556

VMware Workstation版本: 16.2.3 build-19376536

Deepin版本:社区 20.5

Linux内核版本:Linux 5.10.101-amd64-desktop

image.png

Reply Favorite View the author
All Replies
jjcui8595
deepin
2022-04-08 02:06
#1

关闭休眠

Reply View the author
Mr-Wan
deepin
2022-04-08 02:08
#2

坦白说,这不是个单纯linux的问题,应该算个vmware-tools或open-vm-tools问题.或者算是vmware workstation的问题,甚至有可能是windows11的问题.

普遍性情况经常这样,解决就是关闭guestOS的那些休眠待机黑屏之类的功能.因为虚拟机功能上并不支持完整的acpi.

Reply View the author
AYO
deepin
2022-04-08 18:31
#3
jjcui8595

关闭休眠

关闭只能解决问题,不能解决bug根本啊

Reply View the author
AYO
deepin
2022-04-08 18:33
#4
Mr-Wan

坦白说,这不是个单纯linux的问题,应该算个vmware-tools或open-vm-tools问题.或者算是vmware workstation的问题,甚至有可能是windows11的问题.

普遍性情况经常这样,解决就是关闭guestOS的那些休眠待机黑屏之类的功能.因为虚拟机功能上并不支持完整的acpi.

我之前在虚拟机里跑Ubuntu 21.04就正常休眠正常唤醒啊

Reply View the author
Mr-Wan
deepin
2022-04-09 07:11
#5
AYO

我之前在虚拟机里跑Ubuntu 21.04就正常休眠正常唤醒啊

看看有没有安装 open-vm-tools

apt list open-vm-tools

如果没有显示已安装,就安装下试试.

Reply View the author
AYO
deepin
2022-04-10 07:39
#6
Mr-Wan

看看有没有安装 open-vm-tools

apt list open-vm-tools

如果没有显示已安装,就安装下试试.

装了

😂

Reply View the author
Mr-Wan
deepin
2022-04-15 03:42
#7
AYO

装了

😂

个人没能尝试ubuntu2104,我下载了2110.在我的机器上,ubuntu2110在vm内部执行suspend后,现象是黑屏,左上角有一光标,然后卡在那里。

我试验了centos7,可以在我的机器上可以实现vm内部suspend功能,即使在不安装open-vm-tools的情况下。其他我尝试过的deepin20.4 20.5 debian11.2 11.3(devuan) , rocky8.5(centos8.5) ,arch22 ,都不能实现suspend to ram.都会有占用CPU的情况。


查看了下open-vm-tools的说明(open-vm-tools由vmware开发),其内核模块部分是已经包含在内核代码中了。


《Linux Service Management Made Easy with systemd 》中关于suspend的片段。

In systemd , there []()are some runlevel-type targets that[]() have no SysV counterparts:

		* **emergency.target** is like  **rescue.target** , except that filesystems are mounted as read-only.
  • hibernate.target saves the system state and then powers down the machine.

  • suspend.target just puts the system to sleep without powering it down.

      	**hibernate.target** and  **suspend.target** , which aren't needed on server implementations of Linux, are a big help to the growing numbers of people who use Linux on laptop and desktop computers. Prior to systemd, there was no good, standardized way of implementing these features.
    

在systemd中尚未有标准化的、优秀的解决方案解决hibernate 和suspend的问题。


观察centos7的suspend过程,貌似有vm内部的suspend to ram过程,然后会通知vmwar workstation把状态存进虚拟机文件夹的内存镜像文件,好像是vmss文件。

观察其他发行版,貌似是执行了内部suspend to ram过程,至少是部分执行,然后就卡在黑屏左上角有个光标那里了。设定为1分钟后 自动suspend to ram 是同样现象。选择方块强行关机的时候,貌似arch会现实一段文字,看起来是接收到vmware-workstation发送的强行关机信号。deepin看不出来,可能是不显示。


看起来就是vm在suspend的过程中与workstation无法正确沟通。或者是vm无法让workstation知道自己在suspend状态,或者无法让workstation执行 保存内存的功能。而vm进入suspend状态后 workstation无法发送resume请求,或者发送的请求vm不认识。


在成功suspend的centos7上,自动安装和手动只指定内核版本的minimal server下都可以实现。事实上,我尝试了在这个centos7同样的workstation硬件配置下安装了deepin20.5,仍旧是同样的不可以suspend。

个人认为的重点就在于vm和workstation之间关于电源管理的信息传递。有时间我也许会看看ubuntu2104.

Reply View the author