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

RE: [PATCH v4 4/5] common/domain: add a domain context record for shared_info...



> -----Original Message-----
> From: Paul Durrant <xadimgnik@xxxxxxxxx>
> Sent: 21 May 2020 16:26
> To: 'Julien Grall' <julien@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: 'Paul Durrant' <pdurrant@xxxxxxxxxx>; 'Ian Jackson' 
> <ian.jackson@xxxxxxxxxxxxx>; 'Wei Liu'
> <wl@xxxxxxx>; 'Andrew Cooper' <andrew.cooper3@xxxxxxxxxx>; 'George Dunlap' 
> <george.dunlap@xxxxxxxxxx>;
> 'Jan Beulich' <jbeulich@xxxxxxxx>; 'Stefano Stabellini' 
> <sstabellini@xxxxxxxxxx>
> Subject: RE: [PATCH v4 4/5] common/domain: add a domain context record for 
> shared_info...
> 
> > -----Original Message-----
> [snip]
> > > diff --git a/xen/common/domain.c b/xen/common/domain.c
> > > index 7cc9526139..14e96c3bc2 100644
> > > --- a/xen/common/domain.c
> > > +++ b/xen/common/domain.c
> > > @@ -33,6 +33,7 @@
> > >   #include <xen/xenoprof.h>
> > >   #include <xen/irq.h>
> > >   #include <xen/argo.h>
> > > +#include <xen/save.h>
> > >   #include <asm/debugger.h>
> > >   #include <asm/p2m.h>
> > >   #include <asm/processor.h>
> > > @@ -1649,6 +1650,64 @@ int continue_hypercall_on_cpu(
> > >       return 0;
> > >   }
> > >
> > > +static int save_shared_info(const struct domain *d, struct 
> > > domain_context *c,
> > > +                            bool dry_run)
> > > +{
> > > +    struct domain_shared_info_context ctxt = {
> > > +#ifdef CONFIG_COMPAT
> > > +        .flags = has_32bit_shinfo(d) ? DOMAIN_SAVE_32BIT_SHINFO : 0,
> > > +#endif
> > > +        .buffer_size = sizeof(shared_info_t),
> > > +    };
> > > +    size_t hdr_size = offsetof(typeof(ctxt), buffer);
> > > +    int rc;
> > > +
> > > +    rc = DOMAIN_SAVE_BEGIN(SHARED_INFO, c, 0);
> > > +    if ( rc )
> > > +        return rc;
> > > +
> > > +    rc = domain_save_data(c, &ctxt, hdr_size);
> > > +    if ( rc )
> > > +        return rc;
> > > +
> > > +    rc = domain_save_data(c, d->shared_info, ctxt.buffer_size);
> > > +    if ( rc )
> > > +        return rc;
> > > +
> > > +    return domain_save_end(c);
> > > +}
> > > +
> > > +static int load_shared_info(struct domain *d, struct domain_context *c)
> > > +{
> > > +    struct domain_shared_info_context ctxt;
> > > +    size_t hdr_size = offsetof(typeof(ctxt), buffer);
> > > +    unsigned int i;
> > > +    int rc;
> > > +
> > > +    rc = DOMAIN_LOAD_BEGIN(SHARED_INFO, c, &i);
> > > +    if ( rc || i ) /* expect only a single instance */
> > > +        return rc;
> >
> > This will return 0 if there is multiple instance. Is it intended?
> >
> 
> No, it ought to be an error... probably ENOENT.

Actually I think ENXIO might be better... ENOENT tends to imply something is 
missing rather than unexpected.

  Paul




 


Rackspace

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