[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 06/11] VMX/altp2m: add code to support EPTP switching and #VE.



Hi,

At 13:26 -0800 on 09 Jan (1420806396), Ed White wrote:
> @@ -2551,6 +2640,17 @@ static void vmx_vmexit_ud_intercept(struct 
> cpu_user_regs *regs)
>          hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE);
>          break;
>      case X86EMUL_EXCEPTION:
> +        /* check for a VMFUNC that should be emulated */
> +        if ( !cpu_has_vmx_vmfunc && altp2mhvm_active(current->domain) &&
> +             ctxt.insn_buf_bytes >= 3 && ctxt.insn_buf[0] == 0x0f &&
> +             ctxt.insn_buf[1] == 0x01 && ctxt.insn_buf[2] == 0xd4 &&
> +             regs->eax == 0 &&
> +             p2m_switch_vcpu_altp2m_by_id(current, (uint16_t)regs->ecx) )
> +        {
> +            regs->eip += 3;
> +            return;
> +        }
> +

I think Andrew already pointed out that this needs to be done by
adding VMFUNC to the emulator itself with a callback.  Apart from
anything else that will DTRT with prefix bytes &c.

> +        if ( (uint16_t)idx != vcpu_altp2mhvm(v).p2midx )
> +        {
> +            cpumask_clear_cpu(v->vcpu_id, p2m_get_altp2m(v)->dirty_cpumask);
> +            vcpu_altp2mhvm(v).p2midx = (uint16_t)idx;
> +            cpumask_set_cpu(v->vcpu_id, p2m_get_altp2m(v)->dirty_cpumask);

This looks wrong -- you need to do a TLB flush before you can remove
this CPU from the dirty_cpumask.

> +        }
> +    }
>  
>      /* XXX: This looks ugly, but we need a mechanism to ensure
>       * any pending vmresume has really happened
> @@ -3041,6 +3175,10 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
>              update_guest_eip();
>          break;
>  
> +    case EXIT_REASON_VMFUNC:
> +        vmx_vmexit_ud_intercept(regs);

I think vmx_vmexit_ud_intercept() should probably be renamed, and
perhaps split into two since this new caller won't want the
opt_hvm_fep stuff.

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.