Re: vmm/i386 __func__

2017-04-26 Thread Mike Larkin
On Fri, Apr 14, 2017 at 12:26:22PM +0800, Michael W. Bombardieri wrote:
> Hi,
> 
> Some printf() statements in vmm.c already used __func__
> but some didn't. This diff adds more __func__.
> 
> Also, one printf() statement was missing a space:
>"vcpu_run_vmx: can't readprocbased ctls on exit"
> 
> - Michael

I went through the whole file and fixed them all. Thanks for pointing
this out. I'll do amd64 subsequently.

-ml

> 
> 
> Index: vmm.c
> ===
> RCS file: /cvs/src/sys/arch/i386/i386/vmm.c,v
> retrieving revision 1.27
> diff -u -p -u -r1.27 vmm.c
> --- vmm.c 12 Apr 2017 05:46:59 -  1.27
> +++ vmm.c 14 Apr 2017 04:11:33 -
> @@ -540,7 +540,7 @@ vm_resetcpu(struct vm_resetcpu_params *v
>   vm->vm_id, vcpu->vc_id);
>  
>   if (vcpu_reset_regs(vcpu, >vrp_init_state)) {
> - printf("vm_resetcpu: failed\n");
> + printf("%s: failed\n", __func__);
>  #ifdef VMM_DEBUG
>   dump_vcpu(vcpu);
>  #endif /* VMM_DEBUG */
> @@ -1102,7 +1102,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
>   /* Create a new pmap for this VM */
>   pmap = pmap_create();
>   if (!pmap) {
> - printf("vm_impl_init_vmx: pmap_create failed\n");
> + printf("%s: pmap_create failed\n", __func__);
>   return (ENOMEM);
>   }
>  
> @@ -1118,7 +1118,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
>   VM_MAP_ISVMSPACE | VM_MAP_PAGEABLE);
>  
>   if (!vm->vm_map) {
> - printf("vm_impl_init_vmx: uvm_map_create failed\n");
> + printf("%s: uvm_map_create failed\n", __func__);
>   pmap_destroy(pmap);
>   return (ENOMEM);
>   }
> @@ -1131,7 +1131,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
>   PROT_READ | PROT_WRITE | PROT_EXEC,
>   >p_vmspace->vm_map, vmr->vmr_va, vmr->vmr_size);
>   if (ret) {
> - printf("vm_impl_init_vmx: uvm_share failed (%d)\n",
> + printf("%s: uvm_share failed (%d)\n", __func__,
>   ret);
>   /* uvm_map_deallocate calls pmap_destroy for us */
>   uvm_map_deallocate(vm->vm_map);
> @@ -1143,7 +1143,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
>   /* Convert the low 512GB of the pmap to EPT */
>   ret = pmap_convert(pmap, PMAP_TYPE_EPT);
>   if (ret) {
> - printf("vm_impl_init_vmx: pmap_convert failed\n");
> + printf("%s: pmap_convert failed\n", __func__);
>   /* uvm_map_deallocate calls pmap_destroy for us */
>   uvm_map_deallocate(vm->vm_map);
>   vm->vm_map = NULL;
> @@ -1181,7 +1181,7 @@ vm_impl_init_svm(struct vm *vm, struct p
>   /* Create a new pmap for this VM */
>   pmap = pmap_create();
>   if (!pmap) {
> - printf("vm_impl_init_svm: pmap_create failed\n");
> + printf("%s: pmap_create failed\n", __func__);
>   return (ENOMEM);
>   }
>  
> @@ -1199,7 +1199,7 @@ vm_impl_init_svm(struct vm *vm, struct p
>   VM_MAP_ISVMSPACE | VM_MAP_PAGEABLE);
>  
>   if (!vm->vm_map) {
> - printf("vm_impl_init_svm: uvm_map_create failed\n");
> + printf("%s: uvm_map_create failed\n", __func__);
>   pmap_destroy(pmap);
>   return (ENOMEM);
>   }
> @@ -1212,7 +1212,7 @@ vm_impl_init_svm(struct vm *vm, struct p
>   PROT_READ | PROT_WRITE | PROT_EXEC,
>   >p_vmspace->vm_map, vmr->vmr_va, vmr->vmr_size);
>   if (ret) {
> - printf("vm_impl_init_svm: uvm_share failed (%d)\n",
> + printf("%s: uvm_share failed (%d)\n", __func__,
>   ret);
>   /* uvm_map_deallocate calls pmap_destroy for us */
>   uvm_map_deallocate(vm->vm_map);
> @@ -3447,8 +3447,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>   /* Is there an interrupt pending injection? */
>   if (irq != 0x) {
>   if (!vcpu->vc_irqready) {
> - printf("vcpu_run_vmx: error - irq injected"
> - " while not ready\n");
> + printf("%s: error - irq injected"
> + " while not ready\n", __func__);
>   ret = EINVAL;
>   break;
>   }
> @@ -3457,8 +3457,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>   eii |= (1ULL << 31);/* Valid */
>   eii |= (0ULL << 8); /* Hardware Interrupt */
>   if (vmwrite(VMCS_ENTRY_INTERRUPTION_INFO, eii)) {
> - printf("vcpu_run_vmx: can't vector "
> - "interrupt to guest\n");
> + 

vmm/i386 __func__

2017-04-13 Thread Michael W. Bombardieri
Hi,

Some printf() statements in vmm.c already used __func__
but some didn't. This diff adds more __func__.

Also, one printf() statement was missing a space:
   "vcpu_run_vmx: can't readprocbased ctls on exit"

- Michael


Index: vmm.c
===
RCS file: /cvs/src/sys/arch/i386/i386/vmm.c,v
retrieving revision 1.27
diff -u -p -u -r1.27 vmm.c
--- vmm.c   12 Apr 2017 05:46:59 -  1.27
+++ vmm.c   14 Apr 2017 04:11:33 -
@@ -540,7 +540,7 @@ vm_resetcpu(struct vm_resetcpu_params *v
vm->vm_id, vcpu->vc_id);
 
if (vcpu_reset_regs(vcpu, >vrp_init_state)) {
-   printf("vm_resetcpu: failed\n");
+   printf("%s: failed\n", __func__);
 #ifdef VMM_DEBUG
dump_vcpu(vcpu);
 #endif /* VMM_DEBUG */
@@ -1102,7 +1102,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
/* Create a new pmap for this VM */
pmap = pmap_create();
if (!pmap) {
-   printf("vm_impl_init_vmx: pmap_create failed\n");
+   printf("%s: pmap_create failed\n", __func__);
return (ENOMEM);
}
 
@@ -1118,7 +1118,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
VM_MAP_ISVMSPACE | VM_MAP_PAGEABLE);
 
if (!vm->vm_map) {
-   printf("vm_impl_init_vmx: uvm_map_create failed\n");
+   printf("%s: uvm_map_create failed\n", __func__);
pmap_destroy(pmap);
return (ENOMEM);
}
@@ -1131,7 +1131,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
PROT_READ | PROT_WRITE | PROT_EXEC,
>p_vmspace->vm_map, vmr->vmr_va, vmr->vmr_size);
if (ret) {
-   printf("vm_impl_init_vmx: uvm_share failed (%d)\n",
+   printf("%s: uvm_share failed (%d)\n", __func__,
ret);
/* uvm_map_deallocate calls pmap_destroy for us */
uvm_map_deallocate(vm->vm_map);
@@ -1143,7 +1143,7 @@ vm_impl_init_vmx(struct vm *vm, struct p
/* Convert the low 512GB of the pmap to EPT */
ret = pmap_convert(pmap, PMAP_TYPE_EPT);
if (ret) {
-   printf("vm_impl_init_vmx: pmap_convert failed\n");
+   printf("%s: pmap_convert failed\n", __func__);
/* uvm_map_deallocate calls pmap_destroy for us */
uvm_map_deallocate(vm->vm_map);
vm->vm_map = NULL;
@@ -1181,7 +1181,7 @@ vm_impl_init_svm(struct vm *vm, struct p
/* Create a new pmap for this VM */
pmap = pmap_create();
if (!pmap) {
-   printf("vm_impl_init_svm: pmap_create failed\n");
+   printf("%s: pmap_create failed\n", __func__);
return (ENOMEM);
}
 
@@ -1199,7 +1199,7 @@ vm_impl_init_svm(struct vm *vm, struct p
VM_MAP_ISVMSPACE | VM_MAP_PAGEABLE);
 
if (!vm->vm_map) {
-   printf("vm_impl_init_svm: uvm_map_create failed\n");
+   printf("%s: uvm_map_create failed\n", __func__);
pmap_destroy(pmap);
return (ENOMEM);
}
@@ -1212,7 +1212,7 @@ vm_impl_init_svm(struct vm *vm, struct p
PROT_READ | PROT_WRITE | PROT_EXEC,
>p_vmspace->vm_map, vmr->vmr_va, vmr->vmr_size);
if (ret) {
-   printf("vm_impl_init_svm: uvm_share failed (%d)\n",
+   printf("%s: uvm_share failed (%d)\n", __func__,
ret);
/* uvm_map_deallocate calls pmap_destroy for us */
uvm_map_deallocate(vm->vm_map);
@@ -3447,8 +3447,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
/* Is there an interrupt pending injection? */
if (irq != 0x) {
if (!vcpu->vc_irqready) {
-   printf("vcpu_run_vmx: error - irq injected"
-   " while not ready\n");
+   printf("%s: error - irq injected"
+   " while not ready\n", __func__);
ret = EINVAL;
break;
}
@@ -3457,8 +3457,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
eii |= (1ULL << 31);/* Valid */
eii |= (0ULL << 8); /* Hardware Interrupt */
if (vmwrite(VMCS_ENTRY_INTERRUPTION_INFO, eii)) {
-   printf("vcpu_run_vmx: can't vector "
-   "interrupt to guest\n");
+   printf("%s: can't vector "
+   "interrupt to guest\n", __func__);
ret = EINVAL;
break;
}
@@ -3469,15 +3469,15 @@ vcpu_run_vmx(struct