qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: for some reason qemu.git fails with kvm?


From: Alexander Graf
Subject: Re: for some reason qemu.git fails with kvm?
Date: Mon, 17 Oct 2022 15:28:49 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.3


On 17.10.22 09:49, Andrew Randrianasulu wrote:


пн, 17 окт. 2022 г., 10:13 Thomas Huth <thuth@redhat.com>:
On 17/10/2022 08.57, Andrew Randrianasulu wrote:
>
>
> пн, 17 окт. 2022 г., 09:40 Thomas Huth <thuth@redhat.com
> <mailto:thuth@redhat.com>>:
>
>     On 15/10/2022 20.32, Andrew Randrianasulu wrote:
>      > qemu-system-i386 --version            QEMU emulator version 7.1.50
>      > (v7.1.0-987-g2ba341b369-dirty)
>      >
>      > error message
>      >
>      > qemu-system-i386 -display none -cdrom
>     /mnt/sdb1/SLAX-01-11-2020-test0.iso
>      > -enable-kvm                         qemu-system-i386: Could not install
>      > MSR_CORE_THREAD_COUNT handler: Success
>
>     Why are you using qemu-system-i386 ? Are you still running on a 32-bit host
>     system?
>
> yes 32 bit Slackware userspace , but on 64-bit kernel
>
>
> Linux slax 5.19.8-x64 #1 SMP PREEMPT_DYNAMIC Thu Sep 8 20:29:55 MSK 2022
> x86_64 AMD FX(tm)-4300 Quad-Core Processor AuthenticAMD GNU/Linux
>
> I reverted commit introducing this message and now kvm works ....

OK, so that's
https://gitlab.com/qemu-project/qemu/-/commit/37656470f67398dd1010 , right?


yes, only this one revert

Revert "KVM: x86: Implement MSR_CORE_THREAD_COUNT MSR"                                                                                       
   This reverts commit 37656470f67398dd10101d7d940d660053f60ff5.


Maybe Alex Graf can help here (added to the recipients list now). At least
there is a bug in the error reporting - the if-statement checks "r" but the
error_report() uses "ret" (which is wrong here).


Yes, the error print is definitely bogus, but that doesn't tell us quite yet why the ioctl fails.

The real underlying bug is that the layout of the struct changes based on whether it's compiled with 32 or 64 bits:

struct kvm_msr_filter_range {
        __u32 flags;
        __u32 nmsrs;
        __u32 base;
        __u8 *bitmap; /* <- 4 bytes for 32bit, 8 bytes for 64bit */
};

The struct size change results in a different struct size of

struct kvm_msr_filter {
        __u32 flags;
        struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
};

which is used as argument for the ioctl:

#define KVM_X86_SET_MSR_FILTER   _IOW(KVMIO,  0xc6, struct kvm_msr_filter)

Ioctls embed the size of the passed in struct in their number, so the 32bit ioctl will just trigger a "not found" error on 64bit systems.

This really is a kernel bug. It needs to handle the different structure size as part of its compat ioctl handler. I'll try to cook up a patch and CC you :).


Alex


reply via email to

[Prev in Thread] Current Thread [Next in Thread]