1 / 21

Porting Palacios to the Linux Kernel EECS441 – Resource Virtualization

Porting Palacios to the Linux Kernel EECS441 – Resource Virtualization. Steven Chen, Jason Lee, Pill Park. Overview. Goals and Thoughts Visualization Approach Status Implementation Functions Difficulties Looking to the Future Acknowledgements, Thanks Questions. Goals and Thoughts.

denise
Télécharger la présentation

Porting Palacios to the Linux Kernel EECS441 – Resource Virtualization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Porting Palacios to the Linux KernelEECS441 – Resource Virtualization Steven Chen, Jason Lee, Pill Park

  2. Overview • Goals and Thoughts • Visualization • Approach • Status • Implementation • Functions • Difficulties • Looking to the Future • Acknowledgements, Thanks • Questions Chen, Lee, Park - Team Linux, EECS441

  3. Goals and Thoughts • Have the Palacios VMM embedded into Linux • Have Palacios compiled into Linux • Have a guest successfully run in Palacios on Linux • Linux kernel host for Palacios • Would facilitate more widespread usage of Palacios • Additional platform for Palacios • Current host OSes with Palacios embedded • Kitten LWK (Sandia National Labs) • GeekOS (University of Maryland) Chen, Lee, Park - Team Linux, EECS441

  4. Visualization Palacios on Kitten Palacios on Linux Applications Applications Guest OS Linux Applications Guest OS Palacios VMM Palacios VMM Kitten LWK Linux Kernel x86-64, Cray XT IA-32, x86-64 Chen, Lee, Park - Team Linux, EECS441

  5. Approach • Initial Approach • Pattern matching between Kitten LWK, Linux kernel • Tedious process • May eventually be necessary anyways • Revised Approach • Statically link Palacios to Linux build process • Troubleshoot boot process • Troubleshoot Palacios load process • Load guest blob • Deal with panics • Deal with unimplemented functions (pattern matching?) • Get to a terminal and working guest eventually Chen, Lee, Park - Team Linux, EECS441

  6. Status • Statically link Palacios to Linux build process • Done • Troubleshoot boot process • Troubleshoot Palacios load process • Load guest blob • Done • Deal with panics • In Progress • Deal with unimplemented functions (pattern matching?) • In Progress • Get to a terminal and working guest eventually • In Progress Chen, Lee, Park - Team Linux, EECS441

  7. Status – Serial Output Chen, Lee, Park - Team Linux, EECS441

  8. Implementation • Statically Linking • Added lines to Makefile • Links libv3vee.a into the Linux kernel 666: # Link the LWK with the Palacios virtual machine monitor 667: libs-$(CONFIG_PALACIOS)+=--whole-archive $(shell echo $(CONFIG_PALACIOS_PATH)/libv3vee.a)--no-whole-archive • Starting Palacios • Added lines to init/main.c 847:int palacios_init(void); 896:#ifdef CONFIG_PALACIOS 897:     palacios_init(); 898: #endif Chen, Lee, Park - Team Linux, EECS441

  9. Functions – Adding print functionalityarch/x86/kernel/palacios/palacios.c 20staticvoid 21 palacios_print( 22constchar* fmt, 23      ... 24) 25{ 26   va_list ap; 27   va_start(ap, fmt); 28   vprintk(fmt, ap); 29   va_end(ap); 30 31return; 32} Chen, Lee, Park - Team Linux, EECS441

  10. Functions – Panic for diagnosticsarch/x86/kernel/palacios/palacios.c 210staticvoid 211 palacios_interrupt_cpu( 212struct guest_info *     vm, 213int                     cpu_id 214) 215{ 216   panic("palacios_interrupt_cpu"); 217return; 218} Chen, Lee, Park - Team Linux, EECS441

  11. Functions – Migrating Palacios’ Codearch/x86/kernel/palacios/palacios.c alloc/free for Kitten alloc/free for Linux staticvoid* palacios_alloc(unsignedint size) { return kmem_alloc(size); } staticvoid palacios_free(void* addr) { return kmem_free(addr); } staticvoid* palacios_alloc(unsignedint size) { return kmalloc(size, GFP_KERNEL); } staticvoid palacios_free(void* addr) { kfree(addr); return; } Chen, Lee, Park - Team Linux, EECS441

  12. Functions – Allocating Pagesarch/x86/kernel/palacios/palacios.c staticvoid*palacios_allocate_pages(int num_pages){int order =0;  bool extra =false;printk("will get %d pages\n", num_pages);int i =0;for(; i <20; i++){int temp = num_pages;if(num_pages >1) {      num_pages = num_pages /2;      order++;} if(num_pages ==1) {if(extra){order++;}break;}if((temp %2)==1){        extra =true;}} if(order >=14){    printk("Asked for order==%d, getting order==%d pages\n",order,14);    order =14;}void*p = __get_free_pages(GFP_KERNEL, order);if(p){     head = insert(head,(longlong) p, order);     p = __pa(p);return p;} Chen, Lee, Park - Team Linux, EECS441

  13. Functions – Freeing Pagesarch/x86/kernel/palacios/palacios.h Will use a binary search tree to recall pages to be freed struct node {struct node* left;struct node* right;longlong address;int valid;int order;};externstruct node* lookup(struct node* node,longlong start_addr);externstruct node* NewNode(longlong ptr,int order);externstruct node* insert(struct node* node,longlong ptr,int order); Chen, Lee, Park - Team Linux, EECS441

  14. Functions – Freeing Pagesarch/x86/kernel/palacios/palacios.c staticvoidpalacios_free_page(void*                  page_paddr){struct node* node = lookup(head, page_paddr);        free_pages(page_paddr, node->order);        node->valid =0;} Chen, Lee, Park - Team Linux, EECS441

  15. Functions – Freeing Pagesarch/x86/kernel/palacios/palacios.c struct node* lookup(struct node* node,longlong start_addr){if(!node){return0;}else{if(start_addr == node->address){return node;}else{if(start_addr < node->address){return lookup(node->left, start_addr);}else{return lookup(node->right, start_addr);}}}}//end of the function Chen, Lee, Park - Team Linux, EECS441

  16. Functions – Making it by Faking itarch/x86/kernel/palacios/palacios.c Getting to larger issues by hacking around smaller issues… staticunsignedintpalacios_get_cpu_khz(void){  printk("palacios_get_cpu_khz() lying to Palacios and saying 1 GHz\n");return1000000;} Chen, Lee, Park - Team Linux, EECS441

  17. DifficultiesOS Hooks to Interrupts /** Structure used by the Palacios hypervisor to interface with the host kernel. */struct v3_os_hooks palacios_os_hooks ={        .print= palacios_print,        .allocate_pages= palacios_allocate_pages,        .free_page= palacios_free_page,        .malloc= palacios_alloc,        .free= palacios_free,        .vaddr_to_paddr= palacios_vaddr_to_paddr,        .paddr_to_vaddr= palacios_paddr_to_vaddr,        .hook_interrupt= palacios_hook_interrupt,        .ack_irq= palacios_ack_interrupt,        .get_cpu_khz= palacios_get_cpu_khz,        .start_kernel_thread= palacios_start_kernel_thread,        .yield_cpu= palacios_yield_cpu,        .mutex_alloc= palacios_mutex_alloc,        .mutex_free= palacios_mutex_free,        .mutex_lock= palacios_mutex_lock,        .mutex_unlock= palacios_mutex_unlock,        .get_cpu= palacios_get_cpu,        .interrupt_cpu= palacios_interrupt_cpu,        .call_on_cpu= palacios_xcall,        .start_thread_on_cpu= palacios_start_thread_on_cpu,}; Chen, Lee, Park - Team Linux, EECS441

  18. Difficulties – Keyboard IRQsarch/x86/kernel/palacios/palacios.c // hook keyboard host events for deliver to palaciosint i =1;for(; i <200; i++){  error = request_irq(  i,&palacios_keyboard_interrupt,0,"keyboard",  NULL);if(!error){break;}}//forif(error){    printk("request irq for keyboard failed\n");    panic("request keyboard irq failed");} Chen, Lee, Park - Team Linux, EECS441

  19. Looking to the Future • Currently, 64MB limit on page_alloc • 214 [16K] * 4KB pages = 64MB • Short term - make a small guest • Long term – resolve memory limits • Properly Implement Interrupts • Improve the Palacios-Linux interface • Look to the Palacios-Kitten interface for reference • Have our code utilize Palacios data structures • Support multi-core execution Chen, Lee, Park - Team Linux, EECS441

  20. Acknowledgements, Thanks • Professor Peter Dinda • UA Andy Gocke • Lei Xia • V3VEE development group Chen, Lee, Park - Team Linux, EECS441

  21. Questions? Chen, Lee, Park - Team Linux, EECS441

More Related