Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

20120729bhyve hackathon hasegaw_en


Published on

BHyVe! BHyVe!

  • Be the first to comment

20120729bhyve hackathon hasegaw_en

  1. 1. BHyVe HackathonActivity Summary ©2003 Project TIMEMACHINE BHyVe Hackathon July 29, 2012 Takeshi HASEGAWA [ja] @hasegaw / [en] @hasegaw_en
  2. 2. SummaryGoal•  Implement vmmls program to display the list of virtual machinesResult•  Implemented vmmls•  It also shows available memory 2
  3. 3. vmmls example 3
  4. 4. vmmls•  How –  Originally I tried to modify ls –  it was too rich, so finally I decided to write from scrach.•  What it does –  List the virtual machines •  no considerable difficulties here –  Show amount of available memory •  Oh my god... 4
  5. 5. Reporting available memory•  I wanted to show how much memory available.•  src/sys/amd64/vmm/vmm_mem.c has the avail memory pool which manages memory regions•  vmm_mem_steal_memory() –  Add available memory on physical machine to the memory pool•  vmm_mem_alloc(size_t size); –  Allocate memory to virtual machines from the memory pool•  vmm_mem_free(vm_paddr_t start, size_t size); –  Return allocated memory to the memory pool 5
  6. 6. Reporting available memory(cont.)•  BHyVe-sensei, I have a problem...•  The memory management is really minimum•  No one knows the amount of free memory!•  Calculated the amount of free memory –  Added new function in vmm_mem.c –  Calculates the sum of length of available memory segments 6
  7. 7. Reporting available memory(cont.)#define VMM_MEM_MAXSEGS 64/* protected by vmm_mem_mtx */static struct { vm_paddr_t base; vm_size_t length;} vmm_mem_avail[VMM_MEM_MAXSEGS]; 7
  8. 8. Reporting available memory(cont.) Host-Physical Memory (not used by FreeBSD) steal vmm_mem_avail allo ain allo ain allo ain c recl c recl c recl Guest A Guest B Guest C 8
  9. 9. Reporting available memory(cont.)•  Added the function to estimate available memory –  vmm_mem.c (in vmm.ko)•  Added a new ioctl to allow access from userland –  VM_GET_FREEMEM –  vmm_dev.c … added a new ioctl implementation –  vmm_dev.h … added a new ioctl definition•  Added a new function to libvmmapi –  vmmapi.c … added a new function API to get available memory amount•  Enhanced vmmls command by using the new API 9
  10. 10. Again,,, 10
  11. 11. Future work - 1•  Refactor the Ioctl() interface for VM_GET_FREEMEM –  ioctl() access for vmm.ko is available only when one or more VMs exist –  Ioctl(*, VM_GET_FREEMEM, ...) doesn t work when no VMs exists!•  More fancy APIs –  sysctl •  Good for reporting integer value •  Is it possible to read-callback handler? –  ioctl using another special file ‒ such as /dev/bhyve •  sysctl can handle only one value 11
  12. 12. Future work - 2•  Review the fields shown by vmmls command –  Number of vCPUs –  Disk files the VM is opening –  Networks –  Time •  How much CPU time the VM consumed? –  Memory status •  I m sure what lowmem and highmem means... –  Event counters? •  Such as counter of VMEXIT... •  Another program, such as vmmstat should be more better –  etc etc 12