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

Re: [Xen-devel] [PATCH for-next v2 05/10] x86/domain: factor out pv_vcpu_initialise



>>> On 25.04.17 at 15:52, <wei.liu2@xxxxxxxxxx> wrote:
> +static int pv_vcpu_initialise(struct vcpu *v)
> +{
> +    struct domain *d = v->domain;
> +    int rc;
> +
> +    ASSERT(!is_idle_domain(d));
> +
> +    spin_lock_init(&v->arch.pv_vcpu.shadow_ldt_lock);
> +
> +    rc = pv_create_gdt_ldt_l1tab(d, v);
> +    if ( rc )
> +        goto done;

You may simply return here.

> @@ -424,61 +468,18 @@ int vcpu_initialise(struct vcpu *v)
>      spin_lock_init(&v->arch.vpmu.vpmu_lock);
>  
>      if ( is_hvm_domain(d) )
> -    {
>          rc = hvm_vcpu_initialise(v);
> -        goto done;
> -    }
> -
> -
> -    spin_lock_init(&v->arch.pv_vcpu.shadow_ldt_lock);
> -
> -    if ( !is_idle_domain(d) )
> -    {
> -        rc = pv_create_gdt_ldt_l1tab(d, v);
> -        if ( rc )
> -            goto done;
> -
> -        BUILD_BUG_ON(NR_VECTORS * sizeof(*v->arch.pv_vcpu.trap_ctxt) >
> -                     PAGE_SIZE);
> -        v->arch.pv_vcpu.trap_ctxt = xzalloc_array(struct trap_info,
> -                                                  NR_VECTORS);
> -        if ( !v->arch.pv_vcpu.trap_ctxt )
> -        {
> -            pv_destroy_gdt_ldt_l1tab(d, v);
> -            rc = -ENOMEM;
> -            goto done;
> -        }
> -
> -        /* PV guests by default have a 100Hz ticker. */
> -        v->periodic_period = MILLISECS(10);
> -    }
> +    else if ( is_pv_domain(d) && !is_idle_domain(d) )

Only the right side of the && is needed, as is_pv is now (again) the
opposite of is_hvm.

Jan


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

 


Rackspace

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