From: Paulina Szubarczyk <paulinaszubarczyk@gmail.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: sstabellini@kernel.org, ian.jackson@eu.citrix.com,
P.Gawkowski@ii.pw.edu.pl, dvrabel@cantab.net,
anthony.perard@citrix.com, xen-devel@lists.xenproject.org,
roger.pau@citrix.com
Subject: Re: [PATCH v2 1/2] libs, libxc: Interface for grant copy operation
Date: Fri, 17 Jun 2016 19:27:53 +0200 [thread overview]
Message-ID: <1466184473.22597.4.camel@localhost> (raw)
In-Reply-To: <20160617164351.GI28116@citrix.com>
On Fri, 2016-06-17 at 17:43 +0100, Wei Liu wrote:
> On Thu, Jun 16, 2016 at 01:16:54PM +0100, Wei Liu wrote:
> [...]
> [...]
> > > diff --git a/tools/libs/gnttab/private.h b/tools/libs/gnttab/private.h
> > > index d286c86..22ad53a 100644
> > > --- a/tools/libs/gnttab/private.h
> > > +++ b/tools/libs/gnttab/private.h
> > > @@ -9,6 +9,20 @@ struct xengntdev_handle {
> > > int fd;
> > > };
> > >
> > > +struct xengnttab_copy_grant_segment {
> > > + union xengnttab_copy_ptr {
> > > + void *virt;
> > > + struct {
> > > + uint32_t ref;
> > > + uint16_t offset;
> > > + uint16_t domid;
> > > + } foreign;
> > > + } source, dest;
> > > + uint16_t len;
> > > + uint16_t flags;
> > > + int16_t status;
> > > +};
> > >
> >
> > The struct is more or less a direct copy of Linux structure. It is
> > probably fine as-is, but I don't want to risk making this library Linux
> > centric. If you look at other functions, they accept a bunch of discrete
> > arguments then assemble those arguments into OS dependent structure in
> > osdep functions. I know having discrete arguments for the API you want
> > to introduce seems cumbersome, but I want to at least tell you all the
> > background information needed for a thorough discussion. I would be
> > interested in Roger's view on this.
> >
> > I apologise for not having commented on your series earlier.
> >
>
> After checking various places I'm convinced that this structure is fine
> as-is.
>
> BSDes have not yet had a user space grant table driver, so I don't
> really worry about that at this point.
>
> As I have asked you to removed all the stuff in xenctrl_compat.h, you
> will need to move this to libs/gnttab/xengnttab.h.
>
> Also I have one further comment for code:
>
> > +int osdep_gnttab_grant_copy(xengnttab_handle *xgt,
> > + uint32_t count,
> > + xengnttab_grant_copy_segment_t* segs)
> > +{
> > + int fd = xgt->fd;
> > + struct ioctl_gntdev_grant_copy copy;
> > +
> > + copy.segments = (struct ioctl_gntdev_grant_copy_segment*)segs;
>
> Please create an array of ioctl structure and use explicit field by
> field assignment here.
>
> Casting like this can easily introduce bug -- just imagine ioctl gets
> changed, or the segment structure gets changed.
>
> Wei.
Hi Wei,
Thank you for all the remarks. I am working on correcting the patch.
Paulina
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-17 17:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 9:43 [PATCH v2 0/2] qemu-qdisk: Implementation of grant copy operation Paulina Szubarczyk
2016-06-13 9:43 ` [PATCH v2 1/2] libs, libxc: Interface for " Paulina Szubarczyk
2016-06-13 10:04 ` David Vrabel
2016-06-16 12:16 ` Wei Liu
2016-06-16 12:36 ` David Vrabel
2016-06-16 12:50 ` Wei Liu
2016-06-17 16:43 ` Wei Liu
2016-06-17 17:27 ` Paulina Szubarczyk [this message]
2016-06-13 9:43 ` [PATCH v2 2/2] qdisk - hw/block/xen_disk: grant copy implementation Paulina Szubarczyk
2016-06-13 10:15 ` David Vrabel
2016-06-13 10:44 ` Paulina Szubarczyk
2016-06-13 10:58 ` David Vrabel
2016-06-15 16:55 ` Paulina Szubarczyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466184473.22597.4.camel@localhost \
--to=paulinaszubarczyk@gmail.com \
--cc=P.Gawkowski@ii.pw.edu.pl \
--cc=anthony.perard@citrix.com \
--cc=dvrabel@cantab.net \
--cc=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).