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

Re: [Xen-devel] [PATCH XEN v5 09/23] tools: Refactor hypercall calling wrappers into libxencall.



On Wed, Nov 11, 2015 at 03:08:13PM +0000, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH XEN v5 09/23] tools: Refactor hypercall calling 
> wrappers into libxencall."):
> > libxencall will provide a stable API and ABI for calling hypercalls
> > (although those hypercalls themselves may not have a stable API). As
> > well as the hypercall buffer infrastructure needed in order to safely
> > provide pointer arguments to hypercalls.
> ...
> > +/*
> > + * This library allows you to make arbitrary hypercalls (subject to
> > + * sufficient permission for the process and the domain itself). Note
> > + * that while the library interface is stable the hypercalls are
> > + * subject to their own rules.
> 
> Something needs to say what the error handling is like.
> 
> Do these functions set errno ?
> 
> > +/*
> > + * Call hypercalls with varying numbers of arguments.
> > + */
> > +int xencall0(xencall_handle *xcall, unsigned int op);
> 
> Is the return value the raw hypercall return value, or is hypervisor
> do_foo returning -EFOOBAR turned into to -1/errno=EFOOBAR ?
> (Hopefully the answer to this doesn't depend on the hypercall ABI...)
> 

That is -1/errno=E_XEN_FOOBAR across all OSes.

(I think this stems from Linux ioctl semantics. Then NetBSD etc follow
suit.)

Never noticed before the error handling is not documented though. I
agree it should be documented. :-)

> > +/*
> > + * Allocate and free memory which is suitable for use as a pointer
> > + * argument to a hypercall.
> > + */
> > +void *xencall_alloc_buffer_pages(xencall_handle *xcall, int nr_pages);
> > +void xencall_free_buffer_pages(xencall_handle *xcall, void *p, int 
> > nr_pages);
> > +
> > +void *xencall_alloc_buffer(xencall_handle *xcall, size_t size);
> > +void xencall_free_buffer(xencall_handle *xcall, void *p);
> 
> See above re error handling.
> 
> Can these functions be used without (a) knowing the page size
> (b) a rounding macro ?
> 
> It would be best to save callers the trouble of providing those
> themselves.
> 
> Ian.

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