Re: [patch] Disable TSC on SMP VMs

2011-08-16 Thread Mike Silbersack


The patch I referenced (and forgot to attach) is located here:

http://www.silby.com/tsc.c-no_vm_smp_tsc.patch

Thanks to those who pointed out my error to me. :)

Mike Silby Silbersack

On Tue, 16 Aug 2011, Mike Silbersack wrote:



Hi all,

Thanks to a lightning strike, I recently upgraded my ESXi 4.1 system from an 
old Athlon X2 to a shiny new Core i5-2500K.  I order to see how fast it was, 
I decided to run some buildworlds.  I tried my FreeBSD 9 based VM first, and 
was unhappy with what I saw - many mpt timeouts were reported, and the 
filesystem ended up requiring a lot of fscking.  My FreeBSD 8 based VM, on 
the other hand, was quite happy.


After some trial and error, I determined that using the TSC as a timecounter 
with the VM in SMP mode was the root cause.  If I switch the VM to one vCPU 
and run with the TSC, the buildworld runs fine.  If I leave it with two vCPUs 
and change the timecounter to ACPI, then it runs fine too.  Based on these 
results, I created the attached patch; it turns the priority of the TSC down 
to -100 if it determines that it is running inside a virtualized SMP 
environment.  (I did not do testing on KVM or qemu, but I am assuming that 
they probably do not have TSC emulation perfect either.)


I'd like to get this into 9.0 so that it works reliably for people who run it 
in a virtual environment on modern hardware.  If someone could code review 
the patch, I would greatly appreciate it.


Thanks,

Mike Silby Silbersack


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


[patch] Disable TSC on SMP VMs

2011-08-15 Thread Mike Silbersack


Hi all,

Thanks to a lightning strike, I recently upgraded my ESXi 4.1 system from 
an old Athlon X2 to a shiny new Core i5-2500K.  I order to see how fast it 
was, I decided to run some buildworlds.  I tried my FreeBSD 9 based VM 
first, and was unhappy with what I saw - many mpt timeouts were reported, 
and the filesystem ended up requiring a lot of fscking.  My FreeBSD 8 
based VM, on the other hand, was quite happy.


After some trial and error, I determined that using the TSC as a 
timecounter with the VM in SMP mode was the root cause.  If I switch the 
VM to one vCPU and run with the TSC, the buildworld runs fine.  If I leave 
it with two vCPUs and change the timecounter to ACPI, then it runs fine 
too.  Based on these results, I created the attached patch; it turns the 
priority of the TSC down to -100 if it determines that it is running 
inside a virtualized SMP environment.  (I did not do testing on KVM or 
qemu, but I am assuming that they probably do not have TSC emulation 
perfect either.)


I'd like to get this into 9.0 so that it works reliably for people who run 
it in a virtual environment on modern hardware.  If someone could code 
review the patch, I would greatly appreciate it.


Thanks,

Mike Silby Silbersack
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org