gnif / LookingGlass

An extremely low latency KVMFR (KVM FrameRelay) implementation for guests with VGA PCI Passthrough.
GNU General Public License v2.0
4.6k stars 254 forks source link

Looking glass Host restarting when CPU or GPU peaks in usage. #1086

Closed racerxdl closed 11 months ago

racerxdl commented 11 months ago

I'm facing some weird issues in my laptop with looking glass. Whenever there is a high cpu usage peak or gpu usage peak, the looking glass restarts the capture. Not sure if that is happening inside the vm or outside (I would guess inside). The issue appears a bit random but highly correlated to CPU/GPU usage. Sometimes I can play for hours without any issue, but it always happen when I start a game or windows is starting up.

I can easily simulating by opening space engineers. This is what happens:

Gravação de tela de 11-08-2023 12:57:09.webm

In my desktop (with a 3070TI as well) this issue does not happen.

Extra information which might be needed:

Virtual Machine libvirt config:

<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
  <name>win11-ksh</name>
  <uuid>76cb2bf1-d22e-4a86-9900-f8a8d6f96506</uuid>
  <title>Windows 11 - KSWH</title>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/11"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit="KiB">33554432</memory>
  <currentMemory unit="KiB">33554432</currentMemory>
  <memoryBacking>
    <source type="memfd"/>
    <access mode="shared"/>
  </memoryBacking>
  <vcpu placement="static">10</vcpu>
  <cputune>
    <vcpupin vcpu="0" cpuset="2"/>
    <vcpupin vcpu="1" cpuset="3"/>
    <vcpupin vcpu="2" cpuset="4"/>
    <vcpupin vcpu="3" cpuset="5"/>
    <vcpupin vcpu="4" cpuset="6"/>
    <vcpupin vcpu="5" cpuset="7"/>
    <vcpupin vcpu="6" cpuset="8"/>
    <vcpupin vcpu="7" cpuset="9"/>
    <vcpupin vcpu="8" cpuset="10"/>
    <vcpupin vcpu="9" cpuset="11"/>
    <emulatorpin cpuset="0-1"/>
    <vcpusched vcpus="0" scheduler="rr" priority="1"/>
    <vcpusched vcpus="1" scheduler="rr" priority="1"/>
    <vcpusched vcpus="2" scheduler="rr" priority="1"/>
    <vcpusched vcpus="3" scheduler="rr" priority="1"/>
    <vcpusched vcpus="4" scheduler="rr" priority="1"/>
    <vcpusched vcpus="5" scheduler="rr" priority="1"/>
    <vcpusched vcpus="6" scheduler="rr" priority="1"/>
    <vcpusched vcpus="7" scheduler="rr" priority="1"/>
    <vcpusched vcpus="8" scheduler="rr" priority="1"/>
    <vcpusched vcpus="9" scheduler="rr" priority="1"/>
  </cputune>
  <os firmware="efi">
    <type arch="x86_64" machine="pc-q35-6.2">hvm</type>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode="custom">
      <relaxed state="on"/>
      <vapic state="on"/>
      <spinlocks state="on" retries="8191"/>
      <vpindex state="on"/>
      <synic state="on"/>
      <stimer state="on"/>
      <reset state="on"/>
      <vendor_id state="on" value="randomid"/>
    </hyperv>
    <vmport state="off"/>
    <ioapic driver="kvm"/>
  </features>
  <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="5" threads="2"/>
  </cpu>
  <clock offset="localtime">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none" io="native" discard="unmap"/>
      <source dev="/dev/mapper/luks-6f56b8aa-0304-48bd-b545-f975f36aef53"/>
      <target dev="vda" bus="virtio"/>
      <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
    </disk>
    <controller type="usb" index="0" model="qemu-xhci" ports="15">
      <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
    </controller>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="1" port="0x10"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="2" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="2" port="0x11"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
    </controller>
    <controller type="pci" index="3" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="3" port="0x12"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
    </controller>
    <controller type="pci" index="4" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="4" port="0x13"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
    </controller>
    <controller type="pci" index="5" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="5" port="0x14"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
    </controller>
    <controller type="pci" index="6" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="6" port="0x15"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
    </controller>
    <controller type="pci" index="7" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="7" port="0x16"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
    </controller>
    <controller type="pci" index="8" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="8" port="0x17"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
    </controller>
    <controller type="pci" index="9" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="9" port="0x18"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="10" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="10" port="0x19"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/>
    </controller>
    <controller type="pci" index="11" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="11" port="0x1a"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/>
    </controller>
    <controller type="pci" index="12" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="12" port="0x1b"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/>
    </controller>
    <controller type="pci" index="13" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="13" port="0x1c"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/>
    </controller>
    <controller type="pci" index="14" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="14" port="0x1d"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x5"/>
    </controller>
    <controller type="sata" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
    </controller>
    <controller type="virtio-serial" index="0">
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </controller>
    <filesystem type="mount" accessmode="passthrough">
      <driver type="virtiofs"/>
      <source dir="/shared"/>
      <target dir="Shared"/>
      <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
    </filesystem>
    <interface type="network">
      <mac address="52:54:00:26:ba:ba"/>
      <source network="default"/>
      <model type="virtio"/>
      <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </interface>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
      <address type="virtio-serial" controller="0" bus="0" port="1"/>
    </channel>
    <input type="tablet" bus="usb">
      <address type="usb" bus="0" port="1"/>
    </input>
    <input type="keyboard" bus="ps2"/>
    <input type="mouse" bus="ps2"/>
    <input type="mouse" bus="virtio">
      <address type="pci" domain="0x0000" bus="0x0a" slot="0x00" function="0x0"/>
    </input>
    <input type="keyboard" bus="usb">
      <address type="usb" bus="0" port="4"/>
    </input>
    <tpm model="tpm-crb">
      <backend type="emulator" version="2.0"/>
    </tpm>
    <graphics type="spice" autoport="yes">
      <listen type="address"/>
      <image compression="off"/>
    </graphics>
    <sound model="ich9">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
    </sound>
    <audio id="1" type="pulseaudio" serverName="127.0.0.1"/>
    <video>
      <model type="vga" vram="16384" heads="1" primary="yes"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
    </video>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
    </hostdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="2"/>
    </redirdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="3"/>
    </redirdev>
    <memballoon model="none"/>
  </devices>
  <qemu:commandline>
    <qemu:arg value="-fw_cfg"/>
    <qemu:arg value="opt/ovmf/X-PciMmio64Mb,string=65536"/>
    <qemu:arg value="-device"/>
    <qemu:arg value="{&quot;driver&quot;:&quot;ivshmem-plain&quot;,&quot;id&quot;:&quot;shmem0&quot;,&quot;memdev&quot;:&quot;looking-glass&quot;}"/>
    <qemu:arg value="-object"/>
    <qemu:arg value="{&quot;qom-type&quot;:&quot;memory-backend-file&quot;,&quot;id&quot;:&quot;looking-glass&quot;,&quot;mem-path&quot;:&quot;/dev/kvmfr0&quot;,&quot;size&quot;:134217728,&quot;share&quot;:true}"/>
    <qemu:env name="QEMU_AUDIO_DRV" value="pa"/>
    <qemu:env name="QEMU_PA_SERVER" value="/tmp/pulse-socket"/>
  </qemu:commandline>
</domain>

Bug Report Required Information

The log dont have anything special, just telling the capture restarted (no crash or anything). No related info in syslog, dmesg or vm log.

Client Log:

[I] 100986751950              main.c:1785 | main                           | Looking Glass (B6)
[I] 100986751997              main.c:1786 | main                           | Locking Method: Atomic
[I] 100986752702           cpuinfo.c:37   | lgDebugCPU                     | CPU Model: 12th Gen Intel(R) Core(TM) i7-12700H
[I] 100986752713           cpuinfo.c:38   | lgDebugCPU                     | CPU: 1 sockets, 14 cores, 20 threads
[I] 100986794313              main.c:1162 | lg_run                         | Using font: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
[I] 100986795067           ivshmem.c:128  | ivshmemOpenDev                 | KVMFR Device     : /dev/kvmfr0
[I] 100986807907             audio.c:159  | audio_init                     | Using AudioDev: PipeWire
[I] 100986807942                ps.c:245  | purespice_connect              | Connecting to socket 127.0.0.1:5900
[I] 100986820011               rsa.c:178  | rsa_encryptPassword            | Using Nettle
[I] 100986820474                ps.c:268  | purespice_connect              | Connected
[I] 100986820524             agent.c:103  | agent_connect                  | Connected to the spice guest agent
[I] 100986820543      channel_main.c:167  | onMessage_mainName             | Guest name: win11-ksh
[I] 100986820554      channel_main.c:183  | onMessage_mainUUID             | Guest UUID: 76cb2bf1-d22e-4a86-9900-f8a8d6f96506
[I] 100986828344                ps.c:644  | ps_connectChannel              | INPUTS channel connected
[I] 100986828393           channel.c:312  | onMessage_notify               | [notify] keyboard channel is insecure
[I] 100986828528               egl.c:267  | egl_initialize                 | Double buffering is off
[I] 100986828545              main.c:1116 | tryRenderer                    | Using Renderer: EGL
[W] 100986828813              idle.c:31   | waylandIdleInit                | zwp_idle_inhibit_manager_v1 not exported by compositor, will not be able to suppress idle states
[I] 100986851799                gl.c:58   | waylandGetEGLDisplay           | Using eglGetPlatformDisplay
[I] 100986874809               egl.c:828  | egl_renderStartup              | Single buffer mode
[I] 100986877336               egl.c:855  | egl_renderStartup              | EGL     : 1.5
[I] 100986877349               egl.c:856  | egl_renderStartup              | Vendor  : Intel
[I] 100986877358               egl.c:857  | egl_renderStartup              | Renderer: Mesa Intel(R) Graphics (ADL GT2)
[I] 100986877365               egl.c:858  | egl_renderStartup              | Version : OpenGL ES 3.2 Mesa 22.2.5-0ubuntu0.1~22.04.3
[I] 100986877374               egl.c:859  | egl_renderStartup              | EGL APIs: OpenGL OpenGL_ES 
[I] 100986877389               egl.c:930  | egl_renderStartup              | Debug messages disabled, enable with egl:debug=true
[I] 100986904561           eglutil.c:35   | swapWithDamageInit             | Using EGL_KHR_swap_buffers_with_damage
[I] 100986907261              main.c:1467 | lg_run                         | ================================================================================
[I] 100986907274              main.c:1468 | lg_run                         | The host application seems to not be running
[I] 100986907281              main.c:1469 | lg_run                         | Waiting for the host application to start...
[I] 100987349595              main.c:1474 | lg_run                         | ================================================================================
[I] 100987349620              main.c:1488 | lg_run                         | Check the host log in your guest at %ProgramData%\Looking Glass (host)\looking-glass-host.txt
[I] 100987349630              main.c:1489 | lg_run                         | Continuing to wait...
[I] 100987749506              main.c:1566 | lg_run                         | Guest Information:
[I] 100987749531              main.c:1567 | lg_run                         | Version  : B6
[I] 100987749543              main.c:1588 | lg_run                         | UUID     : 76cb2bf1-d22e-4a86-9900-f8a8d6f96506
[I] 100987749568              main.c:1597 | lg_run                         | CPU Model: 12th Gen Intel(R) Core(TM) i7-12700H
[I] 100987749580              main.c:1598 | lg_run                         | CPU      : 1 sockets, 5 cores, 10 threads
[I] 100987749596              main.c:1600 | lg_run                         | Using    : DXGI Direct3D 11
[I] 100987749609              main.c:1636 | lg_run                         | OS       : Windows
[I] 100987749622              main.c:1638 | lg_run                         | OS Name  : Windows 10 Pro (Build: 22621) 
[I] 100987749637              main.c:1660 | lg_run                         | Starting session
[I] 100987749754              main.c:548  | main_frameThread               | Using DMA buffer support
[I] 100987957269              main.c:698  | main_frameThread               | Format: FRAME_TYPE_BGRA 2560x1440 stride:2560 pitch:10240 rotation:0
[I] 100989525252              main.c:1678 | lg_run                         | Waiting for the host to restart...
[I] 100989533150                ps.c:644  | ps_connectChannel              | DISPLAY channel connected
[I] 100989538263                ps.c:644  | ps_connectChannel              | CURSOR channel connected
[I] 100775708052              main.c:1660 | lg_run                         | Starting session
[I] 100775708137              main.c:548  | main_frameThread               | Using DMA buffer support
[I] 100775742243              main.c:698  | main_frameThread               | Format: FRAME_TYPE_BGRA 2560x1440 stride:2560 pitch:10240 rotation:0
[I] 100775798210           channel.c:258  | channel_internal_disconnect    | DISPLAY channel disconnected
[I] 100775798244           channel.c:258  | channel_internal_disconnect    | CURSOR channel disconnected
[I] 100776916912              main.c:1678 | lg_run                         | Waiting for the host to restart...
[I] 100776925249                ps.c:644  | ps_connectChannel              | DISPLAY channel connected
[I] 100776926244              main.c:896  | spice_surfaceCreate            | Create SPICE surface: id: 0, size: 1024x768
[I] 100776934310                ps.c:644  | ps_connectChannel              | CURSOR channel connected
[I] 100777758291              main.c:1566 | lg_run                         | Guest Information:
[I] 100777758339              main.c:1567 | lg_run                         | Version  : B6
[I] 100777758371              main.c:1588 | lg_run                         | UUID     : 76cb2bf1-d22e-4a86-9900-f8a8d6f96506
[I] 100777758466              main.c:1597 | lg_run                         | CPU Model: 12th Gen Intel(R) Core(TM) i7-12700H
[I] 100777758503              main.c:1598 | lg_run                         | CPU      : 1 sockets, 5 cores, 10 threads
[I] 100777758551              main.c:1600 | lg_run                         | Using    : DXGI Direct3D 11
[I] 100777758598              main.c:1636 | lg_run                         | OS       : Windows
[I] 100777758642              main.c:1638 | lg_run                         | OS Name  : Windows 10 Pro (Build: 22621) 
[I] 100777758694              main.c:1660 | lg_run                         | Starting session
[I] 100777758981              main.c:548  | main_frameThread               | Using DMA buffer support
[I] 100779573255              main.c:1678 | lg_run                         | Waiting for the host to restart...
[I] 100779751182              main.c:1566 | lg_run                         | Guest I
The information:
[I] 100779751243              main.c:1567 | lg_run                         | Version  : B6
[I] 100779751298              main.c:1588 | lg_run                         | UUID     : 76cb2bf1-d22e-4a86-9900-f8a8d6f96506
[I] 100779751412              main.c:1597 | lg_run                         | CPU Model: 12th Gen Intel(R) Core(TM) i7-12700H
[I] 100779751487              main.c:1598 | lg_run                         | CPU      : 1 sockets, 5 cores, 10 threads
[I] 100779751558              main.c:1600 | lg_run                         | Using    : DXGI Direct3D 11
[I] 100779751624              main.c:1636 | lg_run                         | OS       : Windows
[I] 100779751693              main.c:1638 | lg_run                         | OS Name  : Windows 10 Pro (Build: 22621) 
[I] 100779751761              main.c:1660 | lg_run                         | Starting session
[I] 100779752067              main.c:548  | main_frameThread               | Using DMA buffer support
[I] 100780809742              main.c:698  | main_frameThread               | Format: FRAME_TYPE_BGRA 2560x1440 stride:2560 pitch:10240 rotation:0
[I] 100780840023           channel.c:258  | channel_internal_disconnect    | DISPLAY channel disconnected
[I] 100780840062           channel.c:258  | channel_internal_disconnect    | CURSOR channel disconnected
[I] 100795248941             main.c:1678 | lg_run                         | Waiting for the host to restart...
[I] 100795260206                ps.c:644  | ps_connectChannel              | DISPLAY channel connected
[I] 100795267930                ps.c:644  | ps_connectChannel              | CURSOR channel connected
[I] 100795271233              main.c:896  | spice_surfaceCreate            | Create SPICE surface: id: 0, size: 1024x768
[I] 100795773746              main.c:1566 | lg_run                         | Guest Information:
[I] 100795773794              main.c:1567 | lg_run                         | Version  : B6
[I] 100795773837              main.c:1588 | lg_run                         | UUID     : 76cb2bf1-d22e-4a86-9900-f8a8d6f96506
[I] 100795773958              main.c:1597 | lg_run                         | CPU Model: 12th Gen Intel(R) Core(TM) i7-12700H
[I] 100795774032              main.c:1598 | lg_run                         | CPU      : 1 sockets, 5 cores, 10 threads
[I] 100795774101              main.c:1600 | lg_run                         | Using    : DXGI Direct3D 11
[I] 100795774156              main.c:1636 | lg_run                         | OS       : Windows
[I] 100795774207              main.c:1638 | lg_run                         | OS Name  : Windows 10 Pro (Build: 22621) 
[I] 100795774260              main.c:1660 | lg_run                         | Starting session
[I] 100795774525              main.c:548  | main_frameThread               | Using DMA buffer support
[I] 100796025684              main.c:698  | main_frameThread               | Format: FRAME_TYPE_BGRA 2560x1440 stride:2560 pitch:10240 rotation:0
[I] 100796073618           channel.c:258  | channel_internal_disconnect    | DISPLAY channel disconnected
[I] 100796073816           channel.c:258  | channel_internal_disconnect    | CURSOR channel disconnected

Host Log

[I]     62471689               app.c:379  | captureStart                   | ==== [ Capture Start ] ====
[I]     62472150               app.c:312  | frameThread                    | Frame thread started
[I]     70799254               app.c:319  | frameThread                    | Frame thread stopped
[I]     70799892               app.c:385  | captureStop                    | ==== [ Capture Stop ] ====
[I]     70811537              dxgi.c:390  | dxgi_init                      | Device Name       : \\.\DISPLAY6
[I]     70811965              dxgi.c:391  | dxgi_init                      | Device Description: NVIDIA GeForce RTX 3070 Ti Laptop GPU
[I]     70812459              dxgi.c:392  | dxgi_init                      | Device Vendor ID  : 0x10de
[I]     70812821              dxgi.c:393  | dxgi_init                      | Device Device ID  : 0x24a0
[I]     70813169              dxgi.c:394  | dxgi_init                      | Device Video Mem  : 8043 MiB
[I]     70813555              dxgi.c:395  | dxgi_init                      | Device Sys Mem    : 0 MiB
[I]     70813929              dxgi.c:396  | dxgi_init                      | Shared Sys Mem    : 16373 MiB
[I]     70867545              dxgi.c:503  | dxgi_init                      | Feature Level     : 0xc100
[I]     70867952              dxgi.c:504  | dxgi_init                      | Capture Size      : 2560 x 1440
[I]     70868357              dxgi.c:505  | dxgi_init                      | AcquireLock       : enabled
[I]     70868736              dxgi.c:506  | dxgi_init                      | Debug mode        : disabled
[I]     70869589              dxgi.c:598  | dxgi_init                      | Source Format     : DXGI_FORMAT_B8G8R8A8_UNORM
[I]     70870103              dxgi.c:640  | dxgi_init                      | Request Size      : 2560 x 1440
[I]     70874836              dxgi.c:658  | dxgi_init                      | Output Size       : 2560 x 1440
[I]     70875250              dxgi.c:666  | dxgi_init                      | Copy backend      : Direct3D 11
[I]     70875649              dxgi.c:667  | dxgi_init                      | Damage-aware copy : enabled
[I]     70876056               app.c:379  | captureStart                   | ==== [ Capture Start ] ====
[I]     70876543               app.c:312  | frameThread                    | Frame thread started
[I]     71744801               app.c:319  | frameThread                    | Frame thread stopped
[I]     71745249               app.c:385  | captureStop                    | ==== [ Capture Stop ] ====
[I]     71761289              dxgi.c:390  | dxgi_init                      | Device Name       : \\.\DISPLAY6
[I]     71761702              dxgi.c:391  | dxgi_init                      | Device Description: NVIDIA GeForce RTX 3070 Ti Laptop GPU
[I]     71762179              dxgi.c:392  | dxgi_init                      | Device Vendor ID  : 0x10de
[I]     71762562              dxgi.c:393  | dxgi_init                      | Device Device ID  : 0x24a0
[I]     71762932              dxgi.c:394  | dxgi_init                      | Device Video Mem  : 8043 MiB
[I]     71763292              dxgi.c:395  | dxgi_init                      | Device Sys Mem    : 0 MiB
[I]     71763669              dxgi.c:396  | dxgi_init                      | Shared Sys Mem    : 16373 MiB
[I]     71814401              dxgi.c:503  | dxgi_init                      | Feature Level     : 0xc100
[I]     71814799              dxgi.c:504  | dxgi_init                      | Capture Size      : 2560 x 1440
[I]     71815182              dxgi.c:505  | dxgi_init                      | AcquireLock       : enabled
[I]     71815586              dxgi.c:506  | dxgi_init                      | Debug mode        : disabled
[I]     71816540              dxgi.c:598  | dxgi_init                      | Source Format     : DXGI_FORMAT_B8G8R8A8_UNORM
[I]     71817054              dxgi.c:640  | dxgi_init                      | Request Size      : 2560 x 1440
[I]     71819645              dxgi.c:658  | dxgi_init                      | Output Size       : 2560 x 1440
[I]     71820066              dxgi.c:666  | dxgi_init                      | Copy backend      : Direct3D 11
[I]     71820477              dxgi.c:667  | dxgi_init                      | Damage-aware copy : enabled
[I]     71820870               app.c:379  | captureStart                   | ==== [ Capture Start ] ====
[I]     71821362               app.c:312  | frameThread                    | Frame thread started

Sometimes I get a random client crash:

[E] 100989538946             crash.c:215  | crit_err_hdlr                  | ==== FATAL CRASH (B6) ====
[E] 100989538968             crash.c:216  | crit_err_hdlr                  | signal 11 (Falha de segmentação), address is 0x20
[E] 100989543724             crash.c:207  | printBacktrace                 | [trace]: (0) /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7ff714e37520]
[E] 100989543739             crash.c:207  | printBacktrace                 | [trace]: (1) looking-glass-client(egl_textureProcess+0x14) [0x556c4bf9c586]
[E] 100989543748             crash.c:207  | printBacktrace                 | [trace]: (2) looking-glass-client(egl_desktopRender+0x521) [0x556c4bf86cfb]
[E] 100989543757             crash.c:207  | printBacktrace                 | [trace]: (3) looking-glass-client(+0x193a06) [0x556c4bf83a06]
[I] 100989544075              main.c:896  | spice_surfaceCreate            | Create SPICE surface: id: 0, size: 1024x768
[E] 100989548660             crash.c:202  | printBacktrace                 | [trace]: (4) main.c:0 (renderThread)
[E] 100989548679             crash.c:207  | printBacktrace                 | [trace]: (5) looking-glass-client(+0x1c2b6c) [0x556c4bfb2b6c]
[E] 100989548689             crash.c:207  | printBacktrace                 | [trace]: (6) /lib/x86_64-linux-gnu/libc.so.6(+0x94b43) [0x7ff714e89b43]
[E] 100989548698             crash.c:207  | printBacktrace                 | [trace]: (7) /lib/x86_64-linux-gnu/libc.so.6(+0x126a00) [0x7ff714f1ba00]
racerxdl commented 11 months ago

So it looks its not related to LG. I did some tunning (since it was correlated to CPU/GPU usage) and skipped the VM from using core 0 (and its logic thread) and removed the RR scheduler:

(...)
  <cputune>
    <vcpupin vcpu="0" cpuset="4"/>
    <vcpupin vcpu="1" cpuset="5"/>
    <vcpupin vcpu="2" cpuset="6"/>
    <vcpupin vcpu="3" cpuset="7"/>
    <vcpupin vcpu="4" cpuset="8"/>
    <vcpupin vcpu="5" cpuset="9"/>
    <vcpupin vcpu="6" cpuset="10"/>
    <vcpupin vcpu="7" cpuset="11"/>
    <emulatorpin cpuset="0-1"/>
  </cputune>
  (...)

This seens to solved the issue, but not sure why (the host machine doesnt have anything running)

gnif commented 11 months ago

Your CPU only has 6 performance cores, you're over allocating your system. Efficiency cores are useless for KVM usage and should be treated like they do not exist when configuring and pinning.

As this is not a LG bug but rather a support issue I am closing this. Please join the LG discord if you need further assistance.

racerxdl commented 11 months ago

Just for completeness if someone reads this in the future:

Your CPU only has 6 performance cores, you're over allocating your system. Efficiency cores are useless for KVM usage and should be treated like they do not exist when configuring and pinning.

As this is not a LG bug but rather a support issue I am closing this. Please join the LG discord if you need further assistance.

It is 6 performance cores with 2 threads each, which I correctly mapped/pinned:

CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE    MAXMHZ   MINMHZ      MHZ
  0    0      0    0 0:0:0:0          sim 4600,0000 400,0000 2700.000
  1    0      0    0 0:0:0:0          sim 4600,0000 400,0000 2700.000
  2    0      0    1 4:4:1:0          sim 4600,0000 400,0000 3912.706
  3    0      0    1 4:4:1:0          sim 4600,0000 400,0000 2700.000
  4    0      0    2 8:8:2:0          sim 4700,0000 400,0000 2700.000
  5    0      0    2 8:8:2:0          sim 4700,0000 400,0000 2700.000
  6    0      0    3 12:12:3:0        sim 4700,0000 400,0000 2700.000
  7    0      0    3 12:12:3:0        sim 4700,0000 400,0000 2700.000
  8    0      0    4 16:16:4:0        sim 4600,0000 400,0000 3680.392
  9    0      0    4 16:16:4:0        sim 4600,0000 400,0000 1899.743
 10    0      0    5 20:20:5:0        sim 4600,0000 400,0000 2763.059
 11    0      0    5 20:20:5:0        sim 4600,0000 400,0000 2700.000

And in libvirt settings I was only passing 5 cores (which would give 10 threads).

  <cpu mode="host-passthrough" check="none" migratable="on">
    <topology sockets="1" dies="1" cores="5" threads="2"/>
  </cpu>

So I was not over allocating cores. I specifically only pinned at P-Cores.

Still, the issue has been solved by skipping the first machine core and removing the vcpusched.

Also sorry for putting a support ticket, it looked like a bug when it happened.

gnif commented 11 months ago

Read the minimum requirements for LG, you ARE over-allocating your system https://looking-glass.io/docs/B6/requirements/#minimum