]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Report ARAT (APIC-Timer-always-running) feature for virtual CPU.
authormav <mav@FreeBSD.org>
Mon, 16 Mar 2015 11:57:03 +0000 (11:57 +0000)
committermav <mav@FreeBSD.org>
Mon, 16 Mar 2015 11:57:03 +0000 (11:57 +0000)
This makes FreeBSD guest to not avoid using LAPIC timer, preferring HPET
due to worries about non-existing for virtual CPUs deep sleep states.

Benchmarks of usleep(1) on guest and host show such extra latencies:
 - 51us for virtual HPET,
 - 22us for virtual LAPIC timer,
 - 22us for host HPET and
 - 3us for host LAPIC timer.

MFC after: 2 weeks

sys/amd64/vmm/x86.c

index c0c3e9c84ecb1b1098fd6986386848300dc1417d..c37d21c6e1bb9d453defa1ec53bfb07d70e1e2b5 100644 (file)
@@ -361,6 +361,12 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id,
                        break;
 
                case CPUID_0000_0006:
+                       regs[0] = CPUTPM1_ARAT;
+                       regs[1] = 0;
+                       regs[2] = 0;
+                       regs[3] = 0;
+                       break;
+
                case CPUID_0000_000A:
                        /*
                         * Handle the access, but report 0 for