Hello Mike, >From #openbsd, I gather that you are working on the timer issue (time falling >behind) that linux guests have in vmm.
I run linux guests in vmm and I am using a linux module just to sync the timer every 5 seconds from the host. I presume that there might be a better solution than that. Just want to check if you might have any test code or material that can help me work around the issue. I tried this and the timer in the linux guest is kvm-clock and it avoids the timer issue. But, the linux guests hang once in a while. I presume that it might be due to some kvm instruction unsupported by vmm. I got this idea from https://marc.info/?l=openbsd-tech&m=155903945227814&w=2 Index: sys/arch/amd64/amd64/vmm.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/amd64/vmm.c,v retrieving revision 1.273 diff -u -p -u -r1.273 vmm.c --- sys/arch/amd64/amd64/vmm.c 19 Apr 2020 19:29:52 -0000 1.273 +++ sys/arch/amd64/amd64/vmm.c 20 May 2020 17:28:12 -0000 @@ -242,6 +242,7 @@ extern uint64_t tsc_frequency; extern int tsc_is_invariant; const char *vmm_hv_signature = VMM_HV_SIGNATURE; +const char *kvm_hv_signature = KVM_HV_SIGNATURE; const struct kmem_pa_mode vmm_kp_contig = { .kp_constraint = &no_constraint, @@ -6830,7 +6831,14 @@ vmm_handle_cpuid(struct vcpu *vcpu) *rcx = *((uint32_t *)&vmm_hv_signature[4]); *rdx = *((uint32_t *)&vmm_hv_signature[8]); break; + case 0x40000100: /* KVM CPUID signature */ + *rax = 0; + *rbx = *((uint32_t *)&kvm_hv_signature[0]); + *rcx = *((uint32_t *)&kvm_hv_signature[4]); + *rdx = *((uint32_t *)&kvm_hv_signature[8]); + break; case 0x40000001: /* KVM hypervisor features */ + case 0x40000101: *rax = (1 << KVM_FEATURE_CLOCKSOURCE2) | (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT); *rbx = 0; Index: sys/arch/amd64/include/vmmvar.h =================================================================== RCS file: /cvs/src/sys/arch/amd64/include/vmmvar.h,v retrieving revision 1.70 diff -u -p -u -r1.70 vmmvar.h --- sys/arch/amd64/include/vmmvar.h 8 Apr 2020 07:39:48 -0000 1.70 +++ sys/arch/amd64/include/vmmvar.h 20 May 2020 17:28:12 -0000 @@ -22,6 +22,7 @@ #define _MACHINE_VMMVAR_H_ #define VMM_HV_SIGNATURE "OpenBSDVMM58" +#define KVM_HV_SIGNATURE "KVMKVMKVM\0\0\0" #define VMM_MAX_MEM_RANGES 16 #define VMM_MAX_DISKS_PER_VM 4 Thanks
