All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v5 3/5] libxl: add support for vscsi
Date: Wed, 13 May 2015 17:24:00 +0200	[thread overview]
Message-ID: <20150513152400.GA23848@aepfle.de> (raw)
In-Reply-To: <1431528246.8263.307.camel@citrix.com>

On Wed, May 13, Ian Campbell wrote:

> Just looking at the API functions on this pass.

> > @@ -3628,6 +3643,7 @@ static inline void libxl__update_config_vtpm(libxl__gc *gc,
> >   * devices have same identifier. */
> >  #define COMPARE_DEVID(a, b) ((a)->devid == (b)->devid)
> >  #define COMPARE_DISK(a, b) (!strcmp((a)->vdev, (b)->vdev))
> > +#define COMPARE_VSCSI(a, b) ((a)->v_hst == (b)->v_hst)
> 
> Does this end up doing the correct thing given that vscsi is a bit
> different and the libxl_device_vscsi is actually a bus? Shouldn't
> something somewhere be taking care that vscsi->vscsi_devs is up to date,
> not just the list of the vscsi busses?

In the usecases I have seen comparing just the index number ->v_hst is
ok IMO. The tricky part is to keep xenstore and the json in sync. Given
your comment below, if ->remove will be dropped it will be required to
always keep xenstore and json in sync. I will see what needs to be done.

> >  #define COMPARE_PCI(a, b) ((a)->func == (b)->func &&    \
> >                             (a)->bus == (b)->bus &&      \
> >                             (a)->dev == (b)->dev)
> > libxl_vscsi_dev = Struct("vscsi_dev", [
> > +    ("vscsi_dev_id",     libxl_devid),
> > +    ("remove",           bool),
> 
> What is this remove field?
> 
> A libxl_vscsi_dev describes a device, not the actions which can be
> performed on the device. Those are in the names of the functions.

This is also used by the JSON to not readd an already removed device.

But perhaps the code should just use a dummy vhost->vdev and pass that
into libxl. Which in turn searches in the list of active vdevs for the
requested vdev and removes it. Sounds reasonable to do it that way.

> > +    ("pdev",             libxl_vscsi_pdev),
> > +    ("vdev",             libxl_vscsi_hctl),
> > +    ])
> > +
> > +libxl_device_vscsi = Struct("device_vscsi", [
> > +    ("backend_domid",    libxl_domid),
> > +    ("devid",            libxl_devid),
> > +    ("v_hst",            uint32),
> > +    ("vscsi_devs",       Array(libxl_vscsi_dev, "num_vscsi_devs")),
> > +    ("next_vscsi_dev_id", libxl_devid),
> 
> This one also seems odd.
> 
> If you need to store state internally within libxl then you will have to
> arrange to store it somewhere else, the public API structs are not
> appropriate.

Makes sense. I will rearrange the code which makes use of that member.

Olaf

  parent reply	other threads:[~2015-05-13 15:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 13:28 [PATCH v5 0/5] libbxl: add support for pvscsi, iteration 5 Olaf Hering
2015-05-06 13:28 ` [PATCH v5 1/5] vscsiif.h: fix WWN notation for p-dev property Olaf Hering
2015-05-13 14:11   ` Ian Campbell
2015-05-06 13:28 ` [PATCH v5 2/5] docs: add vscsi to xenstore-paths.markdown Olaf Hering
2015-05-13 14:12   ` Ian Campbell
2015-05-06 13:28 ` [PATCH v5 3/5] libxl: add support for vscsi Olaf Hering
2015-05-13 14:23   ` Ian Campbell
2015-05-15  6:29     ` Olaf Hering
2015-05-13 14:44   ` Ian Campbell
2015-05-13 15:12     ` Ian Campbell
2015-05-13 17:31       ` Olaf Hering
2015-05-15  4:11         ` Jürgen Groß
2015-05-15  5:58           ` Olaf Hering
2015-05-15  8:47             ` Ian Campbell
2015-05-15  9:35               ` Juergen Gross
2015-05-15  9:46                 ` Ian Campbell
2015-05-15  9:48                   ` Ian Campbell
2015-05-13 17:56       ` George Dunlap
2015-05-13 15:24     ` Olaf Hering [this message]
2015-05-06 13:28 ` [PATCH v5 4/5] vscsiif.h: add some notes about xenstore layout Olaf Hering
2015-05-13 14:14   ` Ian Campbell
2015-05-06 13:28 ` [PATCH v5 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework Olaf Hering
2015-05-13 14:18   ` Ian Campbell
2015-05-13 14:37     ` Olaf Hering

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=20150513152400.GA23848@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.