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

Re: [Xen-devel] [PATCH for-next 6/8] x86/domain: factor out pv_domain_initialise



On Mon, Apr 24, 2017 at 04:20:36AM -0600, Jan Beulich wrote:
> > +    if ( d->arch.pv_domain.gdt_ldt_l1tab )
> > +    {
> > +        free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab);
> > +        d->arch.pv_domain.gdt_ldt_l1tab = NULL;
> > +    }
> > +
> > +    if ( d->arch.pv_domain.cpuidmasks )
> > +    {
> > +        xfree(d->arch.pv_domain.cpuidmasks);
> > +        d->arch.pv_domain.cpuidmasks = NULL;
> > +    }
> 
> Perhaps better to amend pv_domain_destroy() with the two NULL
> assignments, and call it from here?
> 

That is how it is done in v2 now.

> > @@ -593,30 +645,7 @@ int arch_domain_create(struct domain *d, unsigned int 
> > domcr_flags,
> >          d->arch.emulation_flags = emflags;
> >      }
> >  
> > -    if ( is_idle_domain(d) )
> > -        rc = 0;
> > -    else
> > -    {
> > -        d->arch.pv_domain.gdt_ldt_l1tab =
> > -            alloc_xenheap_pages(0, MEMF_node(domain_to_node(d)));
> > -        if ( !d->arch.pv_domain.gdt_ldt_l1tab )
> > -            goto fail;
> > -        clear_page(d->arch.pv_domain.gdt_ldt_l1tab);
> > -
> > -        if ( levelling_caps & ~LCAP_faulting )
> > -        {
> > -            d->arch.pv_domain.cpuidmasks = xmalloc(struct cpuidmasks);
> > -            if ( !d->arch.pv_domain.cpuidmasks )
> > -                goto fail;
> > -            *d->arch.pv_domain.cpuidmasks = cpuidmask_defaults;
> > -        }
> > -
> > -        rc = create_perdomain_mapping(d, GDT_LDT_VIRT_START,
> > -                                      GDT_LDT_MBYTES << (20 - PAGE_SHIFT),
> > -                                      NULL, NULL);
> > -    }
> > -    if ( rc )
> > -        goto fail;
> > +    rc = 0;
> 
> Seems to point out that the latest now the initializer of the variable
> is pointless (and therefore could be switched to 0 instead of this
> assignment, if an initializer is needed at all - not sure about that).

This assignment is gone in v2. The initializer isn't needed anymore.

> 
> 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®.