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

Re: [Xen-devel] [PATCH] Add a device_model_machine option for HVM domains to libxl.



On Wed, 2013-06-19 at 10:00 +0100, Paul Durrant wrote:
> > -----Original Message-----
> > From: Ian Campbell
> > Sent: 19 June 2013 09:48
> > To: Paul Durrant
> > Cc: Stefano Stabellini; xen-devel@xxxxxxxxxxxxx
> > Subject: Re: [Xen-devel] [PATCH] Add a device_model_machine option for
> > HVM domains to libxl.
> > 
> > On Wed, 2013-06-19 at 09:29 +0100, Paul Durrant wrote:
> > > > > +        b_info->u.hvm.machine =
> > > > LIBXL_DEVICE_MODEL_HVM_MACHINE_DEFAULT;
> > > >
> > > > This isn't needed, libxl_domain_build_info_init() will DTRT here.
> > > >
> > >
> > > That's what I thought. But without that line I seem to get some random
> > value.
> > 
> > Weird. The autogenerated function "libxl_domain_build_info_init_type"
> > should have coped with this, can you post its content?
> > 
> 
> No sign of initialization here... 

Ah, I think what is supposed to happen is:
libxl_domain_build_info_init: memsets the whole thing to zero and then
explicitly initialises any non-zero defaults

libxl_domain_build_info_init_type: initialises any additional non-zero
defaults based on having determined the type for the union.

Since your enum defaults to zero I think it is therefore expected that
it isn't explicitly initialised, although it doesn't explain why the
field isn't caught by the memset.

> Perhaps I needed to delete the fail to cause re-generation, or maybe running 
> 'make tools' is not enough?

Good idea to be safe.

If that doesn't help then my guess would be that something is
overwriting the field (e.g. via an erroneous use of u.pv outside a
switch/if). In that case could you try bisecting with printf between the
call to libxl_domain_build_info_init and the point where you needed to
initialise.

> 
> void libxl_domain_build_info_init_type(libxl_domain_build_info *p, 
> libxl_domain_type type)
> {
>     assert(p->type == LIBXL_DOMAIN_TYPE_INVALID);
>     p->type = type;
>     switch (p->type) {
>     case LIBXL_DOMAIN_TYPE_HVM:
>         p->u.hvm.timer_mode = LIBXL_TIMER_MODE_DEFAULT;
>         libxl_vga_interface_info_init(&p->u.hvm.vga);
>         libxl_vnc_info_init(&p->u.hvm.vnc);
>         libxl_sdl_info_init(&p->u.hvm.sdl);
>         libxl_spice_info_init(&p->u.hvm.spice);
>         break;
>     case LIBXL_DOMAIN_TYPE_PV:
>         p->u.pv.slack_memkb = LIBXL_MEMKB_DEFAULT;
>         break;
>     case LIBXL_DOMAIN_TYPE_INVALID:
>         break;
>     }
> }
> 



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