Xen为什么一定要进入内核 —— [简译] KVM is Linux, Xen is not
Xen為什么一定要進入內核
這個問題我問了一位名為笑遍世界的博主,這位博主在寫一本名為《KVM虛擬化原理與實踐》的書,在他的博客上連載了書里面的部分章節,目前我在網上能找到最好的中文資料就是這個連載了。
博客地址:http://smilejay.com/kvm_theory_practice/
我:
有幾個問題想請問博主,還望解疑: Xen為什么一定要進入內核呢,進入內核意味著它也要借助linux內核對硬件資源管理和調度嗎? 博主能不能簡單說點對KVM和Xen的看法? 謝謝
master :
對的,應該是你說的那樣的,不過注意xen hypervisor本身幾乎是永遠不能進入Linux內核的,只是說和Xen配合使用的dom0 kernel已經可以完全直接使用Linux kernel upstream了(意思是Linux內核這邊的為了xen進行的相關改動已經全部進入到Linux原生內核中了)。我工作和學習對KVM、Xen都是涉及到的,其實很早就準備寫一篇KVM/Xen的看法的,等等吧~~ 我的大致觀點與這篇文章有點類似(我不敢自稱專家哈):
http://chucknology.com/2012/04/15/kvm-is-still-linux-xen-is-still-not/
KVM is still Linux. Xen is still not.
Posted on April 15, 2012by cdubuque
http://chucknology.com/2012/04/15/kvm-is-still-linux-xen-is-still-not/
我希望之前寫的KVM is Linux, Xen is Not ?這篇文章能幫助大家更好的理解KVM與Xen之間的區別。
It’s been gratifying to see lots of folks finding my site a couple of months after my first post, reading the article “KVM is Linux, Xen is Not“, and retweeting it to a broader audience. I seem to have hit a nerve, and I hope I have provided some value in helping folks understand the differences between KVM and Xen.
我是Red Hat公司的員工,工作也是與KVM相關。當然是KVM技術的支持者。
If you’ve read in the last couple of weeks, you probably noticed that posting has attracted some less than positive comments from Xen adherents.
All cards on the table: I am a KVM adherent. I work for Red Hat, and I work on a KVM-based product. Moreover, I personally believe that KVM is the best technology going forward for open source virtualization.
Linux 3.0. 內核中,加入了部分Xen代碼,而我那篇文章主要是為了談談在Xen的部分代碼進入linux3.0之前與之后,Xen與KVM的一些架構上的區別。
My goal in the post was to point out the architectural differences between Xen and KVM, before and after the inclusion of some Xen code beginning with Linux 3.0. And yes, to poke some fun at Citrix and Oracle.
Based on the recent comments I’ve gotten, I thought it was worth writing a short post before going on to other topics.
I was tempted to do some editing to the original post (a footnote here, a qualification there), but aside from fixing a couple of incorrect links, I decided to let it stand as originally written and posted for better or worse.
I do apologize for initially pointing to the incorrect article as the attribution link for Simon Crosby’s quote. I have made that correction in the post.
But unless there are technical inaccuracies, I am not making any further edits. You the reader can decide if I was fair, pushing things to make a point, or way off base and need to apologize for muckraking.
Let’s step back in time a bit…
那篇大致在 2011/07 寫完,是為了說清楚關于Xen進入Linux內核的真正意義的問題。
Now, the post is a bit out of its historical context. After all I wrote most of it in July of 2011 for a different forum to address a real issue–the confusion about what Xen being “accepted” into Linux actually means.
Confusion still reigns
額。。關于Xen進入內核到底意味著什么,很多人仍然有困惑。
Oracle和Citrix的一年前的一篇聲明讓很多人產生一種印象,就是Xen也進入了Linux內核,這使得KVM這種基于linux內核的技術,失去了它作為Linux內核一部分而帶來的相對優勢。
正是為了澄清這一個誤解,我才寫了KVM is Linux, Xen is Not 這篇文章。
Almost a year later, people still ask what that announcement from Oracle and Citrix means. And still the overwhelming impression that people come away with from reading the coverage and talking to sales people is that Xen is now integrated into Linux, and that KVM’s advantages in that regard are moot.
Addressing that confusion was the ultimate intent of the post.
Was it a bit cheeky to call out the Oracle and Citrix at the top of the article? Sure. Guilty as charged. It helped get the post out to a broader audience than I expected for what at its heart is a relatively dry but important architectural distinction.
Is there anything technically inaccurate in the post? I haven’t heard of anything yet, but I commit to immediately correct any technical inaccuracies.
Did I not give the people behind the posts the benefit of the doubt?Maybe. I admit I was fixated on the inaccuracies and FUD circulating at the time.
我想說的是,如果你對Xen,KVM的技術架構有足夠的了解,而且也了解Linux內核中與之相關的那部分內核代碼,那么你讀了KVM is Linux, Xen is Not這篇文章之后,是應該能夠知道Xen的那篇聲明是什么意思的。
I will say this: if you understand enough about the architecture of Xen, of KVM, and the process of including code in the Linux kernel, then reading in full the cited articles will give you an accurate account of what the Xen announcement means for Xen and for KVM.
If however you don’t know hypervisor architectures that well, or you only read the press and second hand accounts, or what a sales person told you, or the headlines and soundbites, then you probably got the wrong impression. This article was written for you.
Enough said.
I’m moving on to other topics. Feel free to comment.
KVM is Linux. Xen is Not.
Linux 3.0內核開始接收Xen 的部分代碼了,有些人說這意味著Xen已經如同Kvm一樣被緊密的整合到了Linux內核中,我想告訴你的是事實并非如此。 Kvm仍然是唯一整合進Linux內核的技術。
Last year there was a lot of talk from Citrix, XenSource, and Oracle about the acceptance of certain Xen code and drivers into the Linux 3.0 kernel. I still hear it today. They’re implying that it means the Xen has been as tightly integrated into the Linux kernel as KVM. And I’m here to tell you that they are wrong.
Here’s what Oracle and Citrix have said on the matter:
“I’ve heard over the last few years, competitors use “There is no Xen support in Linux” as a tagline to create FUD with the Xen userbase and promote alternatives. Well, it’s all there people.” — Wim Coekaert, Oracle
“During all the fuss of Citrix Synergy last week, an event of pretty earth-shattering importance occurred in the open source world: all key Xen code was accepted into the Linux mainline kernel.”– Simon Crosby, Citrix
Wrong!
The Oracle and Citrix marketing on this issue are misleading to say the least. It implies that the recent acceptance of some Xen enablement code into the Linux kernel equates to integration, or that the Xen architecture doesn’t matter now that some of their code is in Linux.
KVM is still the only Linux kernel-integrated hypervisor technology. End of sentence. End of story.
KVM被整合到Linux內核中,意味著KVM使用Linux來做包括 設備管理,CPU調度,內存頁分享,以更好的算法利用 CPU內核和內存,以及利用近五年來 Intel和AMD的x86硬件虛擬化技術。
There is no special KVM enablement needed in the Linux kernel. KVM is integrated into the Linux kernel.KVM uses Linux for everything from device management to CPU scheduling, memory page sharing, better algorithms for making use of lots of cores and lots of memory, and tying into all the hardware virtualization technology AMD and Intel have been building into x86 for the past 5 years.
Xen is no more mainineor mainstreamtoday in 2012 when it comes to Linux than it was in 2007 when KVM was accepted into the Linux kernel, or 2009 when Red Hat decided to move forward with KVM instead of Xen and integrated KVM into RHEL.
OK, then, what’s the Real Scoop?
Xen實際上仍然是沒有進入內核的,Xen的hypervisor技術,決定了它無法直接“影響”linux內核的技術,如:transparent huge pages - 透明大型分頁, CFS scheduler, paging-分頁, memory overcommitment with KSM -內存過載,等等。
你仍然需要在裸硬件上安裝Xen kernel,構建一個特殊的VM客戶機“Dom0”來管理這個Xen kenerl(我不太了解Xen, 或許我這里翻譯有誤, 僅作參考),并提供設備驅動。Xen的技術架構仍然是 Xen-Dom0-DomU。
Xen has still not been accepted (and probably never will be) into the Linux kernel, and cannot leverage directly Linux technologies such as transparent huge pages, CFS scheduler, paging, memory overcommitment with KSM, etc. for its hypervisor technology. You still need to install the Xen kernel on bare metal and build a special VM called a Dom0 to manage it and to provide device drivers. And you still have the suboptimal Xen architecture with Xen-Dom0-DomU. See the ugly diagrams below for more details.
那所謂的Linux 3.0接收Xen進入意味著什么呢。僅意味著兩件事情:
1、自linux 3.0開始,Xen使用的paravirtualized drivers - 半虛擬化驅動 會被整合到linux內核中。這個類似于,從Linux 3.x+ 開始,如果你想在Linux 3.x+內核的客戶機中使用virtio ( KVM/libvirt ),pv-scsi ( VMware ),pv-ops 這些用來加速 disk(磁盤) 和 NIC(網卡)硬件,就不用自己去整合到客戶機里面,已經給你準備好了。
2、從linxu 3.0開始,你不需要修改內核,就可以使用linux做為Dom0。記住Dom0是Xen的控制臺操作系統所在,也要負責處理某些的來自客戶機的IO請求。Dom0不是Xen本身,Xen仍然在裸硬件上,是獨立于Linux的一個項目,Xen要自己去做支持硬件和新的虛擬化技術的工作。
總之,從linux 3.0開始,如果你要使用Xen(當前版本和未來的版本)來做hypervisor,那么,你使用Linux 系統作為客戶機,或者作為Dom0,會相對容易一些。
如果你要使用linux 3.0之前的版本做Dom0,則需要修改 (won’t work without modifications)
如果你要使用linux 3.0之前的版本做客戶機,你需要hack in the drivers(不明白什么意思)
因為KVM被整合進了Linux 內核,所以它可以利用繼承自linux的一些功能來做hypervisor的工作。如:scheduling, paging, frequency scaling and hardware enablement。
Xen仍然需要自己完成這一部分的工作,這是Xen技術的一部分,將來也不會改變的。
The announcement of Xen and Linux 3.0 means two (and only two) things:
1. The paravirtualized drivers that Xen uses will be integrated into Linux starting with 3.0. This means that just like virtio(KVM/Libvirt) and pv-scsi (VMware), the pv-ops drivers used for accelerated disk and NIC will be available in any Linux 3.x+ guest without having to integrate drivers. This leaves Microsoft Hyper-V alone in requiring integrating drivers for guests.
2. A Linux 3.0 or higher guest can be used unmodified as a Dom0. Remember Dom0is where the console operating system resides and is also a slave for certain IO from the guests. It is not Xen itself. Xen still resides on the bare metal and is still a separate project from Linux that has to duplicate effort to support hardware and new virtualization technologies.
In summary, it will be slightly easier to use future versions of Linux guests with current and future versionsof Xen, and it will be slightly easier to use future versionsof Linux as a Dom0for current and future versionsof Xen.
If you want to use a pre-3.0 Linux as a Dom0 it won’t work without modifications. If you want to use pre-3.0 Linux guests, you still need to hack in the drivers.
Not such a big deal after all. So does this change anything for KVM?
In a word, No.
One of KVM’s strengths is that it is integrated into the Linux kernel and therefore can utilize Linux features for things that hypervisors do besides just being a hypervisor.
Xen hypervisor is still a separate project and a completely separate code base, and features that KVM can use for virtualization and inherits from Linux (scheduling, paging, frequency scaling and hardware enablement, for example) will still need to be separately implemented in Xen. This is part of the design of Xen and is not going to change.
KVM Architecture
Elegant, isn’t it?
Xen Architecture
What a mess…
What did they say? Word for word. I’m taking down names.
Here’s links to the various blogs Citrix and Oracle have put out:
http://blogs.citrix.com/2011/05/30/xen-celebrates-the-final-step-of-a-four-year-odyssey/
http://blogs.oracle.com/wim/entry/linux_mainline_contains_all_the
轉載于:https://blog.51cto.com/guli3057/1196291
總結
以上是生活随笔為你收集整理的Xen为什么一定要进入内核 —— [简译] KVM is Linux, Xen is not的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [笔试面试][code_by_hand]
- 下一篇: 代码行统计脚本.