Hard reset when running Windows in KVM/QEMU

Couple of months before, I had few occasions where when I have my Windows 10 VM running, my whole system experienced a hard reset. I checked my PSU, my VGA, every cable, but none seem to be the problem.
Meanwhile I replaced my 6900XT with a RTX4080, and I did a full re-install of my Linux and Windows VM. Problem solved.

Until today…

So for months, everything was working fine, no problems whatsoever.

Today, I made some changes, trying to enable Hyper-V inside Windows so I can play PUBG (my favorite game, but started kicking players with VMs few months ago).

After I finished my changes, I was checking PUBG if it works (it does), and other games if their performance is affected by Hyper-V (some are running in 15-20% of frames without Hyper-V)

While testing, and after about 12 minutes of play, I experienced a hard reset… Since I made all my changes in few minutes and the problem started immediately, I am 100% sure that something is causing it and it is not hardware related.

VM XML before (without issues):

  <features>
    <acpi/>
    <apic/>
    <hyperv mode="passthrough">
      <relaxed state="on"/>
      <vapic state="on"/>
      <spinlocks state="on" retries="8191"/>
      <vpindex state="on"/>
      <synic state="on"/>
      <stimer state="on">
        <direct state="on"/>
      </stimer>
      <reset state="on"/>
      <vendor_id state="on" value="OriginalAMD"/>
      <frequencies state="on"/>
      <reenlightenment state="off"/>
      <tlbflush state="on"/>
      <ipi state="on"/>
      <evmcs state="off"/>
      <avic state="on"/>
    </hyperv>
    <kvm>
      <hidden state="on"/>
    </kvm>
    <vmport state="off"/>
  </features>
  <cpu mode="host-passthrough" check="none" migratable="off">
    <topology sockets="1" dies="1" cores="8" threads="2"/>
    <cache mode="passthrough"/>
    <feature policy="disable" name="x2apic"/>
    <feature policy="require" name="topoext"/>
    <feature policy="require" name="svm"/>
    <feature policy="require" name="hypervisor"/>
    <feature policy="require" name="amd-stibp"/>
  </cpu>
  <clock offset="timezone" timezone="Europe/Dublin">
    <timer name="rtc" present="no" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="discard"/>
    <timer name="hpet" present="no"/>
    <timer name="kvmclock" present="no"/>
    <timer name="hypervclock" present="yes"/>
    <timer name="tsc" present="yes" mode="native"/>
  </clock>

VM XML now (with hard reset)

  <features>
    <acpi/>
    <apic/>
    <hyperv mode="passthrough">
      <relaxed state="on"/>
      <vapic state="on"/>
      <vpindex state="on"/>
      <runtime state="on"/>
      <synic state="on"/>
      <stimer state="on"/>
      <reset state="on"/>
      <vendor_id state="on" value="OriginalAMD"/>
      <frequencies state="on"/>
    </hyperv>
    <kvm>
      <hidden state="on"/>
    </kvm>
    <vmport state="off"/>
  </features>
  <cpu mode="host-passthrough" check="none" migratable="off">
    <topology sockets="1" dies="1" cores="8" threads="2"/>
    <cache mode="passthrough"/>
    <feature policy="disable" name="x2apic"/>
    <feature policy="require" name="topoext"/>
    <feature policy="disable" name="svm"/>
    <feature policy="require" name="hypervisor"/>
    <feature policy="require" name="amd-stibp"/>
  </cpu>
  <clock offset="timezone" timezone="Europe/Dublin">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>

Also, I added below line to “/etc/modprobe.d/kvm.conf”:

options kvm_amd nested=1

After reverting all the changes, it has been running for 4 hours without any issue. Re-applied these changes and had hard reset in less than 20 minutes, while sitting on desktop (no load, no high temps)

Most of the parameters in these three sections are copied from other users/tutorials and not sure how they affect the actual VM performance. The ones I am 100% sure affecting Hyper-V service are the nested option and svm/hypervisor from the CPU section in XML.

Anybody has an idea what might causing the issue?

I removed “options kvm_amd nested=1” and still works (how?) but I am getting hard resets again.

I uninstalled Hyper-V from Windows, and looks ok. I used it yesterday for 2-3 hours without an incident.

So, does anybody know why it hard-resets when using Hyper-V with AMD AM5 ?

I’m running in to this exact same issue under AM5. In my case I need hyper-v on the guest so I cant just disable it.

I had this issue without Hyper-V running… I am running on Fedora now, and hasn’t happen for over a month. Not sure what was causing it, as I did a BIOS update at around the same time.

AH I’m using Arch, it happened once when first installing hyperv and only happens when starting a hyper-v vm. Journalctl doesn’t seem to grab what causes the crash. I’ll try a bios update just for giggles

When I was looking around for the cause, most people leaned towards bad AMD iGPU driver. At some point in my log, there is an obvious error with it.
Look at this thread.

I’ll look into it but I have my igpu disabled via bios already