人体最大的器官是什么| 开封有什么大学| 卵巢囊性占位是什么意思| 赵本山什么时候去世的| 走读是什么意思| 水银中毒会出现什么状况| 梦见好多死人是什么征兆| 33代表什么意思| 熵是什么| 脾胃不好吃什么药好| 为什么胃酸会分泌过多| 闻鸡起舞是什么生肖| 早上起床胃疼是什么原因| 2012年属什么生肖| 首长是什么意思| 胃糜烂和胃溃疡有什么区别| 老年人吃什么水果好| 腥辣食物指的是什么| 紫河车是什么东西| 痹病是什么意思| 什么是奇门遁甲| 血管检查是做什么检查| 煊字五行属什么| 鸟大了什么林子都有| mac是什么| 为什么喜欢秋天| 大便拉不干净是什么原因| 畸胎瘤是什么意思| 二尖瓣少量反流是什么意思| 腰闪了是什么症状| 障碍性贫血是什么病| 肌肉萎缩挂什么科| 跟泰迪很像的狗叫什么| 卵巢囊性回声什么意思| 切除痣挂什么科| 心悸是什么症状| 四月七号是什么星座| 约会什么意思| 舌头有裂纹是什么原因| 老年人经常头晕是什么原因造成的| 当演员需要什么条件| 淀粉酶高是什么原因| 家有一老如有一宝是什么意思| 山川载不动太多悲哀是什么歌| 羊肉炖什么好吃| 你的书包里有什么英文| 买什么| 达英35是什么药| 皓石是什么| 锻练与锻炼有什么区别| 苦胆是什么| 维生素d低是什么原因| 嗷嗷待哺是什么意思| 肝风内动是什么原因造成的| 梦见自己拉粑粑是什么意思| 5点至7点是什么时辰| 尿酸高适合喝什么汤| 手脚麻是什么原因| kap是什么意思| 什么病会传染人| 什么牛什么毛| 什么是膜性肾病| 喝酒上脸是什么原因| 胃病可以吃什么水果| 舌边有齿痕是什么原因| 净身出户是什么意思| 痰多是什么原因引起的| 地中海贫血是什么原因引起的| 窦性心律电轴右偏什么意思| 葡萄胎有什么症状反应| 平片是什么| 女人梦见火是什么预兆| 尧五行属什么| 尿蛋白是什么原因| 大学挂科是什么意思| 生物公司是做什么的| 缪斯是什么意思| 9月三号是什么日子| 惨烈是什么意思| 龟头炎吃什么药| 矢的意思是什么| 老爹鞋适合什么人穿| 梦见坟墓是什么预兆| 卵巢囊性包块是什么意思| 症瘕痞块是什么意思| 冰清玉洁是什么意思| 不什么不什么的四字词语| 生吃苦瓜有什么好处和坏处| 啤酒花是什么东西| 农村一般喂金毛吃什么| 结石是什么| 默哀是什么意思| 怀孕前三个月为什么不能告诉别人| 钱代表什么生肖| 脸上长斑是因为什么原因引起的| 情趣什么意思| 什么叫散光| 痛经吃什么止痛药| 干咳有痰是什么原因| 鼠是什么命| 孕妇感冒吃什么药| 白羊座跟什么星座最配| 家里为什么有小飞虫| 坐飞机什么东西不能带| 苯佐卡因是什么药| 福建岩茶属于什么茶| 五马分尸是什么意思| 牙龈发紫是什么原因| 阳痿早泄吃什么药最好| 什么地回答| 三点水是什么字| 小孩流鼻涕咳嗽吃什么药| 肠炎吃什么药效果最好| 梦到门牙掉了是什么意思| 高危病变是什么意思| 9月16日是什么星座| 篦子是什么东西| 吃了安宫牛黄丸要禁忌什么不能吃| 高就是什么意思| 路冲是什么意思| 上午12点是什么时候| 六月份是什么星座| 暗喻是什么意思| 最新病毒感染什么症状| 俗不可耐是什么意思| 宝宝拉肚子有粘液是什么原因| 汉子婊什么意思| 天秤座和什么座最配对| 本我是什么意思| 今年什么时候入梅| 腹痛腹泻吃什么药| 心动过缓吃什么药最好| 什么叫肌酸激酶| 目赤什么意思| 余光是什么意思| 无以言表什么意思| 布施什么意思| 急性肠胃炎能吃什么水果| 巴士是什么意思| everytime什么意思| 入睡困难吃什么药效果最好| 八月初三是什么星座| min是什么单位| 淋巴结节挂什么科| 输钾为什么会痛| 属兔生什么属相宝宝好| 腋下长痘痘是什么原因| 伤口发炎用什么药| 肺部硬结灶是什么意思| 北京豆汁什么味道| 打下手什么意思| 章鱼吃什么食物| 倒反天罡是什么意思| 家门不幸是什么意思| 白热化阶段是什么意思| k开头的是什么车| 4.19是什么星座| 盆腔炎是什么| 茯茶属于什么茶| 痛风吃什么药止痛最快| 撕裂性骨折是什么意思| 补睾丸吃什么药最好| 浩特是什么意思| 为什么老是做梦| 戏是什么意思| 恶心想吐胃不舒服是什么原因| 婴儿睡觉头上出汗多是什么原因| 内分泌失调什么症状| 龙胆是什么| 蟑螂喜欢什么样的环境| 小舌头学名叫什么| 白带像豆腐渣用什么药| 电离辐射是指什么| 舌头烂了是什么原因| 维生素c有什么用| 脚气用什么药膏最好| 吃完海鲜不能吃什么水果| 什么的爬| 儿童看小鸡挂什么科| 低烧不退是什么原因| 2月18是什么星座| 结晶体是什么意思| 猴赛雷什么意思| 门诊是什么意思| 逐年是什么意思| 落是什么意思| 肉炒什么菜谱大全| 面色潮红是什么原因| 肺胀是什么病| 妇科炎症用什么药好| 胆囊炎不能吃什么食物| 妹汁是什么意思| 黄酒什么味道| 充电宝什么品牌最好| 大利月小利月什么意思| 早上9点半是什么时辰| 细软是什么意思| 甲状腺功能亢进是什么意思| 柠檬水有什么功效| 三个小是什么字| 宫颈光滑说明什么| 早晨起床口干口苦是什么原因| 避孕套是什么材质| 提前来大姨妈是什么原因| 什么是春梦| 多囊有什么症状| 低血糖的人吃什么东西最好| 指腹为婚是什么意思| 吃羊肉不能吃什么东西| 门前的小树已成年是什么歌| 女人脚底有痣代表什么| 极是什么意思| 下体瘙痒用什么药| 小ck是什么牌子| 球蛋白高是什么意思| 什么叫高脂血症| 肾气亏虚吃什么中成药| 58年属什么生肖| 阴道是什么| 67年的羊是什么命| 爱是什么词| 玉五行属什么| 牙疼是什么原因| 什么叫湿疹| 奕字五行属什么| 四维是什么| 亚甲炎吃什么药效果好| 今天拉警报什么意思| 代谢慢吃什么效果最快| 经期能吃什么水果| 小河虾吃什么| 幽门螺旋杆菌的症状吃什么药| 憋屎会造成什么后果| 花生为什么叫落花生| 豆角和什么不能一起吃| 秀气是什么意思| 女人肚子大是什么原因| 妍五行属性是什么| 什么是眼底病| 女生右手中指戴戒指什么意思| 瘢痕子宫是什么意思| 金字旁目字读什么| 农历八月初三是什么星座| 复辟什么意思| 长针眼是什么意思| 利血平是什么药| 血压高压高低压正常是什么原因| 李白字什么| 肌酐700多意味着什么| 溶液是什么| 藏红花泡水喝有什么功效和作用| 前位子宫和后位子宫有什么区别| 300年前是什么朝代| 为什么端午安康| 叶酸片什么时候吃| 土崩瓦解是什么意思| 腺体肠化是什么意思| 易激惹是什么意思| 免疫力低是什么原因| 陆地上最大的动物是什么| 小腹一直疼是什么原因| 巴基斯坦人说什么语言| 女性喝什么利尿最快| 疱疹挂号挂什么科室| 百度

A Rump Kernel Hypervisor for the Linux Kernel


April 23, 2013 posted by Antti Kantee

Ever since I realized that the anykernel was the best way to construct a modern general purpose operating system kernel, I have been performing experiments by running unmodified NetBSD kernel drivers in rump kernels in various environments (nb. here driver does not mean a hardware device driver, but any driver like a file system driver or TCP driver). These experiments have included userspaces of various platforms, binary kernel modules on Linux and others, and compiling kernel drivers to javascript and running them natively in a web browser. I have also claimed that the anykernel allows harnessing drivers from a general purpose OS onto more specialized embedded computing devices which are becoming the new norm. This is an attractive possibility because while writing drivers is easy, making them handle all the abnormal conditions of the real world is a time-consuming process. Since the above-mentioned experiments were done on POSIX platforms (yes, even the javascript one), the experiments did not fully support the claim. The most interesting, decidedly non-POSIX platform I could think of for experimentation was the Linux kernel. Even though it had been several years since I last worked in the Linux kernel, my hypothesis was that it would be easy and fast to get unmodified NetBSD kernel drivers running in the Linux kernel as rump kernels.

A rump kernel runs on top of the rump kernel hypervisor. The hypervisor provides high level interfaces to host features, such as memory allocation and thread creation. In this case, the Linux kernel is the host. In principle, there are three steps in getting a rump kernel to run in a given environment. In reality, I prefer a more iterative approach, but the development can be divided into three steps all the same.

  1. implement generic rump kernel hypercalls, such as memory allocation, thread creation and synchronization
  2. figure out how to compile and run the rump kernel plus hypervisor in the target environment
  3. implement I/O related hypercalls for whatever I/O you plan to do

Getting basic functionality up and running was a relatively straightforward process. The only issue that required some thinking was an application binary interface (ABI) mismatch. I was testing on x86 where Linux kernel ABI uses -mregparm=3, which means that function arguments are passed in registers where possible. NetBSD always passes arguments on the stack. When two ABIs collide, the code may run, but since function arguments passed between the two ABIs result in garbage, eventually an error will be hit perhaps in the form of accessing invalid memory. The C code was easy enough to "fix" by applying the appropriate compiler flags. In addition to C code, a rump kernel uses a handful of assembly routines from NetBSD, mostly pertaining to optimizations (e.g. ffs()), but also to access the atomic memory operations of the platform. After assembly routines had been handled, it was possible to load a Linux kernel module which bootstraps a rump kernel in the Linux kernel and does some file system operations on the fictional kernfs file system. A screenshot of the resulting dmesg output is shown below.

fs demo screenshot

It is one thing to execute a computation and an entirely different thing to perform I/O. To test I/O capabilities, I ran a rump kernel providing a TCP/IP driver inside the Linux kernel. For a networking stack to be able to do anything sensible, the interface layer needs to be able to shuffle packets. The quickest way to implement the hypercalls for packet shuffling was to use the same method as a userspace virtual TCP/IP stack might use: read/write packets using the tap device. Some might say that doing this from inside the kernel is cheating, but given that the alternative was to copypaste the tuntap driver and edit it slightly, I call my approach constructive laziness.

The demo itself opens a TCP socket to port 80 on vger.kernel.org (IP address 0x43b484d1 if you want to be really precise), does a HTTP get for "/" and displays the last 500 bytes of the result. TCP/IP is handled by the rump kernel, not by the Linux kernel. Think of it as the Linux kernel having two alternative TCP/IP stacks. Again, a screenshot of the resulting dmesg is shown below. Note that unlike in the first screenshot, there is no printout for the root file system because the configuration used here does not include any file system support. Yes, you can ping 10.0.2.17.

net demo screenshot

As hypothesized, a rump kernel hypervisor for the Linux kernel was easy and straightforward to implement. Furthermore, it could be done without making any changes to the existing hypercall interface thereby reinforcing the belief that unmodified NetBSD kernel drivers can run on top of most any embedded firmwares just by implementing a light hypervisor layer.

There were no challenges in the experiment, only annoyances. As Linux does not support rump kernels, I had to revert back to the archaic full OS approach to kernel development. The drawbacks of the full OS approach include for example suffering multi-second reboot cycles during iterative development. The other tangential issue that I spent a disproportionately large amount of time with was thinking about how releasing this code would affect existing NetBSD code due to GPL involvement. My conclusion was that this does not matter since all code used by the current demo is open source anyway, and if someone wants to use my code in a product, it is their problem, not mine.

For people interested in examining the implementation, I put the source code for the hypervisor along with the test code in a git repo here. The repository also contains the demos linked from this article. The NetBSD kernel drivers I used are available from ftp.netbsd.org or by getting buildrump.sh and running ./buildrump.sh checkout.

[2 comments]

 



Comments:

I don't think you can view it as open source trumping all other forms of licenses. You could run a script over your code to put in GPL license headers on it, with a COPYING license file in place and perhaps have a friend maintain a git repo for that branch. Do you think this rump approach will be similar to the impact modules had for development ease? Essentially a programmable or custom fitting virtual machine.

Posted by Lester Vecsey on April 25, 2013 at 07:24 PM UTC #

Everything that is a derivative work of the Linux kernel is already licensed under GPL. Section 4.5 of my dissertation discusses the advantages of rump kernels in development. You can find a pdf link from netbsd.org/docs/rump/ (the pdf's URL is inconveniently long).

Posted by Antti Kantee on April 26, 2013 at 10:22 AM UTC #

Post a Comment:
Comments are closed for this entry.
氢化植物油是什么 八卦分别代表什么 喝可乐有什么好处 为什么偏偏喜欢你 前胸后背疼是什么病
糖尿病什么原因引起的 旺盛是什么意思 什么是包皮过长 辩解是什么意思 泌乳素高有什么症状
总胆固醇是什么意思 眼视光医学是干什么的 请问支气管炎吃什么药最有效 气血不足吃什么中成药最好 湿气重挂什么科
熊猫属于什么科动物 aut0是什么意思 梦到买房子是什么意思 爬楼是什么意思 gpi是什么意思
cim是什么意思hcv7jop9ns6r.cn 煮黑豆吃有什么功效hcv8jop8ns2r.cn 甜胚子是什么做的hcv7jop9ns4r.cn 脸痒痒用什么方法可以缓解hcv8jop2ns0r.cn 脑动脉硬化吃什么药hcv9jop4ns7r.cn
吃什么治便秘hcv8jop0ns8r.cn ns是什么意思inbungee.com 结节是什么症状hcv7jop6ns7r.cn 呕吐拉肚子吃什么药hcv9jop4ns7r.cn 子宫小结节是什么意思hcv7jop6ns8r.cn
大人退烧吃什么药hkuteam.com 天安门以前叫什么fenrenren.com 取环后应该注意什么hcv7jop6ns2r.cn 什么是中线hcv8jop3ns4r.cn 大地鱼是什么鱼huizhijixie.com
金牛男最烦什么女孩hcv8jop2ns0r.cn 酸菜鱼用什么鱼做好吃hcv7jop4ns8r.cn 老狐狸是什么意思hcv8jop9ns5r.cn 嬉皮士是什么意思hcv8jop9ns6r.cn 眉毛上方有痣代表什么hcv7jop7ns0r.cn
百度