2. Takeshi Hasegawa
Interests
• Virtualization (Xen, and KVM)
• Storage
• Snowboarding J In this winter I had great days with my colleges
• Poor at coding. I’m not a software developer.
Work Experience
• April 2004- Systems Engineer at Software Research Associates, Inc.
• June 2011- Sales Engineer at Fusion-io
2
3. My works – books and magazines I participated
The Best-seller UNIX admin guide with catoon
Best-seller Xen book in Japan.
characters. More than 15k copies are sold
More than 6k copies are sold
Our sponsor, Gihyo Books!
I discussed the benfit of
Linux KVM.
And more…
3
4. Running articles on the Web
エンジニアなら知っておきたい仮想マシンのしくみ
(Now you understand how virtual machine works)
http://gihyo.jp/dev/serial/01/vm_work/ 4
5. BSD and myself
• Met FreeBSD 2.2.5 in 1997
• Open Source no matsuri 2000
o Met JKH and Warner Losh
• 2001~2006 This picture is still my treasure! J
o Contracted a dedicated Server with FreeBSD (4.x)
• 2010
o Used V-IMAGE for the network basic session of new-hire training
o Wrote virtio drivers for FreeBSD
• 2011-2012
o Wrote KVM PVClock for FreeBSD
IP Networking amiation DEMO
Powered by VIMAGE and HTML5
5
7. Why FreeBSD on Linux KVM?
More opportunities to run FreeBSD
• Many service providers are running KVM
o VPS (Virtual Private Server)
o Cloud – such as Sakura Internet (#sacloud)
• Linux KVM is surely handy
o The free-of-charge Type-1 hypervisor
o Guest OS doesn’t require device drivers for the latest hardware
Co-existence of FreeBSD allows leverage of its specialties
• ZFS, BSD Network stacks, jail/vimage, …
• and more!
7
8. However – FreeBSD on Linux KVM runs slow
The biggest Bottlenecks seen
in Virtual Machines is: The solution is:
• I/O Bottlenecks • I/O Para-virtualization
– Disk I/O – Disk para-virtualization
– Network I/O – Network para-virtualization
seq$write$MB/s$
90"
80"
70"
60"
50"
40" seq"write"MB/s"
30"
20"
10"
0"
Na.ve" FreeBSD"VM"+"SCSI"Emu"
Especially FreeBSD is known as
“low-performance guest ” on Linux KVM.
8
9. virtio – I/O interface for virtualized guests
• Ring-Buffer Interface definition
between Guest and Host
Guest
• Independent to hypervisors
– lguest
– Linux KVM
virtio virtio virtio virtio
– VirtualBox Ballon Block Block Net
– BHyVe
– Xen
last summer, personally I was also working the
virtio support on Xen.... virtio virtio virtio virtio
Ballon Block Block Net
PCI Bus
• Works efficiently Host
– No overhead of H/W emulation
– Less Intel VT/AMD-V world
changes
– Less context switches Hardware
9
10. virtio drivers for FreeBSD
• I wrote virtio drivers for FreeBSD – Fall of 2010
o Rusty Russel, Father of virtio, made a presentation at LinuxCon 2010
“virtio-net guest driver can be implemented by less than 1,000 lines”
o I actually tried on FreeBSD 8.1-R. It took more than 1,000 lines! J
o Finally, I ported:
• virtio interface
• virtio-net (network)
• virtio-blk (block)
• virtio driver for FreeBSD merged to -CURRENT – Winter of 2011
o Congrats!
o Please note - the merged one is a DIFFERENT work from mine!
10
11. virtio-net increases network performance
• 4.7x against rtl8139, 1.3x against e1000 bandwidth improvement!
1.3x
4.7x
Test Environment: HP ML115G1, 1.8G 1P2C, PC6400 DRAM (too poor!)
11
Fedora 14 as the Host, and running FreeBSD 8.1-RELEASE as the Guest(2vCPUs)
21. virtio-blk can make FreeBSD Guests faster?
No!!
Facts
• I/O latency from virtual machine is more than twice of native I/O
• The performance issue is seen in block layer
• virtio-blk surely improved latency distribution (compared to SCSI
emu), but it is still ignorable impact
Then… what is the bottleneck in the FreeBSD Guests??
o Interrupt delivery?
o Queueing I/Os to the block device?
More deep investigation should be done J
21
22. My another work – KVM Para-virtualized Clock
Motivation
• I wanted more reliable timer needed to investigate performace issue
of FreeBSD on Linux KVM
What’s KVM PVClock?
• clocksource which can be found in Linux KVM environment
o “Timecounter” source in FreeBSD world
o More accurate VM time-keeping can be expected
• Inspired by Xen
o Shadows TSC counter of the host processor, and calendar of the host.
o The replica of timer virtualization in Xen
o FreeBSD already has Xen clock support
22
23. The result of the early implementaiton
while true; do date; sleep 1; done
on FreeBSD Guest
The time-slip is less than one second
- The two OSes should be in synchronized
theoretically
- No any time-synchronization
method required
- tested for 120hours (5 days)
while true; do date; sleep 1; done
on Linux KVM Host
23
24. Conclusion
• Linux KVM will bring more opportunities to run FreeBSD
• Linux KVM uses virtio for I/O para-virtualizaton
• FreeBSD block layer does not fit well with Linux KVM
• Porting Linux KVM PVClock for FreeBSD
• Any comments? Questions? Suggestions?
• please say hello to me after the session.
24