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 -0000      1.27
> +++ vmm.c     14 Apr 2017 04:11:33 -0000
> @@ -540,7 +540,7 @@ vm_resetcpu(struct vm_resetcpu_params *v
>           vm->vm_id, vcpu->vc_id);
>  
>       if (vcpu_reset_regs(vcpu, &vrp->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->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->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 != 0xFFFF) {
>                       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 vcpu *vcpu, struct v
>                        * Disable window exiting
>                        */
>                       if (vmread(VMCS_PROCBASED_CTLS, &procbased)) {
> -                             printf("vcpu_run_vmx: can't read"
> -                                 "procbased ctls on exit\n");
> +                             printf("%s: can't read"
> +                                 " procbased ctls on exit\n", __func__);
>                               ret = EINVAL;
>                               break;
>                       } else {
>                               procbased &= ~IA32_VMX_INTERRUPT_WINDOW_EXITING;
>                               if (vmwrite(VMCS_PROCBASED_CTLS, procbased)) {
> -                                     printf("vcpu_run_vmx: can't write"
> -                                        " procbased ctls on exit\n");
> +                                     printf("%s: can't write procbased"
> +                                        " ctls on exit\n", __func__);
>                                       ret = EINVAL;
>                                       break;
>                               }
> @@ -3505,8 +3505,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>                           &vcpu->vc_gueststate.vg_eip, &exit_reason);
>                       if (vmread(VMCS_GUEST_IA32_RFLAGS,
>                           &vcpu->vc_gueststate.vg_eflags)) {
> -                             printf("vcpu_run_vmx: can't read guest rflags"
> -                                " during exit\n");
> +                             printf("%s: can't read guest rflags"
> +                                " during exit\n", __func__);
>                               ret = EINVAL;
>                               break;
>                          }
> @@ -3523,13 +3523,13 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>               if (ret == 0) {
>                       resume = 1;
>                       if (!(exitinfo & VMX_EXIT_INFO_HAVE_RIP)) {
> -                             printf("vcpu_run_vmx: cannot read guest rip\n");
> +                             printf("%s: cannot read guest rip\n", __func__);
>                               ret = EINVAL;
>                               break;
>                       }
>  
>                       if (!(exitinfo & VMX_EXIT_INFO_HAVE_REASON)) {
> -                             printf("vcpu_run_vmx: cant read exit reason\n");
> +                             printf("%s: cant read exit reason\n", __func__);
>                               ret = EINVAL;
>                               break;
>                       }
> @@ -3571,16 +3571,16 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>                        */
>                       if (vcpu->vc_irqready == 0 && vcpu->vc_intr) {
>                               if (vmread(VMCS_PROCBASED_CTLS, &procbased)) {
> -                                     printf("vcpu_run_vmx: can't read"
> -                                        " procbased ctls on intwin exit\n");
> +                                     printf("%s: can't read procbased"
> +                                        " ctls on intwin exit\n", __func__);
>                                       ret = EINVAL;
>                                       break;
>                               }
>  
>                               procbased |= IA32_VMX_INTERRUPT_WINDOW_EXITING;
>                               if (vmwrite(VMCS_PROCBASED_CTLS, procbased)) {
> -                                     printf("vcpu_run_vmx: can't write"
> -                                        " procbased ctls on intwin exit\n");
> +                                     printf("%s: can't write procbased"
> +                                        " ctls on intwin exit\n", __func__);
>                                       ret = EINVAL;
>                                       break;
>                               }
> @@ -3609,8 +3609,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>                               yield();
>                       }
>               } else if (ret == VMX_FAIL_LAUNCH_INVALID_VMCS) {
> -                     printf("vcpu_run_vmx: failed launch with invalid "
> -                         "vmcs\n");
> +                     printf("%s: failed launch with invalid "
> +                         "vmcs\n", __func__);
>  #ifdef VMM_DEBUG
>                       vmx_vcpu_dump_regs(vcpu);
>                       dump_vcpu(vcpu);
> @@ -3618,23 +3618,23 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v
>                       ret = EINVAL;
>               } else if (ret == VMX_FAIL_LAUNCH_VALID_VMCS) {
>                       exit_reason = vcpu->vc_gueststate.vg_exit_reason;
> -                     printf("vcpu_run_vmx: failed launch with valid "
> -                         "vmcs, code=%d (%s)\n", exit_reason,
> +                     printf("%s: failed launch with valid "
> +                         "vmcs, code=%d (%s)\n", __func__, exit_reason,
>                           vmx_instruction_error_decode(exit_reason));
>                       if (vmread(VMCS_INSTRUCTION_ERROR, &insn_error)) {
> -                             printf("vcpu_run_vmx: can't read"
> -                                 " insn error field\n");
> +                             printf("%s: can't read"
> +                                 " insn error field\n", __func__);
>                       } else
> -                             printf("vcpu_run_vmx: insn error code = "
> -                                 "%d\n", insn_error);
> +                             printf("%s: insn error code = %d\n",
> +                                 __func__, insn_error);
>  #ifdef VMM_DEBUG
>                       vmx_vcpu_dump_regs(vcpu);
>                       dump_vcpu(vcpu);
>  #endif /* VMM_DEBUG */
>                       ret = EINVAL;
>               } else {
> -                     printf("vcpu_run_vmx: failed launch for unknown "
> -                         "reason %d\n", ret);
> +                     printf("%s: failed launch for unknown "
> +                         "reason %d\n", __func__, ret);
>  #ifdef VMM_DEBUG
>                       vmx_vcpu_dump_regs(vcpu);
>                       dump_vcpu(vcpu);
> @@ -3675,7 +3675,7 @@ vmx_handle_intr(struct vcpu *vcpu)
>       vaddr_t handler;
>  
>       if (vmread(VMCS_EXIT_INTERRUPTION_INFO, &eii)) {
> -             printf("vmx_handle_intr: can't obtain intr info\n");
> +             printf("%s: can't obtain intr info\n", __func__);
>               return;
>       }
>  
> @@ -3749,8 +3749,8 @@ vmx_handle_exit(struct vcpu *vcpu)
>       switch (exit_reason) {
>       case VMX_EXIT_INT_WINDOW:
>               if (!(eflags & PSL_I)) {
> -                     DPRINTF("vmx_handle_exit: impossible interrupt window"
> -                        " exit config\n");
> +                     DPRINTF("%s: impossible interrupt window"
> +                        " exit config\n", __func__);
>                       ret = EINVAL;
>                       break;
>               }
> @@ -3791,7 +3791,7 @@ vmx_handle_exit(struct vcpu *vcpu)
>               break;
>       case VMX_EXIT_TRIPLE_FAULT:
>  #ifdef VMM_DEBUG
> -             DPRINTF("vmx_handle_exit: vm %d vcpu %d triple fault\n",
> +             DPRINTF("%s: vm %d vcpu %d triple fault\n", __func__,
>                   vcpu->vc_parent->vm_id, vcpu->vc_id);
>               vmx_vcpu_dump_regs(vcpu);
>               dump_vcpu(vcpu);
> @@ -3801,7 +3801,7 @@ vmx_handle_exit(struct vcpu *vcpu)
>               update_rip = 0;
>               break;
>       default:
> -             DPRINTF("vmx_handle_exit: unhandled exit %lld (%s)\n",
> +             DPRINTF("%s: unhandled exit %lld (%s)\n", __func__,
>                   exit_reason, vmx_exit_reason_decode(exit_reason));
>               return (EINVAL);
>       }
> @@ -4088,23 +4088,23 @@ vmx_handle_cr(struct vcpu *vcpu)
>  
>       switch (dir) {
>       case CR_WRITE:
> -             DPRINTF("vmx_handle_cr: mov to cr%d @ %x\n",
> +             DPRINTF("%s: mov to cr%d @ %x\n", __func__,
>                   crnum, vcpu->vc_gueststate.vg_eip);
>               break;
>       case CR_READ:
> -             DPRINTF("vmx_handle_cr: mov from cr%d @ %x\n",
> +             DPRINTF("%s: mov from cr%d @ %x\n", __func__,
>                   crnum, vcpu->vc_gueststate.vg_eip);
>               break;
>       case CR_CLTS:
> -             DPRINTF("vmx_handle_cr: clts instruction @ %x\n",
> +             DPRINTF("%s: clts instruction @ %x\n", __func__,
>                   vcpu->vc_gueststate.vg_eip);
>               break;
>       case CR_LMSW:
> -             DPRINTF("vmx_handle_cr: lmsw instruction @ %x\n",
> +             DPRINTF("%s: lmsw instruction @ %x\n", __func__,
>                   vcpu->vc_gueststate.vg_eip);
>               break;
>       default:
> -             DPRINTF("vmx_handle_cr: unknown cr access @ %x\n",
> +             DPRINTF("%s: unknown cr access @ %x\n", __func__,
>                   vcpu->vc_gueststate.vg_eip);
>       }
>  
> 

Reply via email to