vbd前后端---内核模块初始化

来源:互联网 发布:数据库收银员表怎么建 编辑:程序博客网 时间:2024/06/05 19:43

一、xenbus初始化流程(事件通道、xbinit对事件中断绑定、起2个监控线程)  \linux\drivers\xen\xenbus\xenbus_probe.c
xenbus_init(void) 
||--------!is_running_on_xen(); //确认xen组件已运行
######################################注册事件通道、xenstore内存页,并绑定中断号、中断执行函数#################################################
dom0//申请事件通道号,并分配xenstore的内存页。
||--------page = get_zeroed_page(GFP_KERNEL);  //分配内存页给xenstore
||--------xen_store_mfn = xen_start_info->store_mfn =pfn_to_mfn(virt_to_phys((void *)page) >>PAGE_SHIFT); //通过虚拟地址找到物理地址,再把物理地址转换为内存页面号。

||--------alloc_unbound.dom        = DOMID_SELF;
   alloc_unbound.remote_dom = DOMID_SELF;
              err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,&alloc_unbound); //分配一个端口号与xenstored进行通信
||--------xen_store_evtchn = xen_start_info->store_evtchn =alloc_unbound.port; //将端口号接口提供出来,给dom0和domu共同使用,用于和xenstore建立通信。
||--------xen_store_interface = mfn_to_virt(xen_store_mfn);                                   //将xenstore的页面接口提供出来,使所有dom都可以访问。

domU//获取dom0申请的事件通道、xentore。并将事件通道跟xenstore绑定。(所有的dom都能看到,所以只需要绑定一次)
||--------xen_store_evtchn = xen_start_info->store_evtchn;  //事件通道号。
||--------xen_store_mfn = xen_start_info->store_mfn;
||--------xen_store_interface = mfn_to_virt(xen_store_mfn);
||--------xb_init_comms();      //将事件通道、中断号绑定。
            ||--------if (xenbus_irq) {          //若中断号已申请(系统的第二台虚拟机开始),则直接将中断号与事件通道号绑定。

                         ||--------wake_waiting函数第一次执行,将xenbus_probe放到schedule中(注册进去,未执行),并将xentore状态置位,backend、backfront初始化时notifier需要用到。
0 0
原创粉丝点击