Re: [PATCH kvmtool] x86: Fixed Unable to execute init process since glibc version 2.33

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

 



Hi,

Hi, I was unable to apply the patch as is because your base is missing
commit 20b93be583f6 ("x86: Set the correct APIC ID"). Changing it is so it
applies was trivial though.

I tested the patch with a VM image using glibc 2.36 and Linux v5.17-rc7,
the glibc error went away and I was able to boot to userspace; as an added
bonus, this kernel message went away:

[    0.000000] CPU: vendor_id 'LKVMLKVMLKVM' unknown, using generic init.
[    0.000000] CPU: Your system may be unstable.

But this warning is new:

[    0.000000] [Firmware Bug]: TSC doesn't count with P0 frequency!

I don't know what causes it (kvmtool's bios implementation is not feature
complete with regards to my CPU features?), and doesn't look like it's
something introduced by this patch, so as far as I'm concerned the patch is
working as intended:

Tested-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>

Thanks,
Alex

On Sat, Feb 26, 2022 at 02:00:48PM +0800, Dongli Si wrote:
> From: Dongli Si <sidongli1997@xxxxxxxxx>
> 
> glibc detected invalid CPU Vendor name will cause an error:
> 
> [    0.450127] Run /sbin/init as init process
> /lib64/libc.so.6: CPU ISA level is lower than required
> [    0.451931] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
> [    0.452117] CPU: 0 PID: 1 Comm: init Not tainted 5.17.0-rc1 #72
> 
> Signed-off-by: Dongli Si <sidongli1997@xxxxxxxxx>
> ---
>  x86/cpuid.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/x86/cpuid.c b/x86/cpuid.c
> index c3b67d9..d58a027 100644
> --- a/x86/cpuid.c
> +++ b/x86/cpuid.c
> @@ -2,6 +2,7 @@
>  
>  #include "kvm/kvm.h"
>  #include "kvm/util.h"
> +#include "kvm/cpufeature.h"
>  
>  #include <sys/ioctl.h>
>  #include <stdlib.h>
> @@ -10,7 +11,7 @@
>  
>  static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid)
>  {
> -	unsigned int signature[3];
> +	struct cpuid_regs regs;
>  	unsigned int i;
>  
>  	/*
> @@ -22,10 +23,13 @@ static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid)
>  		switch (entry->function) {
>  		case 0:
>  			/* Vendor name */
> -			memcpy(signature, "LKVMLKVMLKVM", 12);
> -			entry->ebx = signature[0];
> -			entry->ecx = signature[1];
> -			entry->edx = signature[2];
> +			regs = (struct cpuid_regs) {
> +				.eax		= 0x00,
> +			};
> +			host_cpuid(&regs);
> +			entry->ebx = regs.ebx;
> +			entry->ecx = regs.ecx;
> +			entry->edx = regs.edx;
>  			break;
>  		case 1:
>  			/* Set X86_FEATURE_HYPERVISOR */
> -- 
> 2.32.0
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux