diff options
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 5 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmmvar.h | 3 | ||||
-rw-r--r-- | usr.sbin/vmctl/vmctl.c | 12 |
3 files changed, 12 insertions, 8 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 6c4ec27c812..80436cc8a33 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.21 2015/12/09 02:29:09 deraadt Exp $ */ +/* $OpenBSD: vmm.c,v 1.22 2015/12/14 06:59:07 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -56,6 +56,7 @@ struct vm { uint32_t vm_id; pid_t vm_creator_pid; uint32_t vm_memory_size; + size_t vm_used_size; char vm_name[VMM_MAX_NAME_LEN]; struct vcpu_head vm_vcpu_list; @@ -2237,6 +2238,7 @@ vm_get_info(struct vm_info_params *vip) vip->vip_info_ct = vmm_softc->vm_ct; SLIST_FOREACH(vm, &vmm_softc->vm_list, vm_link) { out[i].vir_memory_size = vm->vm_memory_size; + out[i].vir_used_size = vm->vm_used_size; out[i].vir_ncpus = vm->vm_vcpu_ct; out[i].vir_id = vm->vm_id; out[i].vir_creator_pid = vm->vm_creator_pid; @@ -2851,6 +2853,7 @@ vmx_fault_page(struct vcpu *vcpu, paddr_t gpa) pmap_kremove(kva, PAGE_SIZE); km_free((void *)kva, PAGE_SIZE, &kv_any, &kp_none); + vcpu->vc_parent->vm_used_size += PAGE_SIZE; } else { printf("vmx_fault_page: kva failure\n"); ret = ENOMEM; diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 5a02dc6c354..8b9bc4be9de 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.3 2015/11/26 08:26:48 reyk Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.4 2015/12/14 06:59:07 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -164,6 +164,7 @@ struct vm_run_params { struct vm_info_result { /* Output parameters from VMM_IOC_INFO */ size_t vir_memory_size; + size_t vir_used_size; size_t vir_ncpus; uint8_t vir_vcpu_state[VMM_MAX_VCPUS_PER_VM]; pid_t vir_creator_pid; diff --git a/usr.sbin/vmctl/vmctl.c b/usr.sbin/vmctl/vmctl.c index 582939e756b..903b6c175c5 100644 --- a/usr.sbin/vmctl/vmctl.c +++ b/usr.sbin/vmctl/vmctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmctl.c,v 1.9 2015/12/11 10:16:53 reyk Exp $ */ +/* $OpenBSD: vmctl.c,v 1.10 2015/12/14 06:59:07 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> @@ -313,16 +313,16 @@ print_vm_info(struct vmop_info_result *list, size_t ct) size_t i, j; char *vcpu_state; - printf("%5s %5s %5s %9s %*s %s\n", "ID", "PID", "VCPUS", "MAXMEM", - VM_TTYNAME_MAX, "TTY", "NAME"); + printf("%5s %5s %5s %9s %9s %*s %s\n", "ID", "PID", "VCPUS", "MAXMEM", + "CURMEM", VM_TTYNAME_MAX, "TTY", "NAME"); for (i = 0; i < ct; i++) { vir = &list[i].vir_info; if (check_info_id(vir->vir_name, vir->vir_id)) { - printf("%5u %5u %5zd %7zdMB %*s %s\n", + printf("%5u %5u %5zd %7zdMB %7zdMB %*s %s\n", vir->vir_id, vir->vir_creator_pid, vir->vir_ncpus, vir->vir_memory_size, - VM_TTYNAME_MAX, list[i].vir_ttyname, - vir->vir_name); + vir->vir_used_size / 1024 / 1024 , VM_TTYNAME_MAX, + list[i].vir_ttyname, vir->vir_name); } if (check_info_id(vir->vir_name, vir->vir_id) > 0) { for (j = 0; j < vir->vir_ncpus; j++) { |