intel / gvt-linux

Other
503 stars 94 forks source link

GVT-g VM restarts Desktop/Window Manager without crashing itself #204

Closed HamzaTGP closed 1 year ago

HamzaTGP commented 2 years ago

Hey, I recently got an i9-10850k and tried doing GVT-g. Everything is successful but when booting it, it would crash and then start my desktop manager again (Like on KDE, it would crash KDE and put me back into SDDM). Window Managers also are affected (AwesomeWM puts me back into tty). This happens when booting up the machine, installing drivers on the vm, connecting through looking glass, and when changing the resolution, and there might be more I didn't experience. The virtual machine stays active and I am able to reconnect to it after it crashes. I have my display connected to the RTX 3060. I also tried GVT-d but it is refusing to work. I am using virt-manager

I am using looking glass to connect to vm (vm is running windows)

Here is journalctl: https://pastebin.com/2F7Hpdsd Here is my xml: https://pastebin.com/tEkTPtSz Here is my dmesg: https://pastebin.com/T7v8ubMX

"kscreen_backend[9498]: segfault at 10 ip 00007ff95bc4060c sp 00007ffea1551a20 error 4 in KSC_XRandR.so[7ff95bc3d000+11000]" from journalctl, looks interesting

Host: Arch linux, 5.16.16-zen1-1-zen Desktop Environment: KDE CPU: i9-10850k iGPU: Intel UHD Graphics 630 dGPU: RTX 3060

rahulc07 commented 2 years ago

Try using a older kernel... I have had problems with any kernel newer than 5.11 if you need a i915 patch to make 5.11 boot with display off the IGD on comet lake I can give it to you (from Ubuntu 21.04). (I9-10900 on a b560 board)

ThalesBarretto commented 2 years ago

did you try the solutions posted in here and here ?

HamzaTGP commented 2 years ago

@xXTeraXx @ThalesBarretto tried both of your solutions, both did not work. KDE keeps on crashing when the operating system within the vm posts

ThalesBarretto commented 2 years ago

@xXTeraXx @ThalesBarretto tried both of your solutions, both did not work. KDE keeps on crashing when the operating system within the vm posts

@HamzaTGP i suggest changing "intel_iommu=on" to "intel_iommu=igfx_off" and report back.

HamzaTGP commented 2 years ago

Nope, still doesn't fix it

ThalesBarretto commented 2 years ago

@xXTeraXx @ThalesBarretto tried both of your solutions, both did not work. KDE keeps on crashing when the operating system within the vm posts

Looks like it's not related to gvt-g at all ... i guess some people at KDE could help you better. Or people at LookingGlass project.

HamzaTGP commented 2 years ago

Its not only KDE which crashes, its all window managers and desktop managers. Maybe an issue with X?

ThalesBarretto commented 2 years ago

@HamzaTGP I don't know, to be honest. But segfault with error 4 in KSC_XRandR.so could mean something to KDE people:

_"[ 1119.050637] kscreen_backend[9498]: segfault at 10 ip 00007ff95bc4060c sp 00007ffea1551a20 error 4 in KSCXRandR.so[7ff95bc3d000+11000]"

In a nutshell, by using GVT-g you will read the framebuffer of the guest from a program running on the host. When you change the guest vGPU framebuffer (by enabling it, or resizing), i guess you read the guest framebuffer with another pointer or beyond limits, which may be somehow causing those segfaults.

In practice, i think that using the discrete GPU as your main may trigger the problem. AFAIK the X server does not handle well multiple graphics cards for workspace rendering (only one is your main GPU). When you switch your main GPU (in laptops with multiple graphics cards), the X server must be restarted, otherwise it would crash, much like your problem.

Please, consider the following scenarios:

  1. main GPU: iGPU guest GPU: discrete (passthrough to guest VM) => no GVT-g needed
  2. main GPU: discrete guest GPU: iGPU (passthrough to guest VM) => no GVT-g needed
  3. main GPU: iGPU guest GPU: vGPU (through GVT-g) => discrete GPU as secondary.

You can try 3: choose the iGPU as your main. You can still use your discrete card for specific applications. (you will need to figure out how: mobo settings, configuration files, connect display to iGPU connector, etc - look for guides).

Else, you can go full passthrough and try 1 or 2. There are guides out there

kamalmjt commented 1 year ago

I have same problem. Kernel: Linux 5.19.0-42-generic #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1 i915.enable_gvt=1 i915.enable_fbc=0 intel_iommu=igfx_off kvm.ignore_msrs=1"

HamzaTGP commented 1 year ago

@kamalmjt could you please provide me with your CPU model? Thanks.

kamalmjt commented 1 year ago

Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630] (rev 02) DeviceName: Onboard - Video Subsystem: Micro-Star International Co., Ltd. [MSI] CoffeeLake-H GT2 [UHD Graphics 630] Kernel driver in use: i915 Kernel modules: i915

01:00.0 3D controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1) Subsystem: Micro-Star International Co., Ltd. [MSI] TU117M [GeForce GTX 1650 Mobile / Max-Q] Kernel driver in use: nvidia Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

HamzaTGP commented 1 year ago

Huh, that's weird. Both of our systems share nothing in common except the fact that we both have an nvidia GPU, and we both have an intel UHD Graphics 630, but my revision is 05 and yours is 02. That's very weird, maybe it is not a hardware problem?

Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz 00:02.0 Display controller: Intel Corporation CometLake-S GT2 [UHD Graphics 630] (rev 05) DeviceName: Onboard - Video Subsystem: ASUSTeK Computer Inc. CometLake-S GT2 [UHD Graphics 630] Flags: bus master, fast devsel, latency 0, IRQ 138, IOMMU group 0 Memory at 70000000 (64-bit, non-prefetchable) [size=16M] Memory at 80000000 (64-bit, prefetchable) [size=512M] I/O ports at 5000 [size=64] Capabilities: [40] Vendor Specific Information: Len=0c <?> Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00 Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable- 64bit- Capabilities: [d0] Power Management version 2 Capabilities: [100] Process Address Space ID (PASID) Capabilities: [200] Address Translation Service (ATS) Capabilities: [300] Page Request Interface (PRI) Kernel driver in use: i915 Kernel modules: i915

01:00.0 VGA compatible controller: NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate] (rev a1) (prog-if 00 [VGA controller]) Subsystem: NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate] Flags: bus master, fast devsel, latency 0, IRQ 139, IOMMU group 2 Memory at 71000000 (32-bit, non-prefetchable) [size=16M] Memory at a0000000 (64-bit, prefetchable) [size=256M] Memory at b0000000 (64-bit, prefetchable) [size=32M] I/O ports at 4000 [size=128] Expansion ROM at 000c0000 [virtual] [disabled] [size=128K] Capabilities: [60] Power Management version 3 Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [78] Express Legacy Endpoint, MSI 00 Capabilities: [b4] Vendor Specific Information: Len=14 <?> Capabilities: [100] Virtual Channel Capabilities: [250] Latency Tolerance Reporting Capabilities: [258] L1 PM Substates Capabilities: [128] Power Budgeting <?> Capabilities: [420] Advanced Error Reporting Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?> Capabilities: [900] Secondary PCI Express Capabilities: [bb0] Physical Resizable BAR Capabilities: [c1c] Physical Layer 16.0 GT/s <?> Capabilities: [d00] Lane Margining at the Receiver <?> Capabilities: [e00] Data Link Feature <?> Kernel driver in use: nvidia Kernel modules: nouveau, nvidia_drm, nvidia