{"id":118,"date":"2011-10-22T11:37:11","date_gmt":"2011-10-22T10:37:11","guid":{"rendered":"http:\/\/www.simweb.ch\/blog\/?p=118"},"modified":"2012-02-16T14:33:01","modified_gmt":"2012-02-16T13:33:01","slug":"state-of-linux-on-hyper-v","status":"publish","type":"post","link":"https:\/\/www.simweb.ch\/blog\/2011\/10\/state-of-linux-on-hyper-v\/","title":{"rendered":"State of Linux on Hyper-V"},"content":{"rendered":"<p>Update 02.2012 - I got some feedback on this blog post and updated some of the content - but since lot's of things have changed since then regard this as a snapshot of the back then in Autumn 2011.<\/p>\n<p>I'm still interested in the progress the Hyper-V modules from Microsoft are doing in the mainline Linux kernel. I have continued to test them with each new kernel release\u00a0 as well as following what patches go in. Consider this as a outside reflection at how the drivers evolve from a sysadmin's perspective. Here are some of the current experiences I made and notable modifications that went upstream I think are worth being mentioned. Due to kernel.org being absent for a couple of weeks, lots of proposed updates have only been merged into the staging tree after kernel.org came back online.<\/p>\n<h4>Overall stability<\/h4>\n<p>Starting 2.6.39 the state of the drivers have largely improved from being really annoyingly unstable to 'usable' - I don't warrant their stability for or critical use -\u00a0 at least I've not seen a single crash on my small webserver running Ubuntu lucid due to these module with custom-built kernels since then. The only notable exception were the modules worked stable\u00a0 were the modules in LIC 2.1 provided by Microsoft for RHEL5 and SLES10.<\/p>\n<p>Since then Microsoft has published LIC 3.1 adding official support for RHEL 6 and CentOS 6 which seem to be based on the codebase in mainline 2.6.39 \/ 3.0\u00a0(when comparing the code) so MS themselves believe the stability is also acceptable for them to publish supported and pre-packaged binaries.<\/p>\n<h4>Goodbye \/dev\/hdX, wellcome \/dev\/sdX and &gt; 2TB\u00a0 LUN support<\/h4>\n<p>If you looked at your Linux virtual machine running on Hyper-V and were a distribution newer than RHEL5, SLES10 or a Kernel older than 2.6.21, you may have realized the following uncommon behaviour for Hyper-V VMs with hv modules: The IDE drives still showed up as \/dev\/hdX instead of \/dev\/sdX like almost everywhere else. Additionally - when in paravirtualized mode - the IDE controller was handled by 'hv_blkvsc' and the paravirtualized-only SCSI controller by 'hv_storvsc'. This willl also remain with the release of Linux 3.1.<\/p>\n<p>But with the merge-windows for 3.2 you can expect to see a bunch of changes already present in staging-next that (after a bunch of other patches) will move the <a title=\"Staging: hv: storvsc: Handle IDE devices using the storvsc driver\" href=\"http:\/\/git.kernel.org\/?p=linux\/kernel\/git\/gregkh\/staging.git;a=commit;h=21e37742361fe408d534c004b6e39717cb6b5999\">handling of IDE drives to hv_storvsc<\/a> and <a title=\"Staging: hv: blkvsc: Get rid of blkvsc_drv.c as this code is not used\" href=\"http:\/\/git.kernel.org\/?p=linux\/kernel\/git\/gregkh\/staging.git;a=commit;h=b38cc43432d7b7b0a4dc0a13d261a85944fc7c65\">drops hv_blkvsc<\/a> completely. Meanwhile a patch addresses the 2TB limitation for those who need it.<\/p>\n<p>Recently before writing this blog\u00a0 entry I have built a 3.1-rc4 kernel out of the staging-next branch and I can confirm the results for storvsc:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">sim@sojus-1:~$ uname -a\r\nLinux sojus-1 3.1.0-rc4-stagingnext+ #3 SMP Thu Oct 20 14:44:55 CEST 2011 x86_64 GNU\/Linux\r\n\r\nsim@sojus-1:~$ lsmod\r\nModule                  Size  Used by\r\nxt_multiport            1925  1\r\niptable_filter          1578  1\r\nip_tables              17884  1 iptable_filter\r\nx_tables               24072  3 xt_multiport,iptable_filter,ip_tables\r\nsit                     9942  0\r\ntunnel4                 2925  1 sit\r\njoydev                 10705  0\r\nhv_mouse                4193  0\r\nhid                    87780  1 hv_mouse\r\npsmouse                61215  0\r\nserio_raw               4720  0\r\nhv_timesource           1111  0 [permanent]\r\ni2c_piix4               8879  0\r\nfloppy                 63708  0\r\nhv_storvsc              9152  3\r\nhv_utils                5405  0\r\nhv_netvsc              15931  0\r\nhv_vmbus               27112  4 hv_mouse,hv_storvsc,hv_utils,hv_netvsc,[permanent]<\/pre>\n<p>As you can see: No more hv_blkvsc. But\u00a0 I consider hv_storvsc's behaviour of attaching IDE drives to be a bit weird: Normally the first disk on Linux would be named sda and partitions mounted as \/dev\/sdaX. This VM has 2 IDE and 1 SCSI disk attached so I'd guess we should have sda to sdc, right?<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">sim@sojus-1:~$ sudo fdisk -l\r\n\r\nDisk \/dev\/sda: 1073 MB, 1073479680 bytes\r\n[...]\r\n\r\nDisk \/dev\/sdb: 10.7 GB, 10737377280 bytes\r\n[...]\r\n\r\nDisk \/dev\/sdc: 1073 MB, 1073741824 bytes\r\n[...]\r\n\r\nDisk \/dev\/sdd: 10.7 GB, 10737418240 bytes\r\n[...]\r\n\r\nDisk \/dev\/sde: 48.3 GB, 48318382080 bytes<\/pre>\n<p>The 2 IDE disks appear twice while the SCSI-attached disks appears once. Since I use LVM on all disks here\u00a0 except for \/boot,\u00a0 mount shows \/dev\/mapper for the root partition etc. but here is how\u00a0 \/boot gets mounted:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">administrator@sojus-1:~$ mount\r\n[...]\r\n\/dev\/sdc1 on \/boot type ext4 (rw)<\/pre>\n<p>Interesting ... albeit I\u00a0 haven't found a negative impact but still I think this has to be handled differently before storvsc leaves the staging directory.<\/p>\n<p><em>Update: It seems one can ommit this having only \/boot and GRUB on the bootable IDE disk, <a href=\"http:\/\/vvm.blog.tut.by\/2011\/09\/06\/howto-install-archlinux-on-hyper-v\/\">thanks Victor <\/a>- he has more details how to omit this.<\/em><br \/>\n<em>Actually it's not a technical problem yet. MS handles this via modprobe rules in their Linux ICs for sanity.<br \/>\n<\/em><\/p>\n<h4>Mouse support (not yet tested)<\/h4>\n<p>As some might remember the <a title=\"Homepage of project satori\" href=\"http:\/\/xen.org\/products\/satori.html\">satori project<\/a>\u00a0 at Xen provided a semi-open inputvsc module that allowed i.e. RHEL5 to have mouse support as a Hyper-V guest but it was never part of the Microsoft-provided LIC 2.1, 3.1 nor in mainline linux kernel. Now original the Citrix-owned code was renamed to hv_mouse, expanded and merged into staging fully open source and expected to be functional with 3.2. As I don't use Linux with X on servers, didn't really care about that, nonetheless it's greatto have fully open source driver for this component now. If you have tested hv_mouse I'd be happy to know about!<\/p>\n<p><em>Update: I have since then tested the dirvers, 3.2 seems to work well but 3.3 contains some memory leak bugfixes others have <a href=\"http:\/\/vvm.blog.tut.by\/category\/hyper-v\/\">had their issues<\/a> with them in 3.0\/3.1. If you dont have X.org on a Server VM, you can quietly ignore this module anyway. - I'll let\u00a0 Puppet\u00a0 do the work or SSH to the box first \ud83d\ude09<\/em><\/p>\n<p><em>Starting 3.3 the driver has been renamed once as hid_hyperv and was moved out ot staging.<\/em><\/p>\n<h4>Partly leaving the staging area<\/h4>\n<p>Greg Kroah-Hartmann has put a <a title=\"Staging: hv: move hyperv code out of staging directory\" href=\"http:\/\/git.kernel.org\/?p=linux\/kernel\/git\/gregkh\/staging.git;a=commit;h=46a971913611a23478283931460a95be962ce329\">patch in staging-next<\/a> that moves the VMBus part out of drivers\/staging\/hv\u00a0 - read his commit message. It now means\u00a0 the VMBus drivers - the paravirtualized bus of Hyper-V where paravirt devices connect to the hypervisor backend\u00a0 - are considered enough cleaned up to be considered stable.<\/p>\n<p><em>Update: With Linux 3.3 only storvsc will be \/ is left in staging area. This means that the kernel hackers think that the overall quality of the kernel modules are believed to be good enough for daily use. For sure there are possible bugs and will be fixed hopefully as well.<\/em><\/p>\n<h4>Missing features<\/h4>\n<p>While I don't have an urgent need for dynamic nemory on Linux guests rather than equal performance\u00a0 to Windows guests this feature available to Windows guests starting Hyper-V 2008 R2 SP1 is still missing for Linux guests. I hope Microsoft considers making Linux a first class citizen on Hyper-V - not just good second class. - That said: BSD and other UNIX-based OS'es still lack the support Linux is yet having on Hyper-V.<\/p>\n<h4>Update <em>(shortly after this blog post was made)<\/em><\/h4>\n<p>I have been keen enough to point K.Y on this article (he's actually the guy doing the most of the work on this code at Microsoft) \u00a0as he has once gave positive answer to an earlier feedback already. Let me write down what he answered me when asking about the current IDE behaviour:<\/p>\n<p><cite title=\"K.Y wrote\">We are committed to supporting Linux as a first class guest\u00a0on Hyper-V.\u00a0What you are currently\u00a0 seeing is what is to be expected:\u00a0What is happening is that the IDE disks are being discovered by both the native IDE driver in Linux\u00a0(ata_piix) as well as the storvsc driver. The way we deal with this problem on RHEL6\/6.1 and SLES is to have\u00a0a modprobe rule that ensures that hyperv driver loads first and if the load succeeds, the ata_piix driver will\u00a0not be loaded. This will result in the IDE disks being discovered only once. [...]<\/cite><\/p>\n<p><cite>Mouse driver is now functional and fully open sourced; I got it working a few weeks ago.<\/cite><\/p>\n<p>Later on:<\/p>\n<p><span style=\"font-size: small;\"><cite>The solution of using the modprobe rules is only the current solution. We are exploring other options to deal with this problem<\/cite><\/span><\/p>\n<p><cite title=\"K.Y wrote\"><\/cite>This sounds great!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 02.2012 &#8211; I got some feedback on this blog post and updated some of the content &#8211; but since lot&#8217;s of things have changed since then regard this as a snapshot of the back then in Autumn 2011. I&#8217;m still interested in the progress the Hyper-V modules from Microsoft are doing in the mainline &#8230; <a class=\"moretag\" href=\"https:\/\/www.simweb.ch\/blog\/2011\/10\/state-of-linux-on-hyper-v\/\">more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[16],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-hyper-v-linux-kernel"],"_links":{"self":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":0,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simweb.ch\/blog\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}