Changes between Version 6 and Version 7 of GSoC/2014/ParavirtualizationOfRTEMS


Ignore:
Timestamp:
Dec 4, 2014, 7:42:00 AM (5 years ago)
Author:
Chris Johns
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GSoC/2014/ParavirtualizationOfRTEMS

    v6 v7  
    33
    44The project this year continues with the consequent of last year. We share the same goal, to introduce a virtualization layer into RTEMS. The different between this year and last year is that we focus on hypervisor more this year. We designed two mechanism to connect guest OS and host OS. The one is hypercall to send request from guest OS to host OS. And the notification mechanism to send request from host OS to guest OS. By designing these two mechanisms in POK, the RTEMS will co-work well with POK.
    5 You can find the [http://www.rtems.org/wiki/index.php/GSOC_2013_-_Paravirtualization_of_RTEMS Wikipedia page] for last year. 
     5You can find the [wiki:GSoC/2013/ParavirtualizationOfRTEMS Wiki page] for last year. 
    66
    77And the [https://docs.google.com/document/d/10ehcM1f2eKNwcNgv5stphGtsVAnYc_K7KLhxmjvE1k8/edit proposal] of this year.   
     
    2323}
    2424}}}
    25 The POK initialize the GDT and IDT in this two function.  For more details, please see this two blogs.[http://huaiyusched.github.io/rtems/2014/03/23/pok-startup-flow-and-interrupt-system/ POK Startup Flow] and [http://huaiyusched.github.io/rtems/2014/03/30/the-syscall-system-in-pok/ The syscall system in POK]=  The POK context switch function  =
     25The POK initialize the GDT and IDT in this two function.  For more details, please see this two blogs.[http://huaiyusched.github.io/rtems/2014/03/23/pok-startup-flow-and-interrupt-system/ POK Startup Flow] and [http://huaiyusched.github.io/rtems/2014/03/30/the-syscall-system-in-pok/ The syscall system in POK]
     26=  The POK context switch function  =
    2627
    2728This function is interesting because it’s different with other operating system. It will used the structure context_t to emulate the interrupt and interrupt return behavior.
     
    3132
    3233To separate the POK BSP to x86-qemu and x86-qemu-vmm will benefit to the paravirtualization, on the point that the change of x86-qemu-vmm will not influence the normal x86-qemu, and also the change of x86-qemu-vmm will be more clear.   
    33 Where to change: There are two situations. Firstly , on some files there are only some of lines which are for virtualization only. In this situation, we use the macro POK_NEEDS_X86_VMM to control compiler. Secondly, if one file is for virtualization only, then using macro in Makefile. Here are two example:=  Separate in one source file  =
     34Where to change: There are two situations. Firstly , on some files there are only some of lines which are for virtualization only. In this situation, we use the macro POK_NEEDS_X86_VMM to control compiler. Secondly, if one file is for virtualization only, then using macro in Makefile. Here are two examples:
     35=  Separate in one source file  =
    3436
    3537In arch.c, the function pok_arch_event_register derive to types, one is for x86-qemu, the other, of course is for x86-qemu-vmm.   
     
    6466+}
    6567+#endif /* POK_NEEDS_X86_VMM */
    66 }}}=  Separate in Makefile  =
     68}}}
     69=  Separate in Makefile  =
    6770
    6871If one whole file is for virtualization only, we can change the Makefile to separate it. Here is an example:
     
    9598Here is the change make in POK kernel.
    9699 
    97 # Add a pok_hypercall_init in pok_event_init, also should add POK_NEES_X86_VMM to guard this function.   
    98 # Add the two head file, kernel/include/core/hypercall.h and libpok/include/core/hypercall.h, and build the corresponding structure and declaration.   
    99 # implement the corresponding functions in corresponding .c files. That is:   
    100 # kernel/arch/x86/hypercall.c, using this file to build the hypercall_gate.
    101 # kernel/core/hypercall.c, in this file, the pok_core_hypercall will deal with the hypercall.
    102 # modify the kernel/include/arch/x86/interrupt.h, add the support of hypercall handler.
    103 # add libpok/arch/x86/hypercall.c, in this file, we implement the pok_do_hypercall, which will invoke the soft interrupt.
    104 # modified interrelated Makefile to assure those file will work when the BSP is x86-qemu-vmm, also will not influence the normal POK, when the BSP is not x86-qemu-vmm.
    105 
    106 For more details please see this [http://huaiyusched.github.io/2014/05/30/build-a-new-hypercall-system-by-imitating-the-syscall/ blog].=  vCPU in partition  =
     1001. Add a pok_hypercall_init in pok_event_init, also should add POK_NEES_X86_VMM to guard this function.   
     1011. Add the two head file, kernel/include/core/hypercall.h and libpok/include/core/hypercall.h, and build the corresponding structure and declaration.   
     1021. implement the corresponding functions in corresponding .c files. That is:   
     1031. kernel/arch/x86/hypercall.c, using this file to build the hypercall_gate.
     1041. kernel/core/hypercall.c, in this file, the pok_core_hypercall will deal with the hypercall.
     1051. modify the kernel/include/arch/x86/interrupt.h, add the support of hypercall handler.
     1061. add libpok/arch/x86/hypercall.c, in this file, we implement the pok_do_hypercall, which will invoke the soft interrupt.
     1071. modified interrelated Makefile to assure those file will work when the BSP is x86-qemu-vmm, also will not influence the normal POK, when the BSP is not x86-qemu-vmm.
     108
     109For more details please see this [http://huaiyusched.github.io/2014/05/30/build-a-new-hypercall-system-by-imitating-the-syscall/ blog].
     110=  vCPU in partition  =
    107111
    108112
     
    120124
    121125There are something should be noted:
    122 #The space alloced by alloc_vcpu_struct can not be free. So once the vcpu has been alloced, it can't be destroyed. As a result, the vcpu can be dynamic. So maybe we can alloc it in aadl file in the future.
    123 #In the function vcpu_initialize, we planed to alloc schedule function, but as for now, the schedule for vcpu is not essential, so the function is empty for now.
    124 #The function declarations in head files is omited in this blog.
     1261. The space alloced by alloc_vcpu_struct can not be free. So once the vcpu has been alloced, it can't be destroyed. As a result, the vcpu can be dynamic. So maybe we can alloc it in aadl file in the future.
     1271. In the function vcpu_initialize, we planed to alloc schedule function, but as for now, the schedule for vcpu is not essential, so the function is empty for now.
     1281. The function declarations in head files is omited in this blog.
    125129New files
    126 #pok/kernel/core/vcpu.c
    127 #pok/kernel/arch/x86/arch_vcpu.c
    128 #pok/kernle/include/core/vcpu.h
    129 #pok/kernel/include/arch/x86/arch_vcpu.h
     1301. pok/kernel/core/vcpu.c
     1311. pok/kernel/arch/x86/arch_vcpu.c
     1321. pok/kernle/include/core/vcpu.h
     1331. pok/kernel/include/arch/x86/arch_vcpu.h
    130134Modified files
    131 #pok/kernel/core/sched.c
    132 #pok/kernel/include/partition.h
     1351. pok/kernel/core/sched.c
     1361. pok/kernel/include/partition.h
    133137Reused structure
    134 #The context_t is reused in arch_vcpu, to put the user_regs.
    135 #The interrupt_frame is reused in arch_vcpu, to put the interrupt information.
     1381. The context_t is reused in arch_vcpu, to put the user_regs.
     1391. The interrupt_frame is reused in arch_vcpu, to put the interrupt information.
    136140
    137141For more details please see this [http://huaiyusched.github.io/2014/06/10/the-design-of-vcpu-in-pok/ blog].
     
    202206=  The interrupt delivery  =
    203207
    204 This part will crash the kernel. But if disuse the mask function (i.e. no interrupt handler pending in vcpu), the upcall_irq function will return to guest OS. (Noticed this is because of a bug which makes the do_IRQ part unused, but the upcall_irq still be invoked. Now this bug is fixed.)=  The POK part  =
     208This part will crash the kernel. But if disuse the mask function (i.e. no interrupt handler pending in vcpu), the upcall_irq function will return to guest OS. (Noticed this is because of a bug which makes the do_IRQ part unused, but the upcall_irq still be invoked. Now this bug is fixed.)
     209=  The POK part  =
    205210
    206211
     
    266271
    267272When the partition resumes, the hanging interrupt of this partition should be tickled. So:
    268 #. The corresponding partition resumes.
    269 #. interrupt hang in this vCPU.
     2731. The corresponding partition resumes.
     2741. interrupt hang in this vCPU.
    270275==  What the upcall_irq exactly do?  ==
    271276
     
    300305}}}
    301306
    302 # Check the pending bit in vcpu, if it mask there is an interrupt hanging on it then go to step to.
    303 # Check the irq_desc.
    304 # If the counter not equal to zero, then save the interrupt context to interrupt frame, and invoke __upcall_irq.==  What the __upcall_irq do?  ==
     3071. Check the pending bit in vcpu, if it mask there is an interrupt hanging on it then go to step to.
     3081. Check the irq_desc.
     3091. If the counter not equal to zero, then save the interrupt context to interrupt frame, and invoke __upcall_irq.
     310==  What the __upcall_irq do?  ==
    305311
    306312
     
    415421=  In POK  =
    416422
    417 # The vCPU in POK kernel is only work for interrupt handling. we should improve it to be a part of POK processor manager. Add macro of CURRENT vCPU. Schedule function etc..
    418 # The upcall_irq is not working for now. I promise I will fix it and make it running on RTEMS. To complete the hypervisor this year will benefit the successor next year.=  In RTEMS  =
    419 
    420 # As for now, we used time interrupt to test interrupt virtualization. But we should set the time interrupt not delivery to RTEMS in future, because the cost is to heavy. This request us to build a virtual time system.
    421 # When the upcall_irq works, we should use the paravirtualization layer's API to rebuild the syscall in RTEMS.
     4231. The vCPU in POK kernel is only work for interrupt handling. we should improve it to be a part of POK processor manager. Add macro of CURRENT vCPU. Schedule function etc..
     4241. The upcall_irq is not working for now. I promise I will fix it and make it running on RTEMS. To complete the hypervisor this year will benefit the successor next year.
     425=  In RTEMS  =
     426
     4271. As for now, we used time interrupt to test interrupt virtualization. But we should set the time interrupt not delivery to RTEMS in future, because the cost is to heavy. This request us to build a virtual time system.
     4281. When the upcall_irq works, we should use the paravirtualization layer's API to rebuild the syscall in RTEMS.