Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] libvirt: Win10 cpu->kvm_msr_buf->nmsrs failed.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3337
Location: de

PostPosted: Sat Apr 13, 2024 2:11 pm    Post subject: libvirt: Win10 cpu->kvm_msr_buf->nmsrs failed. Reply with quote

Updated today to Kernel gentoo-sources-6.8.5-r1:

I'm using libvirt for managing my virtual machines.

Starting Win 10 failes with error message:

Code:

Fehler beim Starten der Domain: Interner Fehler: QEMU unexpectedly closed the monitor (vm='Win10'): 2024-04-13T14:08:10.681706Z qemu-system-x86_64: error: failed to set MSR 0x40000021 to 0x0
qemu-system-x86_64: ../target/i386/kvm/kvm.c:3301: kvm_buf_set_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1402, in startup
    self._backend.create()
  File "/usr/lib/python3.11/site-packages/libvirt.py", line 1373, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: Interner Fehler: QEMU unexpectedly closed the monitor (vm='Win10'): 2024-04-13T14:08:10.681706Z qemu-system-x86_64: error: failed to set MSR 0x40000021 to 0x0
qemu-system-x86_64: ../target/i386/kvm/kvm.c:3301: kvm_buf_set_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.


The VM starts without any problems with Kernel 6.7.0.

Any ideas?


Last edited by musv on Sat Apr 13, 2024 2:35 pm; edited 2 times in total
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3337
Location: de

PostPosted: Sat Apr 13, 2024 2:34 pm    Post subject: Reply with quote

Got it, but don't understand it fully:

config:
Support for Microsoft Hyper-V emulation (KVM_HYPERV)

CONFIG_KVM_HYPERV:

Provides KVM support for emulating Microsoft Hyper-V. This allows KVM
to expose a subset of the paravirtualized interfaces defined in the
Hyper-V Hypervisor Top-Level Functional Specification (TLFS):
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
These interfaces are required for the correct and performant functioning
of Windows and Hyper-V guests on KVM.

If unsure, say "Y".

Symbol: KVM_HYPERV [=y]
Type : bool
Defined at arch/x86/kvm/Kconfig:142
Prompt: Support for Microsoft Hyper-V emulation
Depends on: VIRTUALIZATION [=y] && KVM [=y]
Location:
-> Virtualization (VIRTUALIZATION [=y])
-> Kernel-based Virtual Machine (KVM) support (KVM [=y])
-> Support for Microsoft Hyper-V emulation (KVM_HYPERV [=y])


CONFIG_KVM_HYPERV has to be enabled. although I don't use any HyperV. Maybe Windows defines itself as HyperV if it's installed as a KVM VM.
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3337
Location: de

PostPosted: Sat Apr 13, 2024 3:00 pm    Post subject: Reply with quote

That's not all. Additionally to the KVM_HYPERV setting the following setting did the trick:

Code:
CONFIG_PROCESSOR_SELECT is not set


I'm using an AMD Ryzen processor. So I thought it would be ok to disable the support for Intel, Hygon, Centaur and Zhaoxin processors.

After that the error occured too.
Back to top
View user's profile Send private message
nkichukov
n00b
n00b


Joined: 16 Oct 2012
Posts: 15
Location: Amstelveen, Netherlands

PostPosted: Wed May 08, 2024 7:55 am    Post subject: Reply with quote

I just encountered exactly the same problem. Trying to start a windows virtual machine failed.

I've managed to work-around the problem by disabling MSRS via kvm parameter change in /proc:

echo 1 > /sys/module/kvm/parameters/ignore_msrs

I also run AMD processor and I have no hyperv or processor_select option, thus all intel related code is dropped.

I do not believe I've upgraded libvirt or qemu, so this is purely a kernel upgrade issue. I think I will just add another grub cmdline entry to GRUB_CMDLINE_LINUX_DEFAULT to make this persistent and be done with it. But I also wonder what's changed to cause this?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum